From e13bb2a7e9a99eb3d406301dde161367682fa56f Mon Sep 17 00:00:00 2001 From: DJ Mountney Date: Mon, 19 Aug 2019 03:19:29 -0700 Subject: [PATCH] [stable/redis] Allow templates in user-provided configmap values (#16363) * Allow templates in user-provided configmap values Render configmap, master.configmap, slave.configmap, and sentinel.configmap using the tpl function. This allows us to do things like set the dbfilename to the release name And is useful for charts that use redis as a subchart and want to provide additional redis settings for users to tune. Signed-off-by: DJ Mountney * Update readme to reference values now parsed as templates Signed-off-by: DJ Mountney --- stable/redis/Chart.yaml | 2 +- stable/redis/README.md | 8 ++++---- stable/redis/templates/configmap.yaml | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/stable/redis/Chart.yaml b/stable/redis/Chart.yaml index baad52b23a..c448a12ab3 100644 --- a/stable/redis/Chart.yaml +++ b/stable/redis/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: redis -version: 9.0.2 +version: 9.0.3 appVersion: 5.0.5 description: Open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. keywords: diff --git a/stable/redis/README.md b/stable/redis/README.md index 7ceb8fb6d3..b72ba8b914 100644 --- a/stable/redis/README.md +++ b/stable/redis/README.md @@ -138,7 +138,7 @@ The following table lists the configurable parameters of the Redis chart and the | `usePassword` | Use password | `true` | | `usePasswordFile` | Mount passwords as files instead of environment variables | `false` | | `password` | Redis password (ignored if existingSecret set) | Randomly generated | -| `configmap` | Additional common Redis node configuration | See values.yaml | +| `configmap` | Additional common Redis node configuration (this value is evaluated as a template) | See values.yaml | | `clusterDomain` | Kubernetes DNS Domain name to use | `cluster.local` | | `networkPolicy.enabled` | Enable NetworkPolicy | `false` | | `networkPolicy.allowExternal` | Don't require client label for connections | `true` | @@ -180,7 +180,7 @@ The following table lists the configurable parameters of the Redis chart and the | `master.podAnnotations` | Additional annotations for Redis master pod | {} | | `redisPort` | Redis port (in both master and slaves) | `6379` | | `master.command` | Redis master entrypoint string. The command `redis-server` is executed if this is not provided. | `/run.sh` | -| `master.configmap` | Additional Redis configuration for the master nodes | `nil` | +| `master.configmap` | Additional Redis configuration for the master nodes (this value is evaluated as a template) | `nil` | | `master.disableCommands` | Array of Redis commands to disable (master) | `["FLUSHDB", "FLUSHALL"]` | | `master.extraFlags` | Redis master additional command line flags | [] | | `master.nodeSelector` | Redis master Node labels for pod assignment | {"beta.kubernetes.io/arch": "amd64"} | @@ -218,7 +218,7 @@ The following table lists the configurable parameters of the Redis chart and the | `slave.service.port` | Kubernetes Service port (redis slave) | `6379` | | `slave.service.loadBalancerIP` | LoadBalancerIP if Redis slave service type is `LoadBalancer` | `nil` | | `slave.command` | Redis slave entrypoint array. The docker image's ENTRYPOINT is used if this is not provided. | `/run.sh` | -| `slave.configmap` | Additional Redis configuration for the slave nodes | `nil` | +| `slave.configmap` | Additional Redis configuration for the slave nodes (this value is evaluated as a template) | `nil` | | `slave.disableCommands` | Array of Redis commands to disable (slave) | `[FLUSHDB, FLUSHALL]` | | `slave.extraFlags` | Redis slave additional command line flags | `[]` | | `slave.livenessProbe.enabled` | Turn on and off liveness probe (redis slave pod) | `true` | @@ -255,7 +255,7 @@ The following table lists the configurable parameters of the Redis chart and the | `sentinel.failoverTimeout` | Timeout for performing a election failover | `18000` | | `sentinel.parallelSyncs` | Number of parallel syncs in the cluster | `1` | | `sentinel.port` | Redis Sentinel port | `26379` | -| `sentinel.configmap` | Additional Redis configuration for the sentinel nodes | `nil` | +| `sentinel.configmap` | Additional Redis configuration for the sentinel nodes (this value is evaluated as a template) | `nil` | | `sentinel.service.type` | Kubernetes Service type (redis sentinel) | `ClusterIP` | | `sentinel.service.nodePort` | Kubernetes Service nodePort (redis sentinel) | `nil` | | `sentinel.service.annotations` | annotations for redis sentinel service | {} | diff --git a/stable/redis/templates/configmap.yaml b/stable/redis/templates/configmap.yaml index e6005e77fa..1ea91bd5b0 100644 --- a/stable/redis/templates/configmap.yaml +++ b/stable/redis/templates/configmap.yaml @@ -11,13 +11,13 @@ data: redis.conf: |- {{- if .Values.configmap }} # User-supplied configuration: -{{ .Values.configmap | indent 4 }} +{{ tpl .Values.configmap . | indent 4 }} {{- end }} master.conf: |- dir {{ .Values.master.persistence.path }} {{- if .Values.master.configmap }} # User-supplied master configuration: -{{ .Values.master.configmap | indent 4 }} +{{ tpl .Values.master.configmap . | indent 4 }} {{- end }} {{- if .Values.master.disableCommands }} {{- range .Values.master.disableCommands }} @@ -29,7 +29,7 @@ data: slave-read-only yes {{- if .Values.slave.configmap }} # User-supplied slave configuration: -{{ .Values.slave.configmap | indent 4 }} +{{ tpl .Values.slave.configmap . | indent 4 }} {{- end }} {{- if .Values.slave.disableCommands }} {{- range .Values.slave.disableCommands }} @@ -47,6 +47,6 @@ data: sentinel parallel-syncs {{ .Values.sentinel.masterSet }} {{ .Values.sentinel.parallelSyncs }} {{- if .Values.sentinel.configmap }} # User-supplied sentinel configuration: -{{ .Values.sentinel.configmap | indent 4 }} +{{ tpl .Values.sentinel.configmap . | indent 4 }} {{- end }} {{- end }}