diff --git a/kustomize/apisix/kustomization.yaml b/kustomize/apisix/kustomization.yaml new file mode 100644 index 00000000..3c19a34a --- /dev/null +++ b/kustomize/apisix/kustomization.yaml @@ -0,0 +1,7 @@ +bases: + - ../base/flagger/ + - ../base/prometheus/ +resources: + - namespace.yaml +patchesStrategicMerge: + - patch.yaml diff --git a/kustomize/apisix/namespace.yaml b/kustomize/apisix/namespace.yaml new file mode 100644 index 00000000..1f7400c3 --- /dev/null +++ b/kustomize/apisix/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: flagger-system diff --git a/kustomize/apisix/patch.yaml b/kustomize/apisix/patch.yaml new file mode 100644 index 00000000..8c481229 --- /dev/null +++ b/kustomize/apisix/patch.yaml @@ -0,0 +1,14 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: flagger +spec: + template: + spec: + containers: + - name: flagger + args: + - -log-level=info + - -include-label-prefix=app.kubernetes.io + - -mesh-provider=apisix + - -metrics-server=http://flagger-prometheus:9090 diff --git a/kustomize/base/flagger/rbac.yaml b/kustomize/base/flagger/rbac.yaml index 3da112ce..69ea8445 100644 --- a/kustomize/base/flagger/rbac.yaml +++ b/kustomize/base/flagger/rbac.yaml @@ -229,6 +229,18 @@ rules: - update - patch - delete + - apiGroups: + - apisix.apache.org + resources: + - apisixroutes + verbs: + - get + - list + - watch + - create + - update + - patch + - delete - nonResourceURLs: - /version verbs: diff --git a/test/apisix/test-canary.sh b/test/apisix/test-canary.sh index fc6d7115..f51e9332 100755 --- a/test/apisix/test-canary.sh +++ b/test/apisix/test-canary.sh @@ -143,4 +143,19 @@ until ${ok}; do 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 apisix logs deployment/flagger + echo "No more retries left" + exit 1 + fi +done + echo '✔ Canary promotion test passed'