Skip to content

Commit 22a885f

Browse files
committed
Add canary release test to e2e
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 4fd9a4a commit 22a885f

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

.github/workflows/e2e.yaml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,38 @@ jobs:
3131
--path=./clusters/my-cluster
3232
- name: Verify cluster reconciliation
3333
run: |
34-
kubectl -n flux-system wait kustomization/istio-operator --for=condition=ready --timeout=1m
35-
kubectl -n flux-system wait kustomization/istio-system --for=condition=ready --timeout=1m
36-
kubectl -n flux-system wait kustomization/apps --for=condition=ready --timeout=1m
37-
kubectl -n prod wait canary/frontend --for=condition=promoted
38-
kubectl -n prod wait canary/backend --for=condition=promoted
39-
- name: List canaries
34+
kubectl -n flux-system wait kustomization/istio-operator --for=condition=ready --timeout=2m
35+
kubectl -n flux-system wait kustomization/istio-system --for=condition=ready --timeout=2m
36+
kubectl -n flux-system wait kustomization/apps --for=condition=ready --timeout=2m
37+
kubectl -n prod wait canary/frontend --for=condition=promoted --timeout=1m
38+
kubectl -n prod rollout status deployment/frontend --timeout=1m
39+
kubectl -n prod wait canary/backend --for=condition=promoted --timeout=1m
40+
kubectl -n prod rollout status deployment/backend --timeout=1m
41+
- name: Test canary release
4042
run: |
41-
kubectl -n prod get canaries
43+
kubectl -n prod set image deployment/backend backend=stefanprodan/podinfo:5.0.1
44+
echo '>>> Waiting for canary finalization'
45+
retries=25
46+
count=0
47+
ok=false
48+
until ${ok}; do
49+
kubectl -n prod get canary/backend | grep 'Succeeded' && ok=true || ok=false
50+
sleep 20
51+
kubectl -n istio-system logs deployment/flagger --tail 1
52+
count=$(($count + 1))
53+
if [[ ${count} -eq ${retries} ]]; then
54+
echo "No more retries left"
55+
exit 1
56+
fi
57+
done
4258
- name: Debug failure
4359
if: failure()
4460
run: |
4561
kubectl -n flux-system get all
4662
kubectl -n flux-system logs deploy/source-controller
4763
kubectl -n flux-system logs deploy/kustomize-controller
4864
kubectl -n flux-system logs deploy/helm-controller
65+
kubectl -n istio-system logs deployment/flagger
4966
kubectl -n istio-operator get all
5067
kubectl -n istio-system get all
5168
kubectl -n prod get all

apps/backend/canary.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ spec:
1111
name: backend
1212
# the maximum time in seconds for the canary deployment
1313
# to make progress before it is rollback (default 600s)
14-
progressDeadlineSeconds: 60
14+
progressDeadlineSeconds: 120
1515
# HPA reference (optional)
1616
autoscalerRef:
1717
apiVersion: autoscaling/v2beta1

apps/backend/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ spec:
6262
cpu: 2000m
6363
memory: 512Mi
6464
requests:
65-
cpu: 100m
66-
memory: 64Mi
65+
cpu: 10m
66+
memory: 16Mi

0 commit comments

Comments
 (0)