Cleanup config files to keep them DRY (#1470)

Signed-off-by: Petr Drastil <petr.drastil@gmail.com>
This commit is contained in:
Petr Drastil 2022-09-21 09:32:06 +02:00 committed by GitHub
parent 8847af4522
commit 8ee317128d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 62 additions and 55 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: v2.4.12 appVersion: v2.4.12
description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes. description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd name: argo-cd
version: 5.4.7 version: 5.4.8
home: https://github.com/argoproj/argo-helm home: https://github.com/argoproj/argo-helm
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
keywords: keywords:
@ -19,4 +19,4 @@ dependencies:
condition: redis-ha.enabled condition: redis-ha.enabled
annotations: annotations:
artifacthub.io/changes: | artifacthub.io/changes: |
- "[Added]: Add privateKey spec handling from CertificatePrivateKey" - "[Changed]: Cleanup of config files to keep them DRY"

View file

@ -5,11 +5,12 @@ metadata:
name: argocd-cm name: argocd-cm
labels: labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "cm") | nindent 4 }} {{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "cm") | nindent 4 }}
{{- if .Values.server.configAnnotations }} {{- with .Values.server.configAnnotations }}
annotations: annotations:
{{- range $key, $value := .Values.server.configAnnotations }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }} {{- end }}
{{- end }} data:
data: {{- include "argo-cd.config" $ | nindent 4 }} {{- include "argo-cd.config" $ | nindent 2 }}
{{- end }} {{- end }}

View file

@ -1,15 +1,15 @@
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
{{- if .Values.configs.gpgKeysAnnotations }} name: argocd-gpg-keys-cm
labels:
{{- include "argo-cd.labels" (dict "context" . "name" "gpg-keys-cm") | nindent 4 }}
{{- with .Values.configs.gpgKeysAnnotations }}
annotations: annotations:
{{- range $key, $value := .Values.configs.gpgKeysAnnotations }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
labels:
{{- include "argo-cd.labels" (dict "context" . "name" "gpg-keys-cm") | nindent 4 }}
name: argocd-gpg-keys-cm
{{- with .Values.configs.gpgKeys }} {{- with .Values.configs.gpgKeys }}
data: data:
{{- toYaml . | nindent 2 }} {{- toYaml . | nindent 2 }}

View file

@ -8,9 +8,9 @@ metadata:
data: data:
context: | context: |
argocdUrl: {{ .Values.notifications.argocdUrl | quote }} argocdUrl: {{ .Values.notifications.argocdUrl | quote }}
{{- with .Values.notifications.context }} {{- with .Values.notifications.context }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.notifications.notifiers }} {{- with .Values.notifications.notifiers }}
{{- toYaml . | nindent 2 }} {{- toYaml . | nindent 2 }}
{{- end }} {{- end }}

View file

