test job with old namespace support to ensure backward compatibility of fission (#2654)
* trigger test job to ensure backward compatibility * update builder and function namespace in the CI test * resolve namespace to show logs for fission-CLI * export function-namespace variable * Use a common script for an old and new test run * Revert empty namespace values in the chart Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
co-authored by
Sanket Sudake
parent
985d94b5b8
commit
612206b033
@@ -166,3 +166,148 @@ jobs:
|
||||
name: kind-logs-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: kind-logs/*
|
||||
retention-days: 5
|
||||
|
||||
# Job to ensure backward compatibility if function and builder pods are created
|
||||
# inside functionNamespace and builderNamespace
|
||||
integration-test-old:
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: ${{ contains(github.event.pull_request.labels.*.name, 'run-old-ci') }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
kindversion: ["v1.19.16"]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
cache: true
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: fission/examples
|
||||
path: examples
|
||||
|
||||
- name: Helm installation
|
||||
uses: Azure/setup-helm@v3
|
||||
with:
|
||||
version: ${{ env.HELM_VERSION }}
|
||||
|
||||
- name: Kind Cluster
|
||||
uses: engineerd/setup-kind@v0.5.0
|
||||
with:
|
||||
image: kindest/node:${{ matrix.kindversion }}
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
config: kind.yaml
|
||||
|
||||
- name: Configuring and testing the Installation
|
||||
run: |
|
||||
kubectl cluster-info --context kind-kind
|
||||
kubectl get nodes
|
||||
sudo apt-get install -y apache2-utils
|
||||
kubectl config use-context kind-kind
|
||||
kubectl config view
|
||||
|
||||
- name: Helm chart lint
|
||||
run: |
|
||||
helm lint charts/fission-all/
|
||||
|
||||
- name: Install Skaffold
|
||||
run: |
|
||||
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.0.3/skaffold-linux-amd64
|
||||
sudo install skaffold /usr/local/bin/
|
||||
skaffold version
|
||||
|
||||
- name: Install GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v3
|
||||
with:
|
||||
install-only: true
|
||||
|
||||
- name: Setup Prometheus Stack
|
||||
run: |
|
||||
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
|
||||
helm repo update
|
||||
kubectl create ns monitoring
|
||||
helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring \
|
||||
--set grafana.enabled=false --set alertmanager.enabled=false
|
||||
|
||||
- name: Build and Install Fission CLI
|
||||
run: |
|
||||
make debug-vars
|
||||
make build-fission-cli
|
||||
sudo make install-fission-cli
|
||||
sudo chmod +x /usr/local/bin/fission
|
||||
|
||||
- name: Build and Install Fission
|
||||
timeout-minutes: 10
|
||||
run: |
|
||||
kubectl create ns fission
|
||||
make create-crds
|
||||
SKAFFOLD_PROFILE=kind-ci-old make skaffold-deploy
|
||||
|
||||
- name: Port-forward fission components
|
||||
run: |
|
||||
kubectl port-forward svc/router 8888:80 -nfission &
|
||||
kubectl port-forward svc/controller 8889:80 -nfission &
|
||||
|
||||
- name: Get fission version
|
||||
timeout-minutes: 10
|
||||
run: |
|
||||
fission version
|
||||
|
||||
- name: Integration tests
|
||||
timeout-minutes: 90
|
||||
run: |
|
||||
export FUNCTION_NAMESPACE=fission-function
|
||||
export BUILDER_NAMESPACE=fission-builder
|
||||
./test/kind_CI.sh
|
||||
|
||||
- name: Collect Fission Dump
|
||||
timeout-minutes: 5
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
command -v fission && fission support dump
|
||||
|
||||
- name: Kind export logs
|
||||
timeout-minutes: 10
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
kind export logs --name kind kind-logs
|
||||
|
||||
- name: Backup prometheus data
|
||||
timeout-minutes: 10
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
TRACE=1 ./hack/backup-prometheus.sh
|
||||
|
||||
- name: Archive fission dump
|
||||
timeout-minutes: 10
|
||||
if: ${{ failure() || cancelled() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: fission-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: fission-dump/*.zip
|
||||
retention-days: 5
|
||||
|
||||
- name: Archive prometheus dump
|
||||
timeout-minutes: 10
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: prom-dump-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: /tmp/prometheus/*
|
||||
retention-days: 5
|
||||
|
||||
- name: Archive kind logs
|
||||
timeout-minutes: 10
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kind-logs-${{ github.run_id }}-${{ matrix.kindversion }}
|
||||
path: kind-logs/*
|
||||
retention-days: 5
|
||||
@@ -33,6 +33,7 @@ import (
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
"github.com/fission/fission/pkg/fission-cli/cmd"
|
||||
"github.com/fission/fission/pkg/fission-cli/console"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
)
|
||||
|
||||
type LogDBOptions struct {
|
||||
@@ -68,7 +69,8 @@ func GetFunctionPodLogs(ctx context.Context, client cmd.Client, logFilter LogFil
|
||||
fv1.ENVIRONMENT_NAME: f.Spec.Environment.Name,
|
||||
fv1.ENVIRONMENT_NAMESPACE: f.Spec.Environment.Namespace,
|
||||
}
|
||||
podList, err := client.KubernetesClient.CoreV1().Pods(podNs).List(ctx, metav1.ListOptions{
|
||||
|
||||
podList, err := client.KubernetesClient.CoreV1().Pods(util.ResolveFunctionNS(podNs)).List(ctx, metav1.ListOptions{
|
||||
LabelSelector: labels.Set(selector).AsSelector().String(),
|
||||
})
|
||||
if err != nil {
|
||||
@@ -77,7 +79,7 @@ func GetFunctionPodLogs(ctx context.Context, client cmd.Client, logFilter LogFil
|
||||
|
||||
if len(podList.Items) <= 0 {
|
||||
if logFilter.WarnUser {
|
||||
console.Warn("version<1.18 used fission-function as pod's default namespace. Specify appropriate namespace with --pod-namespace tag.")
|
||||
console.Warn("version<1.18 used fission-function as pod's default namespace. Specify appropriate namespace with --pod-namespace tag or export an environment variable for function-namespace FUNCTION_NAMESPACE")
|
||||
}
|
||||
return errors.New("no active pods found")
|
||||
}
|
||||
|
||||
@@ -24,3 +24,7 @@ const (
|
||||
FISSION_AUTH_TOKEN = "FISSION_AUTH_TOKEN"
|
||||
FISSION_STORAGE_URI = "/v1/archive"
|
||||
)
|
||||
|
||||
const (
|
||||
ENV_FUNCTION_NAMESPACE string = "FUNCTION_NAMESPACE"
|
||||
)
|
||||
|
||||
@@ -55,6 +55,16 @@ func GetFissionNamespace() string {
|
||||
return fissionNamespace
|
||||
}
|
||||
|
||||
func ResolveFunctionNS(namespace string) string {
|
||||
if namespace != metav1.NamespaceDefault {
|
||||
return namespace
|
||||
}
|
||||
if len(os.Getenv(ENV_FUNCTION_NAMESPACE)) > 0 {
|
||||
return os.Getenv(ENV_FUNCTION_NAMESPACE)
|
||||
}
|
||||
return namespace
|
||||
}
|
||||
|
||||
func GetApplicationUrl(ctx context.Context, client cmd.Client, selector string) (string, error) {
|
||||
var serverUrl string
|
||||
// Use FISSION_URL env variable if set; otherwise, port-forward to controller.
|
||||
|
||||
@@ -50,6 +50,8 @@ manifests:
|
||||
imageTag: ""
|
||||
influxdb.enabled: "false"
|
||||
namespace: fission
|
||||
builderNamespace: ""
|
||||
functionNamespace: ""
|
||||
openTelemetry.otlpCollectorEndpoint: ""
|
||||
openTelemetry.otlpInsecure: "true"
|
||||
podMonitor.additionalPodMonitorLabels.release: prometheus
|
||||
@@ -126,6 +128,38 @@ profiles:
|
||||
- op: replace
|
||||
path: /manifests/helm/releases/0/setValues/grafana.dashboards.enabled
|
||||
value: true
|
||||
- name: kind-ci-old
|
||||
patches:
|
||||
- op: replace
|
||||
path: /manifests/helm/releases/0/setValues/repository
|
||||
value: ""
|
||||
- op: replace
|
||||
path: /manifests/helm/releases/0/setValues/storagesvc.archivePruner.interval
|
||||
value: 1
|
||||
- op: replace
|
||||
path: /manifests/helm/releases/0/setValues/routerServiceType
|
||||
value: NodePort
|
||||
- op: replace
|
||||
path: /manifests/helm/releases/0/setValues/canaryDeployment.enabled
|
||||
value: true
|
||||
- op: replace
|
||||
path: /manifests/helm/releases/0/setValues/prometheus.serviceEndpoint
|
||||
value: http://prometheus-operated.monitoring.svc.cluster.local:9090
|
||||
- op: replace
|
||||
path: /manifests/helm/releases/0/setValues/podMonitor.enabled
|
||||
value: true
|
||||
- op: replace
|
||||
path: /manifests/helm/releases/0/setValues/serviceMonitor.enabled
|
||||
value: true
|
||||
- op: replace
|
||||
path: /manifests/helm/releases/0/setValues/grafana.dashboards.enabled
|
||||
value: true
|
||||
- op: replace
|
||||
path: /manifests/helm/releases/0/setValues/builderNamespace
|
||||
value: fission-builder
|
||||
- op: replace
|
||||
path: /manifests/helm/releases/0/setValues/functionNamespace
|
||||
value: fission-function
|
||||
- name: kind-opentelemetry
|
||||
patches:
|
||||
- op: replace
|
||||
|
||||
+8
-3
@@ -14,9 +14,9 @@ echo "source test_utils done"
|
||||
|
||||
dump_system_info
|
||||
|
||||
export FUNCTION_NAMESPACE=default
|
||||
export BUILDER_NAMESPACE=default
|
||||
export FISSION_NAMESPACE=fission
|
||||
export FUNCTION_NAMESPACE=${FUNCTION_NAMESPACE:-default}
|
||||
export BUILDER_NAMESPACE=${BUILDER_NAMESPACE:-default}
|
||||
export FISSION_NAMESPACE=${FISSION_NAMESPACE:-fission}
|
||||
export FISSION_ROUTER=127.0.0.1:8888
|
||||
export NODE_RUNTIME_IMAGE=fission/node-env-14
|
||||
export NODE_BUILDER_IMAGE=fission/node-builder-14
|
||||
@@ -32,6 +32,11 @@ export TS_RUNTIME_IMAGE=fission/tensorflow-serving-env
|
||||
export CONTROLLER_IP=127.0.0.1:8889
|
||||
export FISSION_NATS_STREAMING_URL=http://defaultFissionAuthToken@127.0.0.1:8890
|
||||
|
||||
echo "Variables set"
|
||||
echo "FUNCTION_NAMESPACE: $FUNCTION_NAMESPACE"
|
||||
echo "BUILDER_NAMESPACE: $BUILDER_NAMESPACE"
|
||||
echo "FISSION_NAMESPACE: $FISSION_NAMESPACE"
|
||||
|
||||
echo "Pulling env and builder images"
|
||||
docker pull -q $NODE_RUNTIME_IMAGE && kind load docker-image $NODE_RUNTIME_IMAGE --name kind
|
||||
docker pull -q $NODE_BUILDER_IMAGE && kind load docker-image $NODE_BUILDER_IMAGE --name kind
|
||||
|
||||
Reference in New Issue
Block a user