diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 668ecc6c..d5b8f443 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,11 +33,6 @@ jobs: registry: ghcr.io username: fluxcdbot password: ${{ secrets.GHCR_TOKEN }} - - name: Login to Docker Hub - uses: docker/login-action@v1 - with: - username: fluxcdbot - password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }} - name: Publish image uses: docker/build-push-action@v2 with: @@ -45,7 +40,7 @@ jobs: builder: ${{ steps.buildx.outputs.name }} context: . file: ./Dockerfile - platforms: linux/amd64,linux/arm/v7,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/arm/v7 tags: | ghcr.io/fluxcd/flagger:${{ steps.prep.outputs.VERSION }} labels: | @@ -58,8 +53,11 @@ jobs: org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }} - name: Check images run: | - docker buildx imagetools inspect docker.io/fluxcd/flagger:${{ steps.prep.outputs.VERSION }} docker buildx imagetools inspect ghcr.io/fluxcd/flagger:${{ steps.prep.outputs.VERSION }} + - name: Publish Helm charts + uses: stefanprodan/helm-gh-pages@master + with: + token: ${{ secrets.GITHUB_TOKEN }} - name: Create release uses: actions/create-release@latest env: @@ -70,4 +68,4 @@ jobs: draft: false prerelease: false body: | - [CHANGELOG](https://github.com/fluxcd/flagger/blob/main/CHANGELOG.md) + [CHANGELOG](https://github.com/fluxcd/flagger/blob/main/CHANGELOG.md#${{ steps.prep.outputs.VERSION }}) diff --git a/test/README.md b/test/README.md index e0f7167e..80d880ca 100644 --- a/test/README.md +++ b/test/README.md @@ -1,85 +1,14 @@ # Flagger end-to-end testing -The e2e testing infrastructure is powered by CircleCI and [Kubernetes Kind](https://github.com/kubernetes-sigs/kind). +The e2e testing infrastructure is powered by GitHub Actions and [Kubernetes Kind](https://github.com/kubernetes-sigs/kind). -### CircleCI e2e Istio workflow +### e2e workflow -* install latest stable kubectl [e2e-kind.sh](e2e-kind.sh) -* install Kubernetes Kind [e2e-kind.sh](e2e-kind.sh) -* create local Kubernetes cluster with kind [e2e-kind.sh](e2e-kind.sh) -* install latest stable Helm CLI [e2e-istio.sh](e2e-istio.sh) -* deploy Tiller on the local cluster [e2e-istio.sh](e2e-istio.sh) -* install Istio CRDs with Helm [e2e-istio.sh](e2e-istio.sh) -* install Istio control plane and Prometheus with Helm [e2e-istio.sh](e2e-istio.sh) -* load Flagger image onto the local cluster [e2e-istio.sh](e2e-istio.sh) -* deploy Flagger in the istio-system namespace [e2e-istio.sh](e2e-istio.sh) -* create a test namespace with Istio injection enabled [e2e-tests.sh](e2e-tests.sh) -* deploy the load tester in the test namespace [e2e-tests.sh](e2e-tests.sh) -* deploy a demo workload (podinfo) in the test namespace [e2e-tests.sh](e2e-tests.sh) -* test the canary initialization [e2e-tests.sh](e2e-tests.sh) -* test the canary analysis and promotion using weighted traffic and the load testing webhook [e2e-tests.sh](e2e-tests.sh) -* test the A/B testing analysis and promotion using cookies filters and pre/post rollout webhooks [e2e-tests.sh](e2e-tests.sh) - -### CircleCI e2e Linkerd workflow - -* install latest stable kubectl [e2e-kind.sh](e2e-kind.sh) -* install Kubernetes Kind [e2e-kind.sh](e2e-kind.sh) -* create local Kubernetes cluster with kind [e2e-kind.sh](e2e-kind.sh) -* install Linkerd [e2e-linkerd.sh](e2e-linkerd.sh) -* load Flagger image onto the local cluster [e2e-linkerd.sh](e2e-linkerd.sh) -* deploy Flagger in the linkerd namespace with Kustomize [e2e-linkerd.sh](e2e-linkerd.sh) -* create a test namespace with Linkerd injection enabled [e2e-linkerd-tests.sh](e2e-linkerd-tests.sh) -* deploy the load tester in the test namespace [e2e-linkerd-tests.sh](e2e-linkerd-tests.sh) -* deploy a demo workload (podinfo) in the test namespace [e2e-linkerd-tests.sh](e2e-linkerd-tests.sh) -* test the canary initialization with port discovery enabled and service target port [e2e-linkerd-tests.sh](e2e-linkerd-tests.sh) -* test the canary analysis and promotion using gRPC acceptance tests and HTTP load tests [e2e-linkerd-tests.sh](e2e-linkerd-tests.sh) -* test the canary rollback on HTTP 500 errors [e2e-linkerd-tests.sh](e2e-linkerd-tests.sh) - -### CircleCI e2e NGINX ingress workflow - -* install latest stable kubectl [e2e-kind.sh](e2e-kind.sh) -* install Kubernetes Kind [e2e-kind.sh](e2e-kind.sh) -* create local Kubernetes cluster with kind [e2e-kind.sh](e2e-kind.sh) -* install latest stable Helm CLI [e2e-nginx.sh](e2e-nginx.sh) -* deploy Tiller on the local cluster [e2e-nginx.sh](e2e-nginx.sh) -* install NGINX ingress with Helm [e2e-nginx.sh](e2e-nginx.sh) -* load Flagger image onto the local cluster [e2e-nginx.sh](e2e-nginx.sh) -* install Flagger and Prometheus in the ingress-nginx namespace [e2e-nginx.sh](e2e-nginx.sh) -* create a test namespace [e2e-nginx-tests.sh](e2e-nginx-tests.sh) -* deploy the load tester in the test namespace [e2e-nginx-tests.sh](e2e-nginx-tests.sh) -* deploy the demo workload (podinfo) and ingress in the test namespace [e2e-nginx-tests.sh](e2e-nginx-tests.sh) -* test the canary initialization [e2e-nginx-tests.sh](e2e-nginx-tests.sh) -* test the canary analysis and promotion using weighted traffic and the load testing webhook [e2e-nginx-tests.sh](e2e-nginx-tests.sh) -* test the A/B testing analysis and promotion using header filters and pre/post rollout webhooks [e2e-nginx-tests.sh](e2e-nginx-tests.sh) -* cleanup test environment [e2e-nginx-cleanup.sh](e2e-nginx-cleanup.sh) -* install NGINX Ingress and Flagger with custom ingress annotations prefix [e2e-nginx-custom-annotations.sh](e2e-nginx-custom-annotations.sh) -* repeat the canary and A/B testing workflow [e2e-nginx-tests.sh](e2e-nginx-tests.sh) - -### CircleCI e2e Skipper ingress workflow - -* install latest stable kubectl [e2e-kind.sh](e2e-kind.sh) -* install Kubernetes Kind [e2e-kind.sh](e2e-kind.sh) -* create local Kubernetes cluster with kind [e2e-kind.sh](e2e-kind.sh) -* install Skipper ingress with Kustomize [e2e-skipper.sh](e2e-skipper.sh) -* load Flagger image onto the local cluster [e2e-skipper.sh](e2e-skipper.sh) -* install Flagger and Prometheus in the flagger-system namespace [e2e-skipper.sh](e2e-skipper.sh) -* create a test namespace [e2e-skipper-tests.sh](e2e-skipper-tests.sh) -* deploy the load tester in the test namespace [e2e-skipper-tests.sh](e2e-skipper-tests.sh) -* deploy the demo workload (podinfo) and ingress in the test namespace [e2e-skipper-tests.sh](e2e-skipper-tests.sh) -* test the canary initialization [e2e-skipper-tests.sh](e2e-skipper-tests.sh) -* test the canary analysis and promotion using weighted traffic and the load testing webhook [e2e-skipper-tests.sh]e2e-skipper-tests.sh) -* cleanup test environment [e2e-skipper-cleanup.sh](e2e-skipper-cleanup.sh) - -### CircleCI e2e Traefik workflow - -* install latest stable kubectl [e2e-kind.sh](e2e-kind.sh) -* install Kubernetes Kind [e2e-kind.sh](e2e-kind.sh) -* create local Kubernetes cluster with kind [e2e-kind.sh](e2e-kind.sh) -* install Traeik with Helm [e2e-traefik.sh](e2e-traefik.sh) -* load Flagger image onto the local cluster [e2e-traefik.sh](e2e-traefik.sh) -* install Flagger and Prometheus in the traefik namespace [e2e-traefik.sh](e2e-traefik.sh) -* create a test namespace [e2e-traefik-tests.sh](e2e-traefik-tests.sh) -* deploy the load tester in the test namespace [e2e-traefik-tests.sh](e2e-traefik-tests.sh) -* deploy the demo workload (podinfo) and ingress in the test namespace [e2e-traefik-tests.sh](e2e-traefik-tests.sh) -* test the canary initialization [e2e-traefik-tests.sh](e2e-traefik-tests.sh) -* test the canary analysis and promotion using weighted traffic and the load testing webhook [e2e-traefik-tests.sh]e2e-traefik-tests.sh) +* create local Kubernetes cluster with KinD +* build Flagger container and load the image in KinD +* install the service mesh or ingress provider +* deploy Flagger +* create test namespace, workloads and load tester +* test the canary initialization (port discovery and metadata) +* test the canary release (progressive traffic shifting, headers routing, mirroring, analysis, promotion, rollback) +* test webhooks (conformance, load testing, pre/post rollout) diff --git a/test/container-build.sh b/test/container-build.sh deleted file mode 100755 index 205d27e7..00000000 --- a/test/container-build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -mkdir -p ${REPO_ROOT}/bin -cp /tmp/bin/flagger ${REPO_ROOT}/bin && chmod +x ${REPO_ROOT}/bin/flagger -cp /tmp/bin/loadtester ${REPO_ROOT}/bin && chmod +x ${REPO_ROOT}/bin/loadtester - -docker build -t test/flagger:latest . -f ${REPO_ROOT}/Dockerfile diff --git a/test/container-push.sh b/test/container-push.sh deleted file mode 100755 index 66dec947..00000000 --- a/test/container-push.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -push () { - echo $DOCKER_PASS | docker login -u=$DOCKER_USER --password-stdin - - if [[ -z "$CIRCLE_TAG" ]]; then - BRANCH_COMMIT=${CIRCLE_BRANCH}-$(echo ${CIRCLE_SHA1} | head -c7); - docker tag test/flagger:latest weaveworks/flagger:${BRANCH_COMMIT}; - docker push weaveworks/flagger:${BRANCH_COMMIT}; - else - VER=${CIRCLE_TAG:1} - docker tag test/flagger:latest weaveworks/flagger:${VER}; - docker push weaveworks/flagger:${VER}; - fi -} - -if [[ -z "$DOCKER_PASS" ]]; then - echo "No Docker Hub credentials, skipping image push"; -else - push -fi diff --git a/test/e2e-contour-tests.sh b/test/e2e-contour-tests.sh deleted file mode 100755 index 59877228..00000000 --- a/test/e2e-contour-tests.sh +++ /dev/null @@ -1,327 +0,0 @@ -#!/usr/bin/env bash - -# This script runs e2e tests for Canary initialization, analysis and promotion -# Prerequisites: Kubernetes Kind and Contour ingress controller - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Creating test namespace' -kubectl create namespace test - -echo '>>> Installing load tester' -kubectl apply -k ${REPO_ROOT}/kustomize/tester -kubectl -n test rollout status deployment/flagger-loadtester - -echo '>>> Initialising canary' -kubectl apply -f ${REPO_ROOT}/test/e2e-workload.yaml - -cat <>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n projectcontour logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -kubectl -n test get httpproxy podinfo -oyaml | grep 'projectcontour.io/ingress.class: contour' - -echo '✔ Canary initialization test passed' - -passed=$(kubectl -n test get svc/podinfo -o jsonpath='{.spec.selector.app}' 2>&1 | { grep podinfo-primary || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo selector test failed' - exit 1 -fi -passed=$(kubectl -n test get svc/podinfo-service-canary -o jsonpath='{.spec.selector.app}' 2>&1 | { grep podinfo || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo-service selector test failed' - exit 1 -fi - -echo '✔ Canary service custom metadata test passed' - -echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n projectcontour logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n test logs deployment/flagger-loadtester - kubectl -n projectcontour logs deployment/flagger - kubectl -n projectcontour get all - kubectl -n test get httpproxy podinfo -oyaml - echo "No more retries left" - exit 1 - fi -done - -echo '>>> Waiting for canary finalization' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Succeeded' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n projectcontour logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' - - -cat <>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.2 - -echo '>>> Waiting for canary rollback' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Failed' && ok=true || ok=false - sleep 10 - kubectl -n projectcontour logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n projectcontour logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary rollback test passed' - -cat <>> Triggering A/B testing' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.3 - -echo '>>> Waiting for A/B testing promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.3' && ok=true || ok=false - sleep 10 - kubectl -n projectcontour logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n projectcontour logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ A/B testing promotion test passed' - -kubectl -n projectcontour logs deployment/flagger - -echo '✔ All tests passed' \ No newline at end of file diff --git a/test/e2e-contour.sh b/test/e2e-contour.sh deleted file mode 100755 index f32a1634..00000000 --- a/test/e2e-contour.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -CONTOUR_VER="v1.7.0" - -echo '>>> Installing Contour' -kubectl apply -f https://projectcontour.io/quickstart/${CONTOUR_VER}/contour.yaml - -kubectl -n projectcontour rollout status deployment/contour -kubectl -n projectcontour get all - -echo '>>> Installing Flagger' -kind load docker-image test/flagger:latest - -echo '>>> Installing Flagger' -helm upgrade -i flagger ${REPO_ROOT}/charts/flagger \ ---namespace projectcontour \ ---set prometheus.install=true \ ---set meshProvider=contour \ ---set ingressClass=contour - -kubectl -n projectcontour set image deployment/flagger flagger=test/flagger:latest - -kubectl -n projectcontour rollout status deployment/flagger -kubectl -n projectcontour rollout status deployment/flagger-prometheus diff --git a/test/e2e-daemonset.yaml b/test/e2e-daemonset.yaml deleted file mode 100644 index 40cc48b6..00000000 --- a/test/e2e-daemonset.yaml +++ /dev/null @@ -1,63 +0,0 @@ -apiVersion: apps/v1 -kind: DaemonSet -metadata: - name: podinfo - namespace: test - labels: - app: podinfo -spec: - minReadySeconds: 5 - revisionHistoryLimit: 5 - selector: - matchLabels: - app: podinfo - template: - metadata: - annotations: - prometheus.io/scrape: "true" - prometheus.io/port: "9797" - labels: - app: podinfo - spec: - containers: - - name: podinfod - image: stefanprodan/podinfo:3.1.0 - imagePullPolicy: IfNotPresent - ports: - - name: http - containerPort: 9898 - protocol: TCP - - name: http-metrics - containerPort: 9797 - protocol: TCP - - name: grpc - containerPort: 9999 - protocol: TCP - command: - - ./podinfo - - --port=9898 - - --port-metrics=9797 - - --grpc-port=9999 - - --grpc-service-name=podinfo - - --level=info - - --random-delay=false - - --random-error=false - livenessProbe: - httpGet: - port: 9898 - path: /healthz - initialDelaySeconds: 5 - timeoutSeconds: 5 - readinessProbe: - httpGet: - port: 9898 - path: /readyz - initialDelaySeconds: 5 - timeoutSeconds: 5 - resources: - limits: - cpu: 1000m - memory: 128Mi - requests: - cpu: 1m - memory: 16Mi diff --git a/test/e2e-gloo-tests.sh b/test/e2e-gloo-tests.sh deleted file mode 100755 index a52b7221..00000000 --- a/test/e2e-gloo-tests.sh +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/env bash - -# This script runs e2e tests for Canary initialization, analysis and promotion -# Prerequisites: Kubernetes Kind, Helm and NGINX ingress controller - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Creating test namespace' -kubectl create namespace test - -echo '>>> Installing load tester' -kubectl apply -k ${REPO_ROOT}/kustomize/tester -kubectl -n test rollout status deployment/flagger-loadtester - -echo '>>> Initialising canary' -kubectl apply -f ${REPO_ROOT}/test/e2e-workload.yaml - -cat <>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n gloo-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -passed=$(kubectl -n test get svc/podinfo -o jsonpath='{.spec.selector.app}' 2>&1 | { grep podinfo-primary || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo selector test failed' - exit 1 -fi -passed=$(kubectl -n test get svc/podinfo-service-canary -o jsonpath='{.spec.selector.app}' 2>&1 | { grep podinfo || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo-service selector test failed' - exit 1 -fi - -echo '✔ Canary service custom metadata test passed' - -echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n gloo-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n test logs deployment/flagger-loadtester - kubectl -n gloo-system logs deployment/flagger - kubectl -n gloo-system get all - kubectl -n gloo-system get virtualservice podinfo -oyaml - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' diff --git a/test/e2e-gloo.sh b/test/e2e-gloo.sh deleted file mode 100755 index 0f95ce0a..00000000 --- a/test/e2e-gloo.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -GLOO_VER="1.3.28" -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Installing Gloo' -helm repo add gloo https://storage.googleapis.com/solo-public-helm -kubectl create ns gloo-system -helm upgrade -i gloo gloo/gloo --version ${GLOO_VER} \ ---namespace gloo-system \ ---set discovery.enabled=true - -kubectl -n gloo-system rollout status deployment/gloo -kubectl -n gloo-system rollout status deployment/gateway -kubectl -n gloo-system get all - -echo '>>> Installing Flagger' -kind load docker-image test/flagger:latest - -echo '>>> Installing Flagger' -helm upgrade -i flagger ${REPO_ROOT}/charts/flagger \ ---set crd.create=false \ ---namespace gloo-system \ ---set prometheus.install=true \ ---set meshProvider=gloo - -kubectl -n gloo-system set image deployment/flagger flagger=test/flagger:latest - -kubectl -n gloo-system rollout status deployment/flagger -kubectl -n gloo-system rollout status deployment/flagger-prometheus \ No newline at end of file diff --git a/test/e2e-ingress.yaml b/test/e2e-ingress.yaml deleted file mode 100644 index 15eefcfa..00000000 --- a/test/e2e-ingress.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: networking.k8s.io/v1beta1 -kind: Ingress -metadata: - name: podinfo - namespace: test - labels: - app: podinfo - annotations: - kubernetes.io/ingress.class: "nginx" -spec: - rules: - - host: app.example.com - http: - paths: - - backend: - serviceName: podinfo - servicePort: 80 diff --git a/test/e2e-istio-dependencies.sh b/test/e2e-istio-dependencies.sh deleted file mode 100755 index 7bfe93cb..00000000 --- a/test/e2e-istio-dependencies.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -# This script setups the scenarios for istio tests by creating a Kubernetes namespace, installing the load tester and a test workload (podinfo) -# Prerequisites: Kubernetes Kind and Istio - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Creating test namespace' -kubectl create namespace test -kubectl label namespace test istio-injection=enabled - -echo '>>> Installing the load tester' -kubectl apply -k ${REPO_ROOT}/kustomize/tester -kubectl -n test rollout status deployment/flagger-loadtester - -echo '>>> Deploy podinfo' -kubectl apply -f ${REPO_ROOT}/test/e2e-workload.yaml diff --git a/test/e2e-istio-tests-delegate.sh b/test/e2e-istio-tests-delegate.sh deleted file mode 100755 index 511abd0e..00000000 --- a/test/e2e-istio-tests-delegate.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/env bash - -# This script runs e2e tests for when the canary delegation is enabled -# Prerequisites: Kubernetes Kind and Istio - -set -o errexit - -echo '>>> Set pilot env to enable virtual service delegate' -kubectl -n istio-system set env deploy istiod PILOT_ENABLE_VIRTUAL_SERVICE_DELEGATE=true -kubectl -n istio-system rollout status deploy istiod - -echo '>>> Initialising Gateway' -cat <>> Initialising root virtual service' -cat <>> Initialising canary for delegate' -cat <>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n istio-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '>>> Waiting for canary finalization' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Succeeded' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '>>> Set pilot env to disable virtual service delegate' -kubectl -n istio-system set env deploy istiod PILOT_ENABLE_VIRTUAL_SERVICE_DELEGATE=false -kubectl -n istio-system rollout status deploy istiod - -echo '✔ Canary promotion test passed' - -if [[ "$1" = "canary" ]]; then - exit 0 -fi diff --git a/test/e2e-istio-tests-skip-analysis.sh b/test/e2e-istio-tests-skip-analysis.sh deleted file mode 100755 index 621fe285..00000000 --- a/test/e2e-istio-tests-skip-analysis.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env bash - -# This script runs e2e tests for when the canary analysis is skipped -# Prerequisites: Kubernetes Kind and Istio - -set -o errexit - -echo '>>> Initialising canary' -cat <>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n istio-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '>>> Waiting for canary finalization' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Succeeded' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' - -if [[ "$1" = "canary" ]]; then - exit 0 -fi - -echo '>>> Triggering canary deployment with a bad release (non existent docker image)' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/potato:1.0.0 - -echo '>>> Waiting for canary to fail' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl get canary/podinfo -n test -o=jsonpath='{.status.phase}' | grep 'Failed' && ok=true || ok=false - sleep 10 - kubectl -n istio-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '>>> Confirm primary pod is still running and with correct version' -retries=50 -count=0 -ok=false -until ${okImage} && ${okRunning}; do - kubectl get deployment podinfo-primary -n test -o jsonpath='{.spec.replicas}' | grep 1 && okRunning=true || okRunning=false - kubectl -n test describe deployment/podinfo-primary | grep '3.1.3' && okImage=true || okImage=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -kubectl -n istio-system logs deployment/flagger - -echo '✔ All tests passed' diff --git a/test/e2e-istio-tests.sh b/test/e2e-istio-tests.sh deleted file mode 100755 index 2954626e..00000000 --- a/test/e2e-istio-tests.sh +++ /dev/null @@ -1,608 +0,0 @@ -#!/usr/bin/env bash - -# This script runs e2e tests for Canary, B/G and A/B initialization, analysis and promotion -# Prerequisites: Kubernetes Kind and Istio - -set -o errexit - -echo '>>> Create latency metric template' -cat <>> Initialising canaries' -cat <>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - kubectl -n test get canary/podinfo-service | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -passed=$(kubectl -n test get svc/podinfo -oyaml 2>&1 | { grep annotations-test || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo annotations test failed' - exit 1 -fi -passed=$(kubectl -n test get svc/podinfo -oyaml 2>&1 | { grep labels-test || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo labels test failed' - exit 1 -fi -passed=$(kubectl -n test get svc/podinfo -o jsonpath='{.spec.selector.app}' 2>&1 | { grep podinfo-primary || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo selector test failed' - exit 1 -fi -passed=$(kubectl -n test get svc/podinfo-service-canary -o jsonpath='{.spec.selector.app}' 2>&1 | { grep podinfo || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo-service selector test failed' - exit 1 -fi - -echo '✔ Canary service custom metadata test passed' - -echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n istio-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '>>> Waiting for canary finalization' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Succeeded' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' - -if [[ "$1" = "canary" ]]; then - exit 0 -fi - -cat <>> Triggering B/G deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.2 - -echo '>>> Waiting for B/G promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.2' && ok=true || ok=false - sleep 10 - kubectl -n istio-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '>>> Waiting for B/G finalization' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Succeeded' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ B/G promotion test passed' - -cat <>> Triggering A/B testing' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.3 - -echo '>>> Waiting for A/B testing promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.3' && ok=true || ok=false - sleep 10 - kubectl -n istio-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ A/B testing promotion test passed' - -cat <>> Waiting for finalizers to be present' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl get canary podinfo -n test -o jsonpath='{.metadata.finalizers}' | grep "finalizer.flagger.app" && ok=true || ok=false - sleep 10 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe canary/podinfo - echo "No more retries left" - exit 1 - fi -done - -kubectl delete canary podinfo -n test - -echo '>>> Waiting for primary to revert' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl get deployment podinfo -n test -o jsonpath='{.spec.replicas}' | grep 1 && ok=true || ok=false - sleep 10 - kubectl -n istio-system logs deployment/flagger --tail 10 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe canary/podinfo - echo "No more retries left" - exit 1 - fi -done -echo '✔ Delete testing passed' - - - -cat <>> Waiting for canary to initialize' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n istio-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -kubectl delete canary podinfo -n test - -echo '>>> Waiting for revert' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl get svc/podinfo vs/podinfo -n test -o jsonpath="{range .items[*]}{.metadata.name}{'\n'}{end}" | wc -l | grep 2 && ok=true || ok=false - sleep 10 - kubectl -n istio-system logs deployment/flagger --tail 10 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe canary/podinfo - kubectl -n test describe svc/podinfo - kubectl -n test describe vs/podinfo - echo "No more retries left" - exit 1 - fi -done -echo '✔ Revert testing passed' - - -kubectl -n istio-system logs deployment/flagger - -echo '✔ All tests passed' diff --git a/test/e2e-istio-values.yaml b/test/e2e-istio-values.yaml deleted file mode 100644 index b234dedf..00000000 --- a/test/e2e-istio-values.yaml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Minimal Istio Configuration required by Flagger -# - -# pilot configuration -pilot: - enabled: true - sidecar: true - resources: - requests: - cpu: 10m - memory: 128Mi - -gateways: - enabled: false - istio-ingressgateway: - autoscaleMax: 1 - -# sidecar-injector webhook configuration -sidecarInjectorWebhook: - enabled: true - -# galley configuration -galley: - enabled: false - -# mixer configuration -mixer: - policy: - enabled: false - telemetry: - enabled: true - replicaCount: 1 - autoscaleEnabled: false - resources: - requests: - cpu: 10m - memory: 128Mi - -# addon prometheus configuration -prometheus: - enabled: true - scrapeInterval: 5s - -# addon jaeger tracing configuration -tracing: - enabled: false - -# Common settings. -global: - proxy: - # Resources for the sidecar. - resources: - requests: - cpu: 10m - memory: 64Mi - limits: - cpu: 1000m - memory: 256Mi - useMCP: false diff --git a/test/e2e-istio.sh b/test/e2e-istio.sh deleted file mode 100755 index 0058f6db..00000000 --- a/test/e2e-istio.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -ISTIO_VER="1.8.0" -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo ">>> Downloading Istio ${ISTIO_VER}" -cd ${REPO_ROOT}/bin && \ -curl -L https://istio.io/downloadIstio | ISTIO_VERSION=${ISTIO_VER} sh - - -echo ">>> Installing Istio ${ISTIO_VER}" -${REPO_ROOT}/bin/istio-${ISTIO_VER}/bin/istioctl manifest install --set profile=default --skip-confirmation \ - --set values.pilot.resources.requests.cpu=100m \ - --set values.pilot.resources.requests.memory=100Mi - -kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.8/samples/addons/prometheus.yaml -kubectl -n istio-system rollout status deployment/prometheus - -kubectl -n istio-system get all - -echo '>>> Load Flagger image in Kind' -kind load docker-image test/flagger:latest - -echo '>>> Installing Flagger' -kubectl apply -k ${REPO_ROOT}/kustomize/istio - -kubectl -n istio-system set image deployment/flagger flagger=test/flagger:latest -kubectl -n istio-system rollout status deployment/flagger diff --git a/test/e2e-kind.sh b/test/e2e-kind.sh deleted file mode 100755 index bb2ba52d..00000000 --- a/test/e2e-kind.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) -HELM_VERSION=v3.3.0 -KUSTOMIZE_VERSION=3.8.1 -KIND_VERSION=v0.8.1 -KUBE_VERSION=v1.16.9 - -if [[ "$1" ]]; then - KUBE_VERSION=$1 -fi - -echo ">>> Installing kubectl" -curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \ -chmod +x kubectl && \ -sudo mv kubectl /usr/local/bin/ - -echo ">>> Installing kind" -curl -sSLo kind "https://github.com/kubernetes-sigs/kind/releases/download/$KIND_VERSION/kind-linux-amd64" -chmod +x kind -sudo mv kind /usr/local/bin/kind - -echo ">>> Creating kind cluster" -kind create cluster --wait 5m --image kindest/node:${KUBE_VERSION} - -kubectl get pods --all-namespaces - -cd /tmp - -echo ">>> Installing Helm" -curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar xz && sudo mv linux-amd64/helm /usr/local/bin/ && rm -rf linux-amd64 -helm repo add stable https://kubernetes-charts.storage.googleapis.com/ - -echo ">>> Installing Kustomize" -kustomize_url=https://github.com/kubernetes-sigs/kustomize/releases/download && \ -curl -sL ${kustomize_url}/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz | tar xz -chmod +x kustomize -sudo mv kustomize /usr/local/bin/kustomize diff --git a/test/e2e-kubernetes-cleanup.sh b/test/e2e-kubernetes-cleanup.sh deleted file mode 100755 index b289ac72..00000000 --- a/test/e2e-kubernetes-cleanup.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -echo '>>> Delete test namespace' -kubectl delete namespace test --ignore-not-found=true --wait=true diff --git a/test/e2e-kubernetes-tests-daemonset.sh b/test/e2e-kubernetes-tests-daemonset.sh deleted file mode 100755 index e5ab93c3..00000000 --- a/test/e2e-kubernetes-tests-daemonset.sh +++ /dev/null @@ -1,199 +0,0 @@ -#!/usr/bin/env bash - -# This script runs e2e tests for Blue/Green initialization, analysis and promotion -# Prerequisites: Kubernetes Kind, Kustomize - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Creating test namespace' -kubectl create namespace test - -echo '>>> Installing the load tester' -kubectl apply -k ${REPO_ROOT}/kustomize/tester -kubectl -n test rollout status deployment/flagger-loadtester - -echo '>>> Initialising canary' -kubectl apply -f ${REPO_ROOT}/test/e2e-daemonset.yaml - -cat <>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n flagger-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -echo '>>> Triggering canary daemonset' -kubectl -n test set image daemonset/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe daemonset/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n flagger-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe daemonset/podinfo - kubectl -n test describe daemonset/podinfo-primary - kubectl -n flagger-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' - - -cat <>> Waiting for finalizers to be present' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl get canary podinfo -n test -o jsonpath='{.metadata.finalizers}' | grep "finalizer.flagger.app" && ok=true || ok=false - sleep 10 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe canary/podinfo - echo "No more retries left" - exit 1 - fi -done - -kubectl delete canary podinfo -n test - -echo '>>> Waiting for primary to revert' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl get daemonset podinfo -n test -o jsonpath='{.status.numberReady}' | grep 1 && ok=true || ok=false - sleep 10 - kubectl -n flagger-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe canary/podinfo - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary finalize passed' - -kubectl -n flagger-system logs deployment/flagger diff --git a/test/e2e-kubernetes-tests-deployment.sh b/test/e2e-kubernetes-tests-deployment.sh deleted file mode 100755 index 2cd3bed7..00000000 --- a/test/e2e-kubernetes-tests-deployment.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env bash - -# This script runs e2e tests for Blue/Green initialization, analysis and promotion -# Prerequisites: Kubernetes Kind, Kustomize - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Creating test namespace' -kubectl create namespace test - -echo '>>> Installing the load tester' -kubectl apply -k ${REPO_ROOT}/kustomize/tester -kubectl -n test rollout status deployment/flagger-loadtester - -echo '>>> Initialising canary' -kubectl apply -f ${REPO_ROOT}/test/e2e-workload.yaml - -cat <>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n flagger-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n flagger-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n flagger-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' - -kubectl -n flagger-system logs deployment/flagger diff --git a/test/e2e-kubernetes-tests-svc.sh b/test/e2e-kubernetes-tests-svc.sh deleted file mode 100755 index 9cc2eb39..00000000 --- a/test/e2e-kubernetes-tests-svc.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env bash - -# This script runs e2e tests for Blue/Green initialization, analysis and promotion -# Prerequisites: Kubernetes Kind, Kustomize - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Creating test namespace' -kubectl create namespace test - -echo '>>> Installing the load tester' -kubectl apply -k ${REPO_ROOT}/kustomize/tester -kubectl -n test rollout status deployment/flagger-loadtester - -echo '>>> Initialising canary' -kubectl apply -f ${REPO_ROOT}/test/e2e-workload.yaml - -kubectl apply -n test -f - <>> Waiting for primary to be ready' -kubectl -n test rollout status deploy/podinfo - -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n flagger-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -echo '>>> Initializing secondary' -kubectl apply -f ${REPO_ROOT}/test/e2e-workload-v2.yaml - -echo '>>> Waiting for secondary to be ready' -kubectl -n test rollout status deploy/podinfo-v2 - -echo '>>> Triggering canary deployment' -kubectl apply -n test -f - <>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe service/podinfo-primary | grep 'podinfo-v2' && ok=true || ok=false - sleep 10 - kubectl -n flagger-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n flagger-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' - -kubectl -n flagger-system logs deployment/flagger diff --git a/test/e2e-kubernetes.sh b/test/e2e-kubernetes.sh deleted file mode 100755 index 12e72733..00000000 --- a/test/e2e-kubernetes.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Loading Flagger image' -kind load docker-image test/flagger:latest - -echo '>>> Installing Flagger' -kubectl apply -k ${REPO_ROOT}/kustomize/kubernetes - -kubectl -n flagger-system set image deployment/flagger flagger=test/flagger:latest - -kubectl -n flagger-system rollout status deployment/flagger -kubectl -n flagger-system rollout status deployment/flagger-prometheus \ No newline at end of file diff --git a/test/e2e-linkerd-steps-tests.sh b/test/e2e-linkerd-steps-tests.sh deleted file mode 100644 index b8f6c53a..00000000 --- a/test/e2e-linkerd-steps-tests.sh +++ /dev/null @@ -1,218 +0,0 @@ -#!/usr/bin/env bash - -# This script runs Linkerd e2e tests for Canary initialization, analysis and promotion - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Creating test namespace' -kubectl create namespace test -kubectl annotate namespace test linkerd.io/inject=enabled - -echo '>>> Installing the load tester' -kubectl apply -k ${REPO_ROOT}/kustomize/tester -kubectl -n test rollout status deployment/flagger-loadtester - -echo '>>> Initialising canary' -kubectl apply -f ${REPO_ROOT}/test/e2e-workload.yaml - -cat <>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n linkerd logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n linkerd logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n linkerd logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '>>> Waiting for canary finalization' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Succeeded' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n linkerd logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' - -cat <>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.2 - -echo '>>> Waiting for canary rollback' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Failed' && ok=true || ok=false - sleep 10 - kubectl -n linkerd logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n linkerd logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary rollback test passed' \ No newline at end of file diff --git a/test/e2e-linkerd-tests.sh b/test/e2e-linkerd-tests.sh deleted file mode 100755 index d8d1d556..00000000 --- a/test/e2e-linkerd-tests.sh +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env bash - -# This script runs Linkerd e2e tests for Canary initialization, analysis and promotion - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Creating test namespace' -kubectl create namespace test -kubectl annotate namespace test linkerd.io/inject=enabled - -echo '>>> Installing the load tester' -kubectl apply -k ${REPO_ROOT}/kustomize/tester -kubectl -n test rollout status deployment/flagger-loadtester - -echo '>>> Initialising canary' -kubectl apply -f ${REPO_ROOT}/test/e2e-workload.yaml - -cat <>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n linkerd logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -passed=$(kubectl -n test get svc/podinfo -o jsonpath='{.spec.selector.app}' 2>&1 | { grep podinfo-primary || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo selector test failed' - exit 1 -fi -passed=$(kubectl -n test get svc/podinfo-service-canary -o jsonpath='{.spec.selector.app}' 2>&1 | { grep podinfo || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo-service selector test failed' - exit 1 -fi - -echo '✔ Canary service custom metadata test passed' - -echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n linkerd logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n linkerd logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '>>> Waiting for canary finalization' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Succeeded' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n linkerd logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' - -cat <>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.2 - -echo '>>> Waiting for canary rollback' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Failed' && ok=true || ok=false - sleep 10 - kubectl -n linkerd logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n linkerd logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary rollback test passed' \ No newline at end of file diff --git a/test/e2e-linkerd.sh b/test/e2e-linkerd.sh deleted file mode 100755 index 8d8b143e..00000000 --- a/test/e2e-linkerd.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -LINKERD_VER="stable-2.8.1" -REPO_ROOT=$(git rev-parse --show-toplevel) - -curl -SsL https://github.com/linkerd/linkerd2/releases/download/${LINKERD_VER}/linkerd2-cli-${LINKERD_VER}-linux > ${REPO_ROOT}/bin/linkerd -chmod +x ${REPO_ROOT}/bin/linkerd - -echo ">>> Installing Linkerd ${LINKERD_VER}" -${REPO_ROOT}/bin/linkerd install | kubectl apply -f - -${REPO_ROOT}/bin/linkerd check - -kubectl -n linkerd rollout status deployment/linkerd-controller -kubectl -n linkerd rollout status deployment/linkerd-proxy-injector - -echo '>>> Load Flagger image in Kind' -kind load docker-image test/flagger:latest - -echo '>>> Installing Flagger' -kubectl apply -k ${REPO_ROOT}/kustomize/linkerd - -kubectl -n linkerd set image deployment/flagger flagger=test/flagger:latest -kubectl -n linkerd rollout status deployment/flagger diff --git a/test/e2e-nginx-cleanup.sh b/test/e2e-nginx-cleanup.sh deleted file mode 100755 index c27e482a..00000000 --- a/test/e2e-nginx-cleanup.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -echo '>>> Deleting NGINX Ingress' -helm delete nginx-ingress -n ingress-nginx - -echo '>>> Deleting Flagger' -helm delete flagger -n ingress-nginx - -echo '>>> Cleanup test namespace' -kubectl delete namespace test --ignore-not-found=true \ No newline at end of file diff --git a/test/e2e-nginx-custom-annotations.sh b/test/e2e-nginx-custom-annotations.sh deleted file mode 100755 index 3193a013..00000000 --- a/test/e2e-nginx-custom-annotations.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) -NGINX_HELM_VERSION=1.34.2 # ingress v0.30.0 - -echo '>>> Installing NGINX Ingress' -helm upgrade -i nginx-ingress stable/nginx-ingress --version=${NGINX_HELM_VERSION} \ ---wait \ ---namespace ingress-nginx \ ---set controller.metrics.enabled=true \ ---set controller.podAnnotations."prometheus\.io/scrape"=true \ ---set controller.podAnnotations."prometheus\.io/port"=10254 \ ---set controller.service.type=NodePort - -kubectl -n ingress-nginx patch deployment/nginx-ingress-controller \ ---type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--annotations-prefix=custom.ingress.kubernetes.io"}]' - -kubectl -n ingress-nginx rollout status deployment/nginx-ingress-controller -kubectl -n ingress-nginx get all - -echo '>>> Loading Flagger image' -kind load docker-image test/flagger:latest - -echo '>>> Installing Flagger' -helm upgrade -i flagger ${REPO_ROOT}/charts/flagger \ ---namespace ingress-nginx \ ---set prometheus.install=true \ ---set ingressAnnotationsPrefix="custom.ingress.kubernetes.io" \ ---set meshProvider=nginx \ ---set crd.create=false - -kubectl -n ingress-nginx set image deployment/flagger flagger=test/flagger:latest - -kubectl -n ingress-nginx rollout status deployment/flagger -kubectl -n ingress-nginx rollout status deployment/flagger-prometheus - diff --git a/test/e2e-nginx-tests.sh b/test/e2e-nginx-tests.sh deleted file mode 100755 index da979601..00000000 --- a/test/e2e-nginx-tests.sh +++ /dev/null @@ -1,313 +0,0 @@ -#!/usr/bin/env bash - -# This script runs e2e tests for Canary initialization, analysis and promotion -# Prerequisites: Kubernetes Kind, Helm and NGINX ingress controller - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Creating test namespace' -kubectl create namespace test - -echo '>>> Installing load tester' -kubectl apply -k ${REPO_ROOT}/kustomize/tester -kubectl -n test rollout status deployment/flagger-loadtester - -echo '>>> Initialising canary' -kubectl apply -f ${REPO_ROOT}/test/e2e-workload.yaml -kubectl apply -f ${REPO_ROOT}/test/e2e-ingress.yaml - -echo '>>> Create metric templates' -cat <>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n ingress-nginx logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -passed=$(kubectl -n test get svc/podinfo -o jsonpath='{.spec.selector.app}' | { grep podinfo-primary || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo selector test failed' - exit 1 -fi -passed=$(kubectl -n test get svc/podinfo-service-canary -o jsonpath='{.spec.selector.app}' | { grep podinfo || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo-service selector test failed' - exit 1 -fi - -echo '✔ Canary service custom metadata test passed' - -echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -failed=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Failed' && failed=true || failed=false - if ${failed}; then - kubectl -n ingress-nginx logs deployment/flagger - echo "Canary failed!" - exit 1 - fi - kubectl -n test describe deployment/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n ingress-nginx logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n ingress-nginx logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '>>> Waiting for canary finalization' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Succeeded' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n ingress-nginx logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' - -cat <>> Triggering A/B testing' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.2 - -echo '>>> Waiting for A/B testing promotion' -retries=6 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.2' && ok=true || ok=false - sleep 30 - kubectl -n ingress-nginx logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n ingress-nginx logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ A/B testing promotion test passed' - -kubectl -n ingress-nginx logs deployment/flagger - -echo '✔ All tests passed' diff --git a/test/e2e-nginx.sh b/test/e2e-nginx.sh deleted file mode 100755 index e6ba35cf..00000000 --- a/test/e2e-nginx.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) -NGINX_HELM_VERSION=1.39.1 # ingress v0.32.0 - -echo '>>> Installing NGINX Ingress' -kubectl create ns ingress-nginx -helm upgrade -i nginx-ingress stable/nginx-ingress --version=${NGINX_HELM_VERSION} \ ---wait \ ---namespace ingress-nginx \ ---set controller.metrics.enabled=true \ ---set controller.podAnnotations."prometheus\.io/scrape"=true \ ---set controller.podAnnotations."prometheus\.io/port"=10254 \ ---set controller.service.type=NodePort - -kubectl -n ingress-nginx rollout status deployment/nginx-ingress-controller -kubectl -n ingress-nginx get all - -echo '>>> Loading Flagger image' -kind load docker-image test/flagger:latest - -echo '>>> Installing Flagger' -helm upgrade -i flagger ${REPO_ROOT}/charts/flagger \ ---set crd.create=false \ ---namespace ingress-nginx \ ---set prometheus.install=true \ ---set meshProvider=nginx - -kubectl -n ingress-nginx set image deployment/flagger flagger=test/flagger:latest - -kubectl -n ingress-nginx rollout status deployment/flagger -kubectl -n ingress-nginx rollout status deployment/flagger-prometheus diff --git a/test/e2e-skipper-canary.yaml b/test/e2e-skipper-canary.yaml deleted file mode 100644 index 7e0965e4..00000000 --- a/test/e2e-skipper-canary.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: flagger.app/v1beta1 -kind: Canary -metadata: - name: podinfo - namespace: test -spec: - provider: skipper - progressDeadlineSeconds: 120 - revertOnDeletion: true - targetRef: - apiVersion: apps/v1 - kind: Deployment - name: podinfo - ingressRef: - apiVersion: networking.k8s.io/v1beta1 - kind: Ingress - name: podinfo-ingress - service: - # service name (defaults to targetRef.name) - name: podinfo-service - # ClusterIP port number - port: 80 - # container port name or number (optional) - targetPort: http - # port name can be http or grpc (default http) - # portName: http - # add all the other container ports - # to the ClusterIP services (default false) - # portDiscovery: false - analysis: - interval: 15s - threshold: 5 - maxWeight: 100 - stepWeight: 10 - metrics: - - name: request-success-rate - interval: 15s - # minimum req success rate (non 5xx responses) - # percentage (0-100) - thresholdRange: - min: 99 - - name: request-duration - interval: 15s - # maximum req duration P99 - # milliseconds - thresholdRange: - max: 500 - webhooks: - - name: gate - type: confirm-rollout - url: http://flagger-loadtester.test/gate/approve - - name: acceptance-test - type: pre-rollout - url: http://flagger-loadtester.test/ - timeout: 10s - metadata: - type: bash - cmd: "curl -sd 'test' http://podinfo-service-canary/token | grep token" - - name: "load test" - type: rollout - url: http://flagger-loadtester.test/ - timeout: 5s - metadata: - type: cmd - cmd: "hey -z 10m -q 10 -c 2 -host app.example.com http://skipper-ingress.kube-system" - logCmdOutput: "true" diff --git a/test/e2e-skipper-cleanup.sh b/test/e2e-skipper-cleanup.sh deleted file mode 100755 index b789007e..00000000 --- a/test/e2e-skipper-cleanup.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Deleting Skipper Ingress' -kustomize build ${REPO_ROOT}/test/skipper | kubectl delete --force --wait=false -f - - -echo '>>> Deleting Flagger' -kubectl delete namespace flagger-system --ignore-not-found=true --force --wait=false - -echo '>>> Cleanup test namespace' -kubectl delete namespace test --ignore-not-found=true --force --wait=false - -exit 0 diff --git a/test/e2e-skipper-tests.sh b/test/e2e-skipper-tests.sh deleted file mode 100755 index 2af94271..00000000 --- a/test/e2e-skipper-tests.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env bash - -# This script runs e2e tests for Canary initialization, analysis and promotion -# Prerequisites: Kubernetes Kind and Skipper ingress controller - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Creating test namespace' -kubectl create namespace test || true - -echo '>>> Initialising workload' -kubectl apply -f ${REPO_ROOT}/test/e2e-workload.yaml -kubectl apply -f ${REPO_ROOT}/test/e2e-workload-ingress.yaml - -echo '>>> Installing load tester' -kubectl apply -k ${REPO_ROOT}/kustomize/tester -kubectl -n test rollout status deployment/flagger-loadtester - -echo '>>> Create canary CRD' -kubectl apply -f ${REPO_ROOT}/test/e2e-skipper-canary.yaml -echo '>>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n flagger-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=50 -count=0 -ok=false -failed=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Failed' && failed=true || failed=false - if ${failed}; then - kubectl -n flagger-system logs deployment/flagger - echo "Canary failed!" - exit 1 - fi - kubectl -n test describe deployment/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n flagger-system logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n flagger-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '>>> Waiting for canary finalization' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Succeeded' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n flagger-system logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' diff --git a/test/e2e-skipper.sh b/test/e2e-skipper.sh deleted file mode 100755 index f5dbe2a2..00000000 --- a/test/e2e-skipper.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Loading Flagger image' -kind load docker-image test/flagger:latest - -echo '>>> Installing Skipper Ingress, Flagger and Prometheus' -# use kustomize to avoid compatibility issues: -# https://github.com/kubernetes-sigs/kustomize/issues/2390 -# Skipper will throw an Prometheus warning which can be ignored: -# https://github.com/weaveworks/flagger/issues/664 -kustomize build ${REPO_ROOT}/test/skipper | kubectl apply -f - - -kubectl rollout status deployment/skipper-ingress -n kube-system -kubectl rollout status deployment/flagger-prometheus -n flagger-system - -kubectl -n flagger-system set image deployment/flagger flagger=test/flagger:latest - -kubectl -n flagger-system rollout status deployment/flagger diff --git a/test/e2e-traefik-tests.sh b/test/e2e-traefik-tests.sh deleted file mode 100755 index f927aca7..00000000 --- a/test/e2e-traefik-tests.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env bash - -# This script runs e2e tests for Canary initialization, analysis and promotion -# Prerequisites: Kubernetes Kind, Helm and Traefik ingress controller - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) - -echo '>>> Creating test namespace' -kubectl create namespace test - -echo '>>> Installing load tester' -kubectl apply -k ${REPO_ROOT}/kustomize/tester -kubectl -n test rollout status deployment/flagger-loadtester - -echo '>>> Initialising canary' -kubectl apply -f ${REPO_ROOT}/test/e2e-workload.yaml - -cat <>> Waiting for primary to be ready' -retries=50 -count=0 -ok=false -until ${ok}; do - kubectl -n test get canary/podinfo | grep 'Initialized' && ok=true || ok=false - sleep 5 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n traefik logs deployment/flagger - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary initialization test passed' - -passed=$(kubectl -n test get svc/podinfo -o jsonpath='{.spec.selector.app}' 2>&1 | { grep podinfo-primary || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 podinfo selector test failed' - exit 1 -fi -passed=$(kubectl -n test get traefikservice/podinfo -o jsonpath='{.metadata.labels}' 2>&1 | { grep test-label || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 TraefikService does not have required labels' - exit 1 -fi -passed=$(kubectl -n test get traefikservice/podinfo -o jsonpath='{.metadata.annotations}' 2>&1 | { grep test-annotation || true; }) -if [ -z "$passed" ]; then - echo -e '\u2716 TraefikService does not have required annotations' - exit 1 -fi - -echo '✔ Canary service custom metadata test passed' - -echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=stefanprodan/podinfo:3.1.1 - -echo '>>> Waiting for canary promotion' -retries=60 -count=0 -ok=false -until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '3.1.1' && ok=true || ok=false - sleep 10 - kubectl -n traefik logs deployment/flagger --tail 1 - count=$(($count + 1)) - if [[ ${count} -eq ${retries} ]]; then - kubectl -n test describe deployment/podinfo - kubectl -n test describe deployment/podinfo-primary - kubectl -n test logs deployment/flagger-loadtester - kubectl -n traefik logs deployment/flagger - kubectl -n traefik get all - echo "No more retries left" - exit 1 - fi -done - -echo '✔ Canary promotion test passed' diff --git a/test/e2e-traefik.sh b/test/e2e-traefik.sh deleted file mode 100755 index 5405465c..00000000 --- a/test/e2e-traefik.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit - -REPO_ROOT=$(git rev-parse --show-toplevel) -TRAEFIK_CHART_VERSION="9.11.0" # traefik 2.3.3 - -echo '>>> Creating traefik namespace' -kubectl create ns traefik - -echo '>>> Installing Traefik' -helm repo add traefik https://helm.traefik.io/traefik -cat <>> Loading Flagger image' -kind load docker-image test/flagger:latest - -echo '>>> Installing Flagger' -helm upgrade -i flagger ${REPO_ROOT}/charts/flagger \ ---set crd.create=false \ ---namespace traefik \ ---set prometheus.install=true \ ---set meshProvider=traefik \ ---set image.repository=test\/flagger \ ---set image.tag=latest \ - -kubectl -n traefik rollout status deployment/flagger diff --git a/test/e2e-workload-ingress.yaml b/test/e2e-workload-ingress.yaml deleted file mode 100644 index b7a2c619..00000000 --- a/test/e2e-workload-ingress.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: networking.k8s.io/v1beta1 -kind: Ingress -metadata: - name: podinfo-ingress - namespace: test - labels: - app: podinfo - annotations: - kubernetes.io/ingress.class: skipper -spec: - rules: - - host: app.example.com - http: - paths: - - backend: - serviceName: podinfo-service - servicePort: 80 diff --git a/test/e2e-workload-v2.yaml b/test/e2e-workload-v2.yaml deleted file mode 100644 index eebdc5d3..00000000 --- a/test/e2e-workload-v2.yaml +++ /dev/null @@ -1,68 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: podinfo-v2 - namespace: test - labels: - app: podinfo-v2 -spec: - minReadySeconds: 5 - revisionHistoryLimit: 5 - progressDeadlineSeconds: 60 - strategy: - rollingUpdate: - maxUnavailable: 0 - type: RollingUpdate - selector: - matchLabels: - app: podinfo-v2 - template: - metadata: - annotations: - prometheus.io/scrape: "true" - prometheus.io/port: "9797" - labels: - app: podinfo-v2 - spec: - containers: - - name: podinfod - image: stefanprodan/podinfo:3.1.1 - imagePullPolicy: IfNotPresent - ports: - - name: http - containerPort: 9898 - protocol: TCP - - name: http-metrics - containerPort: 9797 - protocol: TCP - - name: grpc - containerPort: 9999 - protocol: TCP - command: - - ./podinfo - - --port=9898 - - --port-metrics=9797 - - --grpc-port=9999 - - --grpc-service-name=podinfo - - --level=info - - --random-delay=false - - --random-error=false - livenessProbe: - httpGet: - port: 9898 - path: /healthz - initialDelaySeconds: 5 - timeoutSeconds: 5 - readinessProbe: - httpGet: - port: 9898 - path: /readyz - initialDelaySeconds: 5 - timeoutSeconds: 5 - resources: - limits: - cpu: 1000m - memory: 128Mi - requests: - cpu: 1m - memory: 16Mi diff --git a/test/e2e-workload.yaml b/test/e2e-workload.yaml deleted file mode 100644 index 8f0660c0..00000000 --- a/test/e2e-workload.yaml +++ /dev/null @@ -1,137 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: podinfo - namespace: test - labels: - app: podinfo -spec: - minReadySeconds: 5 - revisionHistoryLimit: 5 - progressDeadlineSeconds: 60 - strategy: - rollingUpdate: - maxUnavailable: 0 - type: RollingUpdate - selector: - matchLabels: - app: podinfo - template: - metadata: - annotations: - prometheus.io/scrape: "true" - prometheus.io/port: "9797" - labels: - app: podinfo - spec: - containers: - - name: podinfod - image: stefanprodan/podinfo:3.1.0 - imagePullPolicy: IfNotPresent - ports: - - name: http - containerPort: 9898 - protocol: TCP - - name: http-metrics - containerPort: 9797 - protocol: TCP - - name: grpc - containerPort: 9999 - protocol: TCP - command: - - ./podinfo - - --port=9898 - - --port-metrics=9797 - - --grpc-port=9999 - - --grpc-service-name=podinfo - - --level=info - - --random-delay=false - - --random-error=false - livenessProbe: - httpGet: - port: 9898 - path: /healthz - initialDelaySeconds: 5 - timeoutSeconds: 5 - readinessProbe: - httpGet: - port: 9898 - path: /readyz - initialDelaySeconds: 5 - timeoutSeconds: 5 - resources: - limits: - cpu: 1000m - memory: 128Mi - requests: - cpu: 1m - memory: 16Mi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: podinfo-service - namespace: test - labels: - app: podinfo -spec: - minReadySeconds: 5 - revisionHistoryLimit: 5 - progressDeadlineSeconds: 60 - strategy: - rollingUpdate: - maxUnavailable: 0 - type: RollingUpdate - selector: - matchLabels: - app: podinfo - template: - metadata: - annotations: - prometheus.io/scrape: "true" - prometheus.io/port: "9797" - labels: - app: podinfo - spec: - containers: - - name: podinfod - image: stefanprodan/podinfo:3.1.0 - imagePullPolicy: IfNotPresent - ports: - - name: http - containerPort: 9898 - protocol: TCP - - name: http-metrics - containerPort: 9797 - protocol: TCP - - name: grpc - containerPort: 9999 - protocol: TCP - command: - - ./podinfo - - --port=9898 - - --port-metrics=9797 - - --grpc-port=9999 - - --grpc-service-name=podinfo - - --level=info - - --random-delay=false - - --random-error=false - livenessProbe: - httpGet: - port: 9898 - path: /healthz - initialDelaySeconds: 5 - timeoutSeconds: 5 - readinessProbe: - httpGet: - port: 9898 - path: /readyz - initialDelaySeconds: 5 - timeoutSeconds: 5 - resources: - limits: - cpu: 1000m - memory: 128Mi - requests: - cpu: 1m - memory: 16Mi \ No newline at end of file diff --git a/test/goreleaser.sh b/test/goreleaser.sh deleted file mode 100755 index c41289ef..00000000 --- a/test/goreleaser.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -set -e - -TAR_FILE="/tmp/goreleaser.tar.gz" -RELEASES_URL="https://github.com/goreleaser/goreleaser/releases" -test -z "$TMPDIR" && TMPDIR="$(mktemp -d)" - -last_version() { - curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" | - rev | - cut -f1 -d'/'| - rev -} - -download() { - test -z "$VERSION" && VERSION="$(last_version)" - test -z "$VERSION" && { - echo "Unable to get goreleaser version." >&2 - exit 1 - } - rm -f "$TAR_FILE" - curl -s -L -o "$TAR_FILE" \ - "$RELEASES_URL/download/$VERSION/goreleaser_$(uname -s)_$(uname -m).tar.gz" -} - -download -tar -xf "$TAR_FILE" -C "$TMPDIR" -"${TMPDIR}/goreleaser" --release-notes=/tmp/release.txt diff --git a/test/local/e2e-skipper.sh b/test/local/e2e-skipper.sh deleted file mode 100755 index 0e98d6d0..00000000 --- a/test/local/e2e-skipper.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -# This script is intended for local workstation development convenience. -# It will run the e2e tests for Skipper and leave a working setup to play with - -REPO_ROOT=$(git rev-parse --show-toplevel) -cd $REPO_ROOT - -make test -make build -docker tag weaveworks/flagger:latest test/flagger:latest -make loadtester-build -(kind get clusters && kubectl delete ns/test --force) || kind create cluster --wait 5m --image kindest/node:v1.16.9 -./test/e2e-skipper.sh -# port forward prometheus UI to localhost:9090 -kubectl port-forward $(kubectl get pods -l=app=flagger-prometheus -o name -n flagger-system | head -n 1) 9090:9090 -n flagger-system & - -./test/e2e-skipper-tests.sh