diff --git a/kibana/README.md b/kibana/README.md index 9ba1a30d0..ef309573b 100644 --- a/kibana/README.md +++ b/kibana/README.md @@ -70,6 +70,7 @@ helm install --name kibana elastic/kibana --set imageTag=7.3.2 | `ingress` | Configurable [ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) to expose the Kibana service. See [`values.yaml`](./values.yaml) for an example | `enabled: false` | | `service` | Configurable [service](https://kubernetes.io/docs/concepts/services-networking/service/) to expose the Kibana service. See [`values.yaml`](./values.yaml) for an example | `type: ClusterIP`
`port: 5601`
`nodePort:`
`annotations: {}` | | `labels` | Configurable [label](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) applied to all Kibana pods | `{}` | +| `lifecycle` | Allows you to add lifecycle configuration. See [values.yaml](./values.yaml) for an example of the formatting. | `{}` | ## Examples diff --git a/kibana/templates/deployment.yaml b/kibana/templates/deployment.yaml index 2b5ce8d8d..6ae36ae76 100644 --- a/kibana/templates/deployment.yaml +++ b/kibana/templates/deployment.yaml @@ -112,6 +112,10 @@ spec: http "{{ .Values.healthCheckPath }}" ports: - containerPort: {{ .Values.httpPort }} +{{- if .Values.lifecycle }} + lifecycle: +{{ toYaml .Values.lifecycle | indent 10 }} +{{- end }} resources: {{ toYaml .Values.resources | indent 10 }} volumeMounts: diff --git a/kibana/tests/kibana_test.py b/kibana/tests/kibana_test.py index 9b57f4c53..de4ddb3a8 100644 --- a/kibana/tests/kibana_test.py +++ b/kibana/tests/kibana_test.py @@ -394,3 +394,15 @@ def test_adding_a_secret_mount_without_subpath(): 'mountPath': '/usr/share/elasticsearch/config/certs', 'name': 'elastic-certificates' } + +def test_adding_lifecycle_events(): + config = ''' +lifecycle: + postStart: + exec: + command: ['/bin/true'] +''' + r = helm_template(config) + d = r['deployment'][name]['spec']['template']['spec'] + p = d['containers'][0]['lifecycle']['postStart'] + assert p['exec']['command'][0] == '/bin/true' diff --git a/kibana/values.yaml b/kibana/values.yaml index 51a764706..1af52b81e 100755 --- a/kibana/values.yaml +++ b/kibana/values.yaml @@ -127,3 +127,11 @@ affinity: {} nameOverride: "" fullnameOverride: "" + +lifecycle: {} + # preStop: + # exec: + # command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"] + # postStart: + # exec: + # command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]