From c8cec8e18bac41150441db258e7752fd2aaf6174 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Tue, 22 Dec 2020 12:41:30 +0200 Subject: [PATCH 1/3] Enable running tests on demand Signed-off-by: Stefan Prodan --- .github/workflows/build.yaml | 4 +++- .github/workflows/e2e.yaml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8eed60359..3cfe090d3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,11 +1,13 @@ name: build on: + workflow_dispatch: pull_request: + branches: + - main push: branches: - main - - github-actions jobs: container: diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 520096002..a50e7b16c 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -1,11 +1,13 @@ name: e2e on: + workflow_dispatch: pull_request: + branches: + - main push: branches: - main - - github-actions jobs: kind: From 6349dbf5c05f54d072a526fc6c033facc6a08f3c Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Tue, 22 Dec 2020 12:45:03 +0200 Subject: [PATCH 2/3] Include app.kubernetes.io labels by default Signed-off-by: Stefan Prodan --- kustomize/appmesh/patch.yaml | 4 +--- kustomize/contour/patch.yaml | 4 +--- kustomize/istio/patch.yaml | 5 +---- kustomize/kubernetes/patch.yaml | 4 +--- kustomize/linkerd/patch.yaml | 4 +--- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/kustomize/appmesh/patch.yaml b/kustomize/appmesh/patch.yaml index 408379d16..38315632e 100644 --- a/kustomize/appmesh/patch.yaml +++ b/kustomize/appmesh/patch.yaml @@ -9,11 +9,9 @@ spec: - name: flagger args: - -log-level=info + - -include-label-prefix=app.kubernetes.io - -mesh-provider=appmesh - -metrics-server=http://appmesh-prometheus:9090 - - -slack-user=flagger - - -slack-channel= - - -slack-url= --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding diff --git a/kustomize/contour/patch.yaml b/kustomize/contour/patch.yaml index 540e7defa..99570ae5d 100644 --- a/kustomize/contour/patch.yaml +++ b/kustomize/contour/patch.yaml @@ -9,9 +9,7 @@ spec: - name: flagger args: - -log-level=info + - -include-label-prefix=app.kubernetes.io - -mesh-provider=contour - -ingress-class=contour - -metrics-server=http://flagger-prometheus:9090 - - -slack-user=flagger - - -slack-channel= - - -slack-url= diff --git a/kustomize/istio/patch.yaml b/kustomize/istio/patch.yaml index 8180d2d89..a9e3d9843 100644 --- a/kustomize/istio/patch.yaml +++ b/kustomize/istio/patch.yaml @@ -9,12 +9,9 @@ spec: - name: flagger args: - -log-level=info + - -include-label-prefix=app.kubernetes.io - -mesh-provider=istio - -metrics-server=http://prometheus:9090 - - -slack-user=flagger - - -slack-channel= - - -slack-url= ---- --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding diff --git a/kustomize/kubernetes/patch.yaml b/kustomize/kubernetes/patch.yaml index 3bec1e645..85afd87b7 100644 --- a/kustomize/kubernetes/patch.yaml +++ b/kustomize/kubernetes/patch.yaml @@ -9,8 +9,6 @@ spec: - name: flagger args: - -log-level=info + - -include-label-prefix=app.kubernetes.io - -mesh-provider=kubernetes - -metrics-server=http://flagger-prometheus:9090 - - -slack-user=flagger - - -slack-channel= - - -slack-url= diff --git a/kustomize/linkerd/patch.yaml b/kustomize/linkerd/patch.yaml index e20531383..25fcade60 100644 --- a/kustomize/linkerd/patch.yaml +++ b/kustomize/linkerd/patch.yaml @@ -9,11 +9,9 @@ spec: - name: flagger args: - -log-level=info + - -include-label-prefix=app.kubernetes.io - -mesh-provider=linkerd - -metrics-server=http://linkerd-prometheus:9090 - - -slack-user=flagger - - -slack-channel= - - -slack-url= --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding From 0fa465403442e38c14e8e227068df5bd29649254 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Tue, 22 Dec 2020 12:46:03 +0200 Subject: [PATCH 3/3] Add label prefix e2e test Signed-off-by: Stefan Prodan --- test/kubernetes/install.sh | 2 +- test/kubernetes/test-deployment.sh | 11 +++++++++++ test/workloads/deployment.yaml | 5 ++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/test/kubernetes/install.sh b/test/kubernetes/install.sh index 018622716..dd41d9b7e 100755 --- a/test/kubernetes/install.sh +++ b/test/kubernetes/install.sh @@ -12,4 +12,4 @@ 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 +kubectl -n flagger-system rollout status deployment/flagger-prometheus diff --git a/test/kubernetes/test-deployment.sh b/test/kubernetes/test-deployment.sh index 42cb7a2d5..836e44e7d 100755 --- a/test/kubernetes/test-deployment.sh +++ b/test/kubernetes/test-deployment.sh @@ -72,6 +72,17 @@ until ${ok}; do fi done +passed=$(kubectl -n test get deploy/podinfo-primary -oyaml 2>&1 | { grep test-label-prefix || true; }) +if [ -z "$passed" ]; then + echo -e '\u2716 primary copy labels by prefix test failed' + exit 1 +fi +passed=$(kubectl -n test get deploy/podinfo-primary -oyaml 2>&1 | { grep test-annotation-prefix || true; }) +if [ -z "$passed" ]; then + echo -e '\u2716 primary copy annotations by prefix test failed' + exit 1 +fi + echo '✔ Canary initialization test passed' echo '>>> Triggering canary deployment' diff --git a/test/workloads/deployment.yaml b/test/workloads/deployment.yaml index 175803d9b..390baa329 100644 --- a/test/workloads/deployment.yaml +++ b/test/workloads/deployment.yaml @@ -4,7 +4,10 @@ metadata: name: podinfo namespace: test labels: - app: podinfo + app.kubernetes.io/name: podinfo + app.kubernetes.io/managed-by: test-label-prefix + annotations: + app.kubernetes.io/instance: test-annotation-prefix spec: minReadySeconds: 5 revisionHistoryLimit: 5