From f63d35bdb47175b4c37fdef05384f6f75024d8d1 Mon Sep 17 00:00:00 2001 From: Marcin Jasion <5058132+mjasion@users.noreply.github.com> Date: Mon, 24 Jul 2023 12:40:24 +0200 Subject: [PATCH] feat(hooks): Add ArgoCD hooks similar to Helm (#135) Based on [ArgoCD Hooks](https://argo-cd.readthedocs.io/en/stable/user-guide/helm/#helm-hooks) docs. Co-authored-by: Marcin Jasion --- charts/studio/Chart.yaml | 2 +- charts/studio/README.md | 2 +- charts/studio/templates/ingress-blobvault.yaml | 2 ++ charts/studio/templates/ingress-studio-api.yaml | 2 ++ charts/studio/templates/ingress-studio-ui.yaml | 2 ++ charts/studio/templates/ingress-studio-webhook.yaml | 2 ++ charts/studio/templates/secret-studio.yaml | 3 ++- charts/studio/templates/tests/test-connection.yaml | 2 +- 8 files changed, 13 insertions(+), 4 deletions(-) diff --git a/charts/studio/Chart.yaml b/charts/studio/Chart.yaml index 3c1f0c44..1b732165 100644 --- a/charts/studio/Chart.yaml +++ b/charts/studio/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.14 +version: 0.2.15 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/studio/README.md b/charts/studio/README.md index f69ca5ab..8dece6d1 100644 --- a/charts/studio/README.md +++ b/charts/studio/README.md @@ -1,6 +1,6 @@ # studio -![Version: 0.2.14](https://img.shields.io/badge/Version-0.2.14-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.9.1](https://img.shields.io/badge/AppVersion-v2.9.1-informational?style=flat-square) +![Version: 0.2.15](https://img.shields.io/badge/Version-0.2.15-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.9.1](https://img.shields.io/badge/AppVersion-v2.9.1-informational?style=flat-square) A Helm chart for Kubernetes diff --git a/charts/studio/templates/ingress-blobvault.yaml b/charts/studio/templates/ingress-blobvault.yaml index c0d65a32..8f8d49e7 100644 --- a/charts/studio/templates/ingress-blobvault.yaml +++ b/charts/studio/templates/ingress-blobvault.yaml @@ -16,6 +16,8 @@ metadata: name: blobvault annotations: helm.sh/hook: post-install,post-upgrade + helm.sh/hook-weight: "-1" + argocd.argoproj.io/hook: PostSync nginx.ingress.kubernetes.io/rewrite-target: /$2 {{- with .Values.global.ingress.annotations }} {{- toYaml . | nindent 4 }} diff --git a/charts/studio/templates/ingress-studio-api.yaml b/charts/studio/templates/ingress-studio-api.yaml index 8a7a7ba2..61993888 100644 --- a/charts/studio/templates/ingress-studio-api.yaml +++ b/charts/studio/templates/ingress-studio-api.yaml @@ -18,6 +18,8 @@ metadata: {{- include "studio-ui.labels" . | nindent 4 }} annotations: helm.sh/hook: post-install,post-upgrade + helm.sh/hook-weight: "-1" + argocd.argoproj.io/hook: PostSync {{- if and .Values.global.basePath (not (eq .Values.global.basePath "/")) }} nginx.ingress.kubernetes.io/rewrite-target: /$1 {{- end }} diff --git a/charts/studio/templates/ingress-studio-ui.yaml b/charts/studio/templates/ingress-studio-ui.yaml index 837bdfbd..5b80dcf7 100644 --- a/charts/studio/templates/ingress-studio-ui.yaml +++ b/charts/studio/templates/ingress-studio-ui.yaml @@ -18,6 +18,8 @@ metadata: {{- include "studio-ui.labels" . | nindent 4 }} annotations: helm.sh/hook: post-install,post-upgrade + helm.sh/hook-weight: "-1" + argocd.argoproj.io/hook: PostSync {{- with .Values.global.ingress.annotations }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/studio/templates/ingress-studio-webhook.yaml b/charts/studio/templates/ingress-studio-webhook.yaml index a920cf38..9c9dee91 100644 --- a/charts/studio/templates/ingress-studio-webhook.yaml +++ b/charts/studio/templates/ingress-studio-webhook.yaml @@ -18,6 +18,8 @@ metadata: {{- include "studio-ui.labels" . | nindent 4 }} annotations: helm.sh/hook: post-install,post-upgrade + helm.sh/hook-weight: "-1" + argocd.argoproj.io/hook: PostSync {{- if and .Values.global.basePath (not (eq .Values.global.basePath "/")) }} nginx.ingress.kubernetes.io/rewrite-target: /$1 {{- end }} diff --git a/charts/studio/templates/secret-studio.yaml b/charts/studio/templates/secret-studio.yaml index 7de3b752..2475081a 100644 --- a/charts/studio/templates/secret-studio.yaml +++ b/charts/studio/templates/secret-studio.yaml @@ -4,7 +4,8 @@ metadata: name: studio {{ if (not (hasKey .Values "ci")) }} # Add annotation if we're not in CI execution. annotations: - "helm.sh/resource-policy": "keep" + helm.sh/resource-policy: "keep" + argocd.argoproj.io/sync-options: Delete=false {{- end }} labels: {{- include "studio.labels" . | nindent 4 }} diff --git a/charts/studio/templates/tests/test-connection.yaml b/charts/studio/templates/tests/test-connection.yaml index 10e04209..50149374 100644 --- a/charts/studio/templates/tests/test-connection.yaml +++ b/charts/studio/templates/tests/test-connection.yaml @@ -5,7 +5,7 @@ metadata: labels: {{- include "studio.labels" . | nindent 4 }} annotations: - "helm.sh/hook": test + helm.sh/hook: test spec: containers: - name: wget