-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (87 loc) · 3.01 KB
/
Copy pathflagger_e2e.yaml
File metadata and controls
92 lines (87 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# verify with local kind k8s cluster.
name: Flagger E2E Test
on:
workflow_dispatch:
pull_request:
branches: [main]
paths:
- "flagger/**"
- ".github/workflows/flagger*"
jobs:
kubernetes:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
cluster: [prod]
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Flux
uses: fluxcd/flux2/action@main
- name: Setup Kubernetes
uses: engineerd/setup-kind@v0.5.0
with:
# renovate: datasource=go depName=sigs.k8s.io/kind
version: v0.11.1
- name: Install Flux in Kubernetes Kind
run: |
flux check --pre
flux install
- name: Setup cluster reconciliation
run: |
kubectl apply -f - <<EOF > cat
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: GitRepository
metadata:
name: flux-system
namespace: flux-system
spec:
interval: 15m
ref:
branch: ${GITHUB_HEAD_REF}
url: ${{ github.event.repository.html_url }}
ignore: /flagger/clusters/${{ matrix.cluster }}/flux-system/
EOF
flux create kustomization flux-system \
--source=flux-system \
--path=./flagger/clusters/${{ matrix.cluster }}
- name: Verify cluster reconciliations
timeout-minutes: 5
run: |
while flux get all --all-namespaces --status-selector=ready=false | grep False
do
sleep 5
done
kubectl -n apps wait canary/frontend --for=condition=promoted --timeout=1m
kubectl -n apps rollout status deployment/frontend --timeout=1m
kubectl -n apps wait canary/backend --for=condition=promoted --timeout=1m
kubectl -n apps rollout status deployment/backend --timeout=1m
- name: Test canary release
run: |
kubectl -n apps set image deployment/backend backend=stefanprodan/podinfo:5.0.1
echo '>>> Waiting for canary finalization'
retries=25
count=0
ok=false
until ${ok}; do
kubectl -n apps get canary/backend | grep 'Succeeded' && ok=true || ok=false
sleep 20
kubectl -n istio-system logs deployment/flagger --tail 1
count=$(($count + 1))
if [[ ${count} -eq ${retries} ]]; then
echo "No more retries left"
exit 1
fi
done
- name: Debug failure
if: failure()
run: |
kubectl -n flux-system get all
kubectl -n flux-system logs deploy/source-controller
kubectl -n flux-system logs deploy/kustomize-controller
kubectl -n flux-system logs deploy/helm-controller
kubectl -n istio-system logs deployment/flagger
kubectl -n istio-operator get all
kubectl -n istio-system get all
flux get all --all-namespaces