From f20ad5d25f3df5b85a52e451ff0af7b3bc146c61 Mon Sep 17 00:00:00 2001 From: Nacho Barrientos Date: Mon, 7 Oct 2024 10:20:24 +0200 Subject: [PATCH] feat(argo-cd): Expose cluster's project as a label Given that Argo CD's ApplicationSet cluster generator allows selecting clusters using arbitrary labels, it'd be useful for operators to have the clusters' project available as label to for instance easily deploy a single application to all the clusters of a given project. More info: https://github.com/argoproj/argo-helm/discussions/2949 Signed-off-by: Nacho Barrientos --- charts/argo-cd/Chart.yaml | 4 ++-- charts/argo-cd/templates/argocd-configs/cluster-secrets.yaml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/charts/argo-cd/Chart.yaml b/charts/argo-cd/Chart.yaml index 4a70abc4..e785fe9b 100644 --- a/charts/argo-cd/Chart.yaml +++ b/charts/argo-cd/Chart.yaml @@ -3,7 +3,7 @@ appVersion: v2.12.4 kubeVersion: ">=1.25.0-0" description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes. name: argo-cd -version: 7.6.8 +version: 7.6.9 home: https://github.com/argoproj/argo-helm icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png sources: @@ -27,4 +27,4 @@ annotations: url: https://argoproj.github.io/argo-helm/pgp_keys.asc artifacthub.io/changes: | - kind: added - description: Set affinity in redis secret-init job. + description: Add the cluster project as a label. diff --git a/charts/argo-cd/templates/argocd-configs/cluster-secrets.yaml b/charts/argo-cd/templates/argocd-configs/cluster-secrets.yaml index 0b4b1e11..37656c62 100644 --- a/charts/argo-cd/templates/argocd-configs/cluster-secrets.yaml +++ b/charts/argo-cd/templates/argocd-configs/cluster-secrets.yaml @@ -11,6 +11,9 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} argocd.argoproj.io/secret-type: cluster + {{- if $cluster_value.project }} + argocd.argoproj.io/project: {{ $cluster_value.project | quote }} + {{- end }} {{- with $cluster_value.annotations }} annotations: {{- range $key, $value := . }}