@ -5,11 +5,11 @@ metadata:
name: argocd-notifications-secret name: argocd-notifications-secret
labels: labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.notifications.name "name" .Values.notifications.name) | nindent 4 }} {{- include "argo-cd.labels" (dict "context" . "component" .Values.notifications.name "name" .Values.notifications.name) | nindent 4 }}
{{- if .Values.notifications.secret.annotations }} {{- with .Values.notifications.secret.annotations }}
annotations: annotations:
{{- range $key, $value := .Values.notifications.secret.annotations }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
type: Opaque type: Opaque
stringData: stringData:

View file

@ -5,14 +5,14 @@ metadata:
name: argocd-rbac-cm name: argocd-rbac-cm
labels: labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "rbac-cm") | nindent 4 }} {{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "rbac-cm") | nindent 4 }}
{{- if .Values.server.rbacConfigAnnotations }} {{- with .Values.server.rbacConfigAnnotations }}
annotations: annotations:
{{- range $key, $value := .Values.server.rbacConfigAnnotations }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- with .Values.server.rbacConfig }}
{{- if .Values.server.rbacConfig }}
data: data:
{{- toYaml .Values.server.rbacConfig | nindent 4 }} {{- toYaml . | nindent 2 }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -5,34 +5,34 @@ metadata:
name: argocd-secret name: argocd-secret
labels: labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "secret") | nindent 4 }} {{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "secret") | nindent 4 }}
{{- if .Values.configs.secret.annotations }} {{- with .Values.configs.secret.annotations }}
annotations: annotations:
{{- range $key, $value := .Values.configs.secret.annotations }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
type: Opaque type: Opaque
{{- if or .Values.configs.secret.githubSecret (or .Values.configs.secret.gitlabSecret .Values.configs.secret.bitbucketUUID .Values.configs.secret.bitbucketServerSecret .Values.configs.secret.gogsSecret .Values.configs.secret.argocdServerAdminPassword .Values.configs.secret.argocdServerTlsConfig .Values.configs.secret.extra) }} {{- if or .Values.configs.secret.githubSecret (or .Values.configs.secret.gitlabSecret .Values.configs.secret.bitbucketUUID .Values.configs.secret.bitbucketServerSecret .Values.configs.secret.gogsSecret .Values.configs.secret.argocdServerAdminPassword .Values.configs.secret.argocdServerTlsConfig .Values.configs.secret.extra) }}
# Setting a blank data again will wipe admin password/key/cert # Setting a blank data again will wipe admin password/key/cert
data: data:
{{- if .Values.configs.secret.githubSecret }} {{- with .Values.configs.secret.githubSecret }}
webhook.github.secret: {{ .Values.configs.secret.githubSecret | b64enc }} webhook.github.secret: {{ . | b64enc }}
{{- end }} {{- end }}
{{- if .Values.configs.secret.gitlabSecret }} {{- with .Values.configs.secret.gitlabSecret }}
webhook.gitlab.secret: {{ .Values.configs.secret.gitlabSecret | b64enc }} webhook.gitlab.secret: {{ . | b64enc }}
{{- end }} {{- end }}
{{- if .Values.configs.secret.bitbucketServerSecret }} {{- with .Values.configs.secret.bitbucketServerSecret }}
webhook.bitbucketserver.secret: {{ .Values.configs.secret.bitbucketServerSecret | b64enc }} webhook.bitbucketserver.secret: {{ . | b64enc }}
{{- end }} {{- end }}
{{- if .Values.configs.secret.bitbucketUUID }} {{- with .Values.configs.secret.bitbucketUUID }}
webhook.bitbucket.uuid: {{ .Values.configs.secret.bitbucketUUID | b64enc }} webhook.bitbucket.uuid: {{ . | b64enc }}
{{- end }} {{- end }}
{{- if .Values.configs.secret.gogsSecret }} {{- with .Values.configs.secret.gogsSecret }}
webhook.gogs.secret: {{ .Values.configs.secret.gogsSecret | b64enc }} webhook.gogs.secret: {{ . | b64enc }}
{{- end }} {{- end }}
{{- if .Values.configs.secret.argocdServerTlsConfig }} {{- with .Values.configs.secret.argocdServerTlsConfig }}
tls.key: {{ .Values.configs.secret.argocdServerTlsConfig.key | b64enc }} tls.key: {{ .key | b64enc }}
tls.crt: {{ .Values.configs.secret.argocdServerTlsConfig.crt | b64enc }} tls.crt: {{ .crt | b64enc }}
{{- end }} {{- end }}
{{- if .Values.configs.secret.argocdServerAdminPassword }} {{- if .Values.configs.secret.argocdServerAdminPassword }}
admin.password: {{ .Values.configs.secret.argocdServerAdminPassword | b64enc }} admin.password: {{ .Values.configs.secret.argocdServerAdminPassword | b64enc }}

View file

@ -1,13 +1,13 @@
apiVersion: v1 apiVersion: v1
{{- toYaml .Values.configs.knownHosts | nindent 0 }}
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: argocd-ssh-known-hosts-cm
labels: labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "ssh-known-hosts-cm") | nindent 4 }} {{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "ssh-known-hosts-cm") | nindent 4 }}
{{- if .Values.configs.knownHostsAnnotations }} {{- with .Values.configs.knownHostsAnnotations }}
annotations: annotations:
{{- range $key, $value := .Values.configs.knownHostsAnnotations }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- toYaml .Values.configs.knownHosts | nindent 0 }}
name: argocd-ssh-known-hosts-cm

View file

@ -1,15 +1,15 @@
apiVersion: v1 apiVersion: v1
{{- if .Values.configs.tlsCerts }}
{{- toYaml .Values.configs.tlsCerts | nindent 0 }}
{{- end }}
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: argocd-tls-certs-cm
labels: labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "tls-certs-cm") | nindent 4 }} {{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" "tls-certs-cm") | nindent 4 }}
{{- if .Values.configs.tlsCertsAnnotations }} {{- with .Values.configs.tlsCertsAnnotations }}
annotations: annotations:
{{- range $key, $value := .Values.configs.tlsCertsAnnotations }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- with .Values.configs.tlsCerts }}
name: argocd-tls-certs-cm {{- toYaml . | nindent 0 }}
{{- end }}

View file

@ -2,12 +2,14 @@
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: {{ template "argo-cd.redis.fullname" . }} name: {{ include "argo-cd.redis.fullname" . }}
labels: labels:
{{- include "argo-cd.labels" (dict "context" $) | nindent 4 }} {{- include "argo-cd.labels" (dict "context" $) | nindent 4 }}
{{- with .Values.externalRedis.secretAnnotations }} {{- with .Values.externalRedis.secretAnnotations }}
annotations: annotations:
{{- toYaml . | nindent 4}} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }} {{- end }}
type: Opaque type: Opaque
data: data:

View file

@ -9,7 +9,9 @@ metadata:
{{- include "argo-cd.labels" (dict "context" $) | nindent 4 }} {{- include "argo-cd.labels" (dict "context" $) | nindent 4 }}
{{- with $.Values.configs.credentialTemplatesAnnotations }} {{- with $.Values.configs.credentialTemplatesAnnotations }}
annotations: annotations:
{{- toYaml . | nindent 4}} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }} {{- end }}
data: data:
{{- range $key, $value := $repo_cred_value }} {{- range $key, $value := $repo_cred_value }}

View file

@ -9,7 +9,9 @@ metadata:
{{- include "argo-cd.labels" (dict "context" $) | nindent 4 }} {{- include "argo-cd.labels" (dict "context" $) | nindent 4 }}
{{- with $.Values.configs.repositoriesAnnotations }} {{- with $.Values.configs.repositoriesAnnotations }}
annotations: annotations:
{{- toYaml . | nindent 4 }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }} {{- end }}
data: data:
{{- range $key, $value := $repo_value }} {{- range $key, $value := $repo_value }}