From 90c2eeb76ae002dad147178e0500d167f02e4358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Juan=20G=C3=B3mez=20Pe=C3=B1alver?= Date: Sun, 29 Mar 2020 15:14:30 +0100 Subject: [PATCH] fix: Helm bug with subcharts and alias --- charts/argo-cd/README.md | 22 +++++++------- charts/argo-cd/requirements.lock | 4 +-- charts/argo-cd/requirements.yaml | 3 +- charts/argo-cd/templates/_helpers.tpl | 7 +++-- .../deployment.yaml | 4 +-- .../argocd-repo-server/deployment.yaml | 3 +- .../templates/argocd-server/deployment.yaml | 3 +- .../argo-cd/templates/redis/deployment.yaml | 3 +- charts/argo-cd/templates/redis/service.yaml | 3 +- charts/argo-cd/values.yaml | 30 +++++++++---------- 10 files changed, 44 insertions(+), 38 deletions(-) diff --git a/charts/argo-cd/README.md b/charts/argo-cd/README.md index c14d6bc7..c0691bdd 100644 --- a/charts/argo-cd/README.md +++ b/charts/argo-cd/README.md @@ -263,8 +263,8 @@ Helm v3 has removed the `install-crds` hook so CRDs are now populated by files i When Redis is completely disabled from the chart (`redis.enabled=false`) and an external Redis instance wants to be used or -when Redis HA subcart is enabled (`redis.enabled=true and redis.ha.enabled=true`) -but HA proxy is disabled `redis.ha.haproxy.enabled=false` Redis flags need to be specified +when Redis HA subcart is enabled (`redis.enabled=true and redis-ha.enabled=true`) +but HA proxy is disabled `redis-ha.haproxy.enabled=false` Redis flags need to be specified through `xxx.extraArgs` | Key | Default | Description | @@ -284,12 +284,12 @@ through `xxx.extraArgs` | redis.resources | Resource limits and requests for redis | `{}` | | redis.servicePort | Redis service port | `6379` | | redis.tolerations | Tolerations for use with node taints https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ | `[]` | -| redis.ha | Configures Redis HA subchart https://github.com/helm/charts/tree/master/stable/redis-ha | | | -| redis.ha.enabled | Enables the Redis HA subchart and disabled the custom Redis single node deployment| `false` | -| redis.ha.exporter.enabled | If `true`, the prometheus exporter sidecar is enabled | `true` | -| redis.ha.persistentVolume.enabled | Configures persistency on Redis nodes | `false` -| redis.ha.redis.masterGroupName | Redis convention for naming the cluster group: must match `^[\\w-\\.]+$` and can be templated | `argocd` -| redis.ha.redis.config | Any valid redis config options in this section will be applied to each server (see `redis-ha` chart) | `` | -| redis.ha.redis.config.save | Will save the DB if both the given number of seconds and the given number of write operations against the DB occurred. `""` is disabled | `""` | -| redis.ha.haproxy.enabled | Enabled HAProxy LoadBalancing/Proxy | `true` | -| redis.ha.haproxy.metrics.enabled | HAProxy enable prometheus metric scraping | `true` | +| redis-ha | Configures Redis HA subchart https://github.com/helm/charts/tree/master/stable/redis-ha | | | +| redis-ha.enabled | Enables the Redis HA subchart and disables the custom Redis single node deployment| `false` | +| redis-ha.exporter.enabled | If `true`, the prometheus exporter sidecar is enabled | `true` | +| redis-ha.persistentVolume.enabled | Configures persistency on Redis nodes | `false` +| redis-ha.redis.masterGroupName | Redis convention for naming the cluster group: must match `^[\\w-\\.]+$` and can be templated | `argocd` +| redis-ha.redis.config | Any valid redis config options in this section will be applied to each server (see `redis-ha` chart) | `` | +| redis-ha.redis.config.save | Will save the DB if both the given number of seconds and the given number of write operations against the DB occurred. `""` is disabled | `""` | +| redis-ha.haproxy.enabled | Enabled HAProxy LoadBalancing/Proxy | `true` | +| redis-ha.haproxy.metrics.enabled | HAProxy enable prometheus metric scraping | `true` | diff --git a/charts/argo-cd/requirements.lock b/charts/argo-cd/requirements.lock index c6a4b7cc..61752ccb 100644 --- a/charts/argo-cd/requirements.lock +++ b/charts/argo-cd/requirements.lock @@ -2,5 +2,5 @@ dependencies: - name: redis-ha repository: https://kubernetes-charts.storage.googleapis.com version: 4.4.2 -digest: sha256:d3b7b8ec4c09eeeae44a64352f983cd1619cf98d80d0e49780a016aedb477a6c -generated: "2020-03-18T22:24:39.082009894Z" +digest: sha256:70fdd035c3aa3b7185882f12a73143c58ab32f04262dda2cf34a2b1a52116d96 +generated: "2020-03-29T14:37:59.349371452+01:00" diff --git a/charts/argo-cd/requirements.yaml b/charts/argo-cd/requirements.yaml index 48c808aa..eb6313dd 100644 --- a/charts/argo-cd/requirements.yaml +++ b/charts/argo-cd/requirements.yaml @@ -1,6 +1,5 @@ dependencies: - name: redis-ha - alias: redis.ha version: 4.4.2 repository: https://kubernetes-charts.storage.googleapis.com - condition: redis.ha.enabled \ No newline at end of file + condition: redis-ha.enabled \ No newline at end of file diff --git a/charts/argo-cd/templates/_helpers.tpl b/charts/argo-cd/templates/_helpers.tpl index 571f2945..bdafdf6f 100644 --- a/charts/argo-cd/templates/_helpers.tpl +++ b/charts/argo-cd/templates/_helpers.tpl @@ -42,8 +42,11 @@ Create dex name and version as used by the chart label. Create redis name and version as used by the chart label. */}} {{- define "argo-cd.redis.fullname" -}} -{{- if and .Values.redis.ha.enabled .Values.redis.ha.haproxy.enabled -}} -{{- printf "%s-redis-ha-haproxy" .Release.Name | trunc 63 | trimSuffix "-" -}} +{{ $redisHa := (index .Values "redis-ha") }} +{{- if and $redisHa.enabled -}} + {{- if $redisHa.haproxy.enabled -}} + {{- printf "%s-redis-ha-haproxy" .Release.Name | trunc 63 | trimSuffix "-" -}} + {{- end -}} {{- else -}} {{- printf "%s-%s" (include "argo-cd.fullname" .) .Values.redis.name | trunc 63 | trimSuffix "-" -}} {{- end -}} diff --git a/charts/argo-cd/templates/argocd-application-controller/deployment.yaml b/charts/argo-cd/templates/argocd-application-controller/deployment.yaml index fa05d96d..def9d56b 100755 --- a/charts/argo-cd/templates/argocd-application-controller/deployment.yaml +++ b/charts/argo-cd/templates/argocd-application-controller/deployment.yaml @@ -1,4 +1,4 @@ - +{{- $redisHa := (index .Values "redis-ha") -}} apiVersion: apps/v1 kind: Deployment metadata: @@ -56,7 +56,7 @@ spec: - {{ template "argo-cd.repoServer.fullname" . }}:{{ .Values.repoServer.service.port }} - --loglevel - {{ .Values.controller.logLevel }} - {{- if and .Values.redis.enabled .Values.redis.ha.enabled .Values.redis.ha.haproxy.enabled }} + {{- if or (and .Values.redis.enabled (not $redisHa.enabled)) (and $redisHa.enabled $redisHa.haproxy.enabled) }} - --redis - {{ template "argo-cd.redis.fullname" . }}:{{ .Values.redis.servicePort }} {{- end }} diff --git a/charts/argo-cd/templates/argocd-repo-server/deployment.yaml b/charts/argo-cd/templates/argocd-repo-server/deployment.yaml index 2ac031b1..d5b6cca4 100755 --- a/charts/argo-cd/templates/argocd-repo-server/deployment.yaml +++ b/charts/argo-cd/templates/argocd-repo-server/deployment.yaml @@ -1,3 +1,4 @@ +{{- $redisHa := (index .Values "redis-ha") -}} apiVersion: apps/v1 kind: Deployment metadata: @@ -52,7 +53,7 @@ spec: imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.repoServer.image.imagePullPolicy }} command: - argocd-repo-server - {{- if and .Values.redis.enabled .Values.redis.ha.enabled .Values.redis.ha.haproxy.enabled }} + {{- if or (and .Values.redis.enabled (not $redisHa.enabled)) (and $redisHa.enabled $redisHa.haproxy.enabled) }} - --redis - {{ template "argo-cd.redis.fullname" . }}:{{ .Values.redis.servicePort }} {{- end }} diff --git a/charts/argo-cd/templates/argocd-server/deployment.yaml b/charts/argo-cd/templates/argocd-server/deployment.yaml index c3dbd910..79c216e0 100755 --- a/charts/argo-cd/templates/argocd-server/deployment.yaml +++ b/charts/argo-cd/templates/argocd-server/deployment.yaml @@ -1,3 +1,4 @@ +{{- $redisHa := (index .Values "redis-ha") -}} apiVersion: apps/v1 kind: Deployment metadata: @@ -62,7 +63,7 @@ spec: {{- end }} - --loglevel - {{ .Values.server.logLevel }} - {{- if and .Values.redis.enabled .Values.redis.ha.enabled .Values.redis.ha.haproxy.enabled }} + {{- if or (and .Values.redis.enabled (not $redisHa.enabled)) (and $redisHa.enabled $redisHa.haproxy.enabled) }} - --redis - {{ template "argo-cd.redis.fullname" . }}:{{ .Values.redis.servicePort }} {{- end }} diff --git a/charts/argo-cd/templates/redis/deployment.yaml b/charts/argo-cd/templates/redis/deployment.yaml index e6538875..7531f6d2 100755 --- a/charts/argo-cd/templates/redis/deployment.yaml +++ b/charts/argo-cd/templates/redis/deployment.yaml @@ -1,4 +1,5 @@ -{{- if and .Values.redis.enabled (not .Values.redis.ha.enabled) }} +{{- $redisHa := (index .Values "redis-ha") -}} +{{- if and .Values.redis.enabled (not $redisHa.enabled) -}} apiVersion: apps/v1 kind: Deployment metadata: diff --git a/charts/argo-cd/templates/redis/service.yaml b/charts/argo-cd/templates/redis/service.yaml index 5f0bb1e4..7916edb2 100644 --- a/charts/argo-cd/templates/redis/service.yaml +++ b/charts/argo-cd/templates/redis/service.yaml @@ -1,4 +1,5 @@ -{{- if and .Values.redis.enabled (not .Values.redis.ha.enabled) }} +{{- $redisHa := (index .Values "redis-ha") -}} +{{- if and .Values.redis.enabled (not $redisHa.enabled) -}} apiVersion: v1 kind: Service metadata: diff --git a/charts/argo-cd/values.yaml b/charts/argo-cd/values.yaml index 4a311bb4..1fef35f6 100755 --- a/charts/argo-cd/values.yaml +++ b/charts/argo-cd/values.yaml @@ -282,23 +282,23 @@ redis: volumeMounts: [] volumes: [] - # This key configures Redis-HA subchart and when enabled (redis.ha.enabled=true) - # the custom redis deployment is omitted - ha: +# This key configures Redis-HA subchart and when enabled (redis-ha.enabled=true) +# the custom redis deployment is omitted +redis-ha: + enabled: false + # Check the redis-ha chart for more properties + exporter: + enabled: true + persistentVolume: enabled: false - # Check the redis-ha chart for more properties - exporter: + redis: + masterGroupName: argocd + config: + save: "\"\"" + haproxy: + enabled: true + metrics: enabled: true - persistentVolume: - enabled: false - redis: - masterGroupName: argocd - config: - save: "\"\"" - haproxy: - enabled: true - metrics: - enabled: true ## Server server: