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

[elasticsearch] Add option to provide custom start/stop hooks #197

Merged
merged 7 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
values: fix duplication, move hooks closer to the lifecycle; tests: a…
…dd sugested test

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@commercetools.de>
  • Loading branch information
Tetiana Kravchenko committed Jul 3, 2019
commit db535e2ae6c6e4d7642ab395b79f65779ed8935f
17 changes: 17 additions & 0 deletions elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,3 +655,20 @@ def test_master_termination_fixed_enabled():

c = r['statefulset'][uname]['spec']['template']['spec']['containers'][1]
assert c['name'] == 'elasticsearch-master-graceful-termination-handler'

def test_lifecycle_hooks():
config = ''
r = helm_template(config)
c = r['statefulset'][uname]['spec']['template']['spec']['containers'][0]
assert 'lifecycle' not in c

config = '''
lifecycle:
preStop:
exec:
command: ["/bin/bash","/preStop"]
'''
r = helm_template(config)
c = r['statefulset'][uname]['spec']['template']['spec']['containers'][0]

assert c['lifecycle']['preStop']['exec']['command'] == ["/bin/bash","/preStop"]
20 changes: 10 additions & 10 deletions elasticsearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ esConfig: {}
# log4j2.properties: |
# key = value

# Add custom preStop, postStart lifecycle hooks
hooks: {}
## (string) Script to execute prior the pod stops.
# preStop: |-

## (string) Script to execute after the pod starts.
# postStart: |-

# Extra environment variables to append to this nodeGroup
# This will be appended to the current 'env:' key. You can use any of the kubernetes env
# syntax here
Expand Down Expand Up @@ -197,6 +189,14 @@ lifecycle: {}
# preStop:
# exec:
# command: ["/bin/bash","/preStop"]
# preStop:
# postStart:
# exec:
# command: ["/bin/bash","/preStop"]
# command: ["/bin/bash","/postStart"]

# Add custom preStop, postStart lifecycle hooks
hooks: {}
## (string) Script to execute prior the pod stops.
# preStop: |-

## (string) Script to execute after the pod starts.
# postStart: |-