Skip to content

Commit

Permalink
feat(argo-cd): represent cluster credentials as a map
Browse files Browse the repository at this point in the history
So it can be merged with values coming from different sources.

Closes #2592

Signed-off-by: Nacho Barrientos <nacho.barrientos@cern.ch>
  • Loading branch information
nbarrientos committed Apr 29, 2024
1 parent 1119c0d commit 7101b95
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions charts/argo-cd/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: v2.10.8
kubeVersion: ">=1.23.0-0"
description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd
version: 6.7.17
version: 7.0.0
home: https://github.com/argoproj/argo-helm
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
sources:
Expand All @@ -26,5 +26,5 @@ annotations:
fingerprint: 2B8F22F57260EFA67BE1C5824B11F800CD9D2252
url: https://argoproj.github.io/argo-helm/pgp_keys.asc
artifacthub.io/changes: |
- kind: added
description: JQ Path expression timeout
- kind: changed
description: Represent cluster credentials as a map
22 changes: 11 additions & 11 deletions charts/argo-cd/templates/argocd-configs/cluster-secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{- range .Values.configs.clusterCredentials }}
{{- range $cluster_key, $cluster_value := .Values.configs.clusterCredentials }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "argo-cd.name" $ }}-cluster-{{ .name }}
name: {{ include "argo-cd.name" $ }}-cluster-{{ $cluster_key }}
namespace: {{ $.Release.Namespace | quote }}
labels:
{{- include "argo-cd.labels" (dict "context" $) | nindent 4 }}
Expand All @@ -19,17 +19,17 @@ metadata:
{{- end }}
type: Opaque
stringData:
name: {{ required "A valid .Values.configs.clusterCredentials[].name entry is required!" .name }}
server: {{ required "A valid .Values.configs.clusterCredentials[].server entry is required!" .server }}
{{- if .namespaces }}
namespaces: {{ .namespaces }}
{{- if .clusterResources }}
clusterResources: {{ .clusterResources | quote }}
name: {{ required "A valid .Values.configs.clusterCredentials.CLUSTERNAME.name entry is required!" $cluster_key }}
server: {{ required "A valid .Values.configs.clusterCredentials.CLUSTERNAME.server entry is required!" $cluster_value.server }}
{{- if $cluster_value.namespaces }}
namespaces: {{ $cluster_value.namespaces }}
{{- if $cluster_value.clusterResources }}
clusterResources: {{ $cluster_value.clusterResources | quote }}
{{- end }}
{{- end }}
{{- if .project }}
project: {{ .project | quote }}
{{- if $cluster_value.project }}
project: {{ $cluster_value.project | quote }}
{{- end }}
config: |
{{- required "A valid .Values.configs.clusterCredentials[].config entry is required!" .config | toRawJson | nindent 4 }}
{{- required "A valid .Values.configs.clusterCredentials.CLUSTERNAME.config entry is required!" $cluster_value.config | toRawJson | nindent 4 }}
{{- end }}
10 changes: 5 additions & 5 deletions charts/argo-cd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,13 @@ configs:
# command: [sh, -c, find . -name env.yaml]

# -- Provide one or multiple [external cluster credentials]
# @default -- `[]` (See [values.yaml])
# @default -- `{}` (See [values.yaml])
## Ref:
## - https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#clusters
## - https://argo-cd.readthedocs.io/en/stable/operator-manual/security/#external-cluster-credentials
## - https://argo-cd.readthedocs.io/en/stable/user-guide/projects/#project-scoped-repositories-and-clusters
clusterCredentials: []
# - name: mycluster
clusterCredentials: {}
# mycluster:
# server: https://mycluster.example.com
# labels: {}
# annotations: {}
Expand All @@ -430,7 +430,7 @@ configs:
# tlsClientConfig:
# insecure: false
# caData: "<base64 encoded certificate>"
# - name: mycluster2
# mycluster2:
# server: https://mycluster2.example.com
# labels: {}
# annotations: {}
Expand All @@ -441,7 +441,7 @@ configs:
# tlsClientConfig:
# insecure: false
# caData: "<base64 encoded certificate>"
# - name: mycluster3-project-scoped
# mycluster3-project-scoped:
# server: https://mycluster3.example.com
# labels: {}
# annotations: {}
Expand Down

0 comments on commit 7101b95

Please sign in to comment.