From 3eaad42bb4b957976fcf6250341f8a6e518a12fe Mon Sep 17 00:00:00 2001 From: Petr Drastil Date: Sat, 29 Oct 2022 21:08:16 +0200 Subject: [PATCH] fix(argo-cd): Type conversion for ConfigMaps values (#1594) Signed-off-by: Petr Drastil --- charts/argo-cd/Chart.yaml | 4 ++-- charts/argo-cd/README.md | 8 ++++---- charts/argo-cd/templates/NOTES.txt | 2 +- charts/argo-cd/templates/_helpers.tpl | 8 +++++--- charts/argo-cd/templates/argocd-configs/argocd-cm.yaml | 2 +- charts/argo-cd/templates/argocd-server/clusterrole.yaml | 2 +- charts/argo-cd/values.yaml | 8 ++++---- 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/charts/argo-cd/Chart.yaml b/charts/argo-cd/Chart.yaml index 6172e302..3dfc4f4e 100644 --- a/charts/argo-cd/Chart.yaml +++ b/charts/argo-cd/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: v2.5.0 description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes. name: argo-cd -version: 5.8.6 +version: 5.8.7 home: https://github.com/argoproj/argo-helm icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png sources: @@ -22,4 +22,4 @@ dependencies: condition: redis-ha.enabled annotations: artifacthub.io/changes: | - - "[Fixed]: Migration of configs for users who create them manually" + - "[Fixed]: Type conversion for ConfigMap values" diff --git a/charts/argo-cd/README.md b/charts/argo-cd/README.md index 5cecc0b5..f075bded 100644 --- a/charts/argo-cd/README.md +++ b/charts/argo-cd/README.md @@ -370,11 +370,11 @@ NAME: my-release | Key | Type | Default | Description | |-----|------|---------|-------------| | configs.clusterCredentials | list | `[]` (See [values.yaml]) | Provide one or multiple [external cluster credentials] | -| configs.cm."admin.enabled" | string | `"true"` | Enable local admin user | +| configs.cm."admin.enabled" | bool | `true` | Enable local admin user | | configs.cm."application.instanceLabelKey" | string | Defaults to app.kubernetes.io/instance | The name of tracking label used by Argo CD for resource pruning | -| configs.cm."exec.enabled" | string | `"false"` | Enable exec feature in Argo UI | -| configs.cm."server.rbac.log.enforce.enable" | string | `"false"` | Enable logs RBAC enforcement | -| configs.cm."timeout.hard.reconciliation" | string | `"0"` | Timeout to refresh application data as well as target manifests cache | +| configs.cm."exec.enabled" | bool | `false` | Enable exec feature in Argo UI | +| configs.cm."server.rbac.log.enforce.enable" | bool | `false` | Enable logs RBAC enforcement | +| configs.cm."timeout.hard.reconciliation" | int | `0` | Timeout to refresh application data as well as target manifests cache | | configs.cm."timeout.reconciliation" | string | `"180s"` | Timeout to discover if a new manifests version got published to the repository | | configs.cm.annotations | object | `{}` | Annotations to be added to argocd-cm configmap | | configs.cm.create | bool | `true` | Create the argocd-cm configmap for [Declarative setup] | diff --git a/charts/argo-cd/templates/NOTES.txt b/charts/argo-cd/templates/NOTES.txt index 6e50612a..70181f17 100644 --- a/charts/argo-cd/templates/NOTES.txt +++ b/charts/argo-cd/templates/NOTES.txt @@ -58,7 +58,7 @@ In order to access the server UI you have the following options: - Set the `configs.params."server.insecure"` in the values file and terminate SSL at your ingress: https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/#option-2-multiple-ingress-objects-and-hosts -{{ if eq (index (coalesce .Values.server.config .Values.configs.cm) "admin.enabled") "true" -}} +{{ if eq (toString (index (coalesce .Values.server.config .Values.configs.cm) "admin.enabled")) "true" -}} After reaching the UI the first time you can login with username: admin and the random password generated during the installation. You can find the password by running: kubectl -n {{ .Release.Namespace }} get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d diff --git a/charts/argo-cd/templates/_helpers.tpl b/charts/argo-cd/templates/_helpers.tpl index ccbae4be..ac497dda 100644 --- a/charts/argo-cd/templates/_helpers.tpl +++ b/charts/argo-cd/templates/_helpers.tpl @@ -184,7 +184,9 @@ Merge Argo Configuration with Preset Configuration {{- define "argo-cd.config.cm" -}} {{- $config := coalesce .Values.server.config (omit .Values.configs.cm "create" "annotations") -}} {{- $preset := include "argo-cd.config.cm.presets" . | fromYaml | default dict -}} -{{- mergeOverwrite $preset $config | toYaml }} +{{- range $key, $value := mergeOverwrite $preset $config }} +{{ $key }}: {{ toString $value | toYaml }} +{{- end }} {{- end -}} {{/* @@ -209,8 +211,8 @@ Merge Argo Params Configuration with Preset Configuration */}} {{- define "argo-cd.config.params" -}} {{- $config := omit .Values.configs.params "annotations" }} -{{- $preset := include "argo-cd.config.params.presets" $ | fromYaml | default dict -}} +{{- $preset := include "argo-cd.config.params.presets" . | fromYaml | default dict -}} {{- range $key, $value := mergeOverwrite $preset $config }} -{{ $key }}: {{ $value | quote }} +{{ $key }}: {{ toString $value | toYaml }} {{- end }} {{- end -}} diff --git a/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml b/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml index 7e9055eb..6da8be0a 100644 --- a/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml +++ b/charts/argo-cd/templates/argocd-configs/argocd-cm.yaml @@ -12,5 +12,5 @@ metadata: {{- end }} {{- end }} data: - {{- include "argo-cd.config.cm" . | nindent 2 }} + {{- include "argo-cd.config.cm" . | trim | nindent 2 }} {{- end }} diff --git a/charts/argo-cd/templates/argocd-server/clusterrole.yaml b/charts/argo-cd/templates/argocd-server/clusterrole.yaml index c892f111..ee6015be 100644 --- a/charts/argo-cd/templates/argocd-server/clusterrole.yaml +++ b/charts/argo-cd/templates/argocd-server/clusterrole.yaml @@ -27,7 +27,7 @@ rules: - pods/log verbs: - get - {{- if eq (index (coalesce .Values.server.config .Values.configs.cm) "exec.enabled") "true" }} + {{- if eq (toString (index (coalesce .Values.server.config .Values.configs.cm) "exec.enabled")) "true" }} - apiGroups: - "" resources: diff --git a/charts/argo-cd/values.yaml b/charts/argo-cd/values.yaml index 85ad2636..b5eb4700 100755 --- a/charts/argo-cd/values.yaml +++ b/charts/argo-cd/values.yaml @@ -110,21 +110,21 @@ configs: # -- Enable logs RBAC enforcement ## Ref: https://argo-cd.readthedocs.io/en/latest/operator-manual/upgrading/2.3-2.4/#enable-logs-rbac-enforcement - server.rbac.log.enforce.enable: "false" + server.rbac.log.enforce.enable: false # -- Enable exec feature in Argo UI ## Ref: https://argo-cd.readthedocs.io/en/latest/operator-manual/rbac/#exec-resource - exec.enabled: "false" + exec.enabled: false # -- Enable local admin user ## Ref: https://argo-cd.readthedocs.io/en/latest/faq/#how-to-disable-admin-user - admin.enabled: "true" + admin.enabled: true # -- Timeout to discover if a new manifests version got published to the repository timeout.reconciliation: 180s # -- Timeout to refresh application data as well as target manifests cache - timeout.hard.reconciliation: "0" + timeout.hard.reconciliation: 0 # Dex configuration # dex.config: |