From f98cdecc44dc4e3869a4e82d31311a8d8361f41c Mon Sep 17 00:00:00 2001 From: Scott Hawkins Date: Tue, 23 Jul 2019 15:54:14 -0400 Subject: [PATCH] [stable/consul] Add the ability to attach lifecycle options to StatefulSet (#15804) * Add the ability to attach lifecycle options to StatefulSet Add sample to values file Bump chart version Signed-off-by: Scott Hawkins Signed-off-by: echoboomer * Fix space in values file Signed-off-by: echoboomer --- stable/consul/Chart.yaml | 2 +- stable/consul/README.md | 1 + stable/consul/templates/consul-statefulset.yaml | 4 ++++ stable/consul/values.yaml | 9 +++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/stable/consul/Chart.yaml b/stable/consul/Chart.yaml index 792efee787..2a5f315e07 100755 --- a/stable/consul/Chart.yaml +++ b/stable/consul/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: consul home: https://github.com/hashicorp/consul -version: 3.7.0 +version: 3.7.1 appVersion: 1.5.2 description: Highly available and distributed service discovery and key-value store designed with support for the modern data center to make distributed systems and diff --git a/stable/consul/README.md b/stable/consul/README.md index b2d76aa32a..5da54b9dd8 100644 --- a/stable/consul/README.md +++ b/stable/consul/README.md @@ -71,6 +71,7 @@ The following table lists the configurable parameters of the consul chart and th | `test.rbac.create` | Create rbac for test container | `false` | | `test.rbac.serviceAccountName` | Name of existed service account for test container | `` | | `additionalLabels` | Add labels to Pod and StatefulSet | `{}` | +| `lifecycle` | Lifecycle configuration, in YAML, for StatefulSet | `nil` | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. diff --git a/stable/consul/templates/consul-statefulset.yaml b/stable/consul/templates/consul-statefulset.yaml index 8a78c4c2a5..1464b70afc 100644 --- a/stable/consul/templates/consul-statefulset.yaml +++ b/stable/consul/templates/consul-statefulset.yaml @@ -104,6 +104,10 @@ spec: readOnly: true mountPath: /etc/consul/userconfig/{{ .name }} {{ end }} + {{- if .Values.lifecycle }} + lifecycle: +{{ tpl (toYaml .Values.lifecycle) . | indent 10 }} + {{- end }} livenessProbe: exec: command: diff --git a/stable/consul/values.yaml b/stable/consul/values.yaml index 51193fb0cc..eed1415a94 100644 --- a/stable/consul/values.yaml +++ b/stable/consul/values.yaml @@ -137,3 +137,12 @@ test: nodeSelector: {} tolerations: [] additionalLabels: {} + +# Lifecycle for StatefulSet +# lifecycle: +# preStop: +# exec: +# command: +# - sh +# - -c +# - "sleep 60"