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
revertchanges: remove hooks variable
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@commercetools.de>
  • Loading branch information
Tetiana Kravchenko committed Jul 5, 2019
commit a5c334e7c143902e08f17d254d13b613fea8d955
1 change: 0 additions & 1 deletion elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ helm install --name elasticsearch elastic/elasticsearch --version 7.2.0 --set im
| `minimumMasterNodes` | The value for [discovery.zen.minimum_master_nodes](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/discovery-settings.html#minimum_master_nodes). Should be set to `(master_eligible_nodes / 2) + 1`. Ignored in Elasticsearch versions >= 7. | `2` |
| `esMajorVersion` | Used to set major version specific configuration | `7` |
| `esConfig` | Allows you to add any config files in `/usr/share/elasticsearch/config/` such as `elasticsearch.yml` and `log4j2.properties`. See [values.yaml](./values.yaml) for an example of the formatting. | `{}` |
| `hooks` | Allows you to add lifecycle preStop, postStart hooks. See [values.yaml](./values.yaml) for an example of the formatting. | `{}` |
| `extraEnvs` | Extra [environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/#using-environment-variables-inside-of-your-config) which will be appended to the `env:` definition for the container | `[]` |
| `extraVolumes` | Additional volumes to be passed to the `tpl` function | |
| `extraVolumeMounts` | Additional volumeMounts to be passed to the `tpl` function | |
Expand Down
8 changes: 1 addition & 7 deletions elasticsearch/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.esConfig }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -8,15 +9,8 @@ metadata:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
app: "{{ template "uname" . }}"
data:
{{- if .Values.esConfig }}
{{- range $path, $config := .Values.esConfig }}
{{ $path }}: |
{{ $config | indent 4 -}}
{{- end -}}
{{- end -}}
{{- if .Values.hooks }}
{{- range $path, $config := .Values.hooks }}
{{ $path }}: |
{{ $config | indent 4 -}}
{{- end -}}
{{- end }}
13 changes: 3 additions & 10 deletions elasticsearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ spec:
secret:
secretName: {{ .secretName }}
{{- end }}
{{- if or .Values.esConfig .Values.hooks }}
- name: config
{{- if .Values.esConfig }}
- name: esconfig
configMap:
name: {{ template "uname" . }}-config
{{- end }}
Expand Down Expand Up @@ -215,17 +215,10 @@ spec:
{{- end }}
{{- end }}
{{- range $path, $config := .Values.esConfig }}
- name: config
- name: esconfig
mountPath: /usr/share/elasticsearch/config/{{ $path }}
subPath: {{ $path }}
{{- end -}}
{{- if .Values.hooks }}
{{- range $path, $config := .Values.hooks }}
- name: config
mountPath: /{{ $path }}
subPath: {{ $path }}
{{- end -}}
{{- end }}
{{- if .Values.extraVolumeMounts }}
{{ tpl .Values.extraVolumeMounts . | indent 10 }}
{{- end }}
Expand Down
6 changes: 0 additions & 6 deletions elasticsearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,3 @@ lifecycle: {}
# 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: |-