Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
[kibana] Allow configuring lifecycle events (#295)
Browse files Browse the repository at this point in the history
[kibana] Allow configuring lifecycle events
  • Loading branch information
Crazybus authored Sep 23, 2019
2 parents 21b711a + a7854cd commit de1e565
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions kibana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`<br>`port: 5601`<br>`nodePort:`<br>`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

Expand Down
4 changes: 4 additions & 0 deletions kibana/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions kibana/tests/kibana_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
8 changes: 8 additions & 0 deletions kibana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit de1e565

Please sign in to comment.