From 665f8a87c063c23021f29e3157fcd739cc468041 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sat, 25 Feb 2023 21:05:01 +0100 Subject: [PATCH] Fix tempalte --- .../argocd-dynamic-environment-per-branch-part-1/index.md | 7 ++++++- kube/applicationset.yaml | 3 --- kube/template.yaml | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/content/posts/argocd-dynamic-environment-per-branch-part-1/index.md b/content/posts/argocd-dynamic-environment-per-branch-part-1/index.md index 8d929d4..fadb280 100644 --- a/content/posts/argocd-dynamic-environment-per-branch-part-1/index.md +++ b/content/posts/argocd-dynamic-environment-per-branch-part-1/index.md @@ -373,4 +373,9 @@ And now let's create a job like that: from_secret: ARGOCD_AUTH_TOKEN commands: - argocd app sync -l app=badhouseplants -l branch=$DRONE_BRANCH -``` \ No newline at end of file + - argocd app wait -l app=badhouseplants -l branch=$DRONE_BRANCH +``` + +And the last step would be to remove an application when branch is removed. + +> Also, I've found out that `ArgoCD` won't remove a namespace if it was created by a `SyncPolicy`, so I've added it to the helm chart, and add a new `value` to provide a name. \ No newline at end of file diff --git a/kube/applicationset.yaml b/kube/applicationset.yaml index e5d771c..d8fac99 100644 --- a/kube/applicationset.yaml +++ b/kube/applicationset.yaml @@ -27,6 +27,3 @@ spec: destination: server: "https://kubernetes.default.svc" namespace: "{{ app }}-{{ name }}" - syncPolicy: - syncOptions: - - CreateNamespace=true diff --git a/kube/template.yaml b/kube/template.yaml index 0b346f5..5a06c79 100644 --- a/kube/template.yaml +++ b/kube/template.yaml @@ -3,7 +3,8 @@ branch: $ARGO_APP_BRANCH chart_version: $ARGO_APP_CHART_VERSION value: | - namespace: badhouseplants-$ARGO_APP_BRANCH + namespace: + name: badhouseplants-$ARGO_APP_BRANCH istio: hosts: - $ARGO_APP_HOSTNAME