Fix elasticsearch repository configuration entry

This dynamically adds the elasticsearch path.repo configuration
entry if it's not defined.  This solves issues arising when the
storage settings are disabled in favor of emptydirs for simpler
ES deployments.  If elasticsearch attempts to configure the repo
path with an invalid entry (inaccesible external or shared fs
path), the service will crash.

Change-Id: I089b77104107dfb1f8e6ea2d8a560384718e63f9
This commit is contained in:
Steve Wilkerson 2018-01-05 10:54:00 -06:00
parent 17b13c42d7
commit 99ee859b66
6 changed files with 12 additions and 5 deletions

View File

@ -16,6 +16,10 @@ limitations under the License.
{{- if .Values.manifests.configmap_etc }}
{{- $envAll := . }}
{{- if and (.Values.conf.elasticsearch.repository.enabled) (empty .Values.conf.elasticsearch.config.path.repo) -}}
{{- set .Values.conf.elasticsearch.config.path "repo" .Values.conf.elasticsearch.repository.location -}}
{{- end -}}
---
apiVersion: v1
kind: ConfigMap

View File

@ -130,7 +130,7 @@ spec:
mountPath: {{ .Values.conf.elasticsearch.config.path.data }}
{{ if .Values.storage.filesystem_repository.enabled }}
- name: snapshots
mountPath: {{ .Values.conf.elasticsearch.config.path.repo }}
mountPath: {{ .Values.conf.elasticsearch.repository.location }}
{{ end }}
{{ if $mounts_elasticsearch.volumeMounts }}{{ toYaml $mounts_elasticsearch.volumeMounts | indent 12 }}{{ end }}
volumes:

View File

@ -124,7 +124,7 @@ spec:
mountPath: {{ .Values.conf.elasticsearch.config.path.data }}
{{ if .Values.storage.filesystem_repository.enabled }}
- name: snapshots
mountPath: {{ .Values.conf.elasticsearch.config.path.repo }}
mountPath: {{ .Values.conf.elasticsearch.repository.location }}
{{ end }}
{{ if $mounts_elasticsearch.volumeMounts }}{{ toYaml $mounts_elasticsearch.volumeMounts | indent 12 }}{{ end }}
volumes:

View File

@ -15,6 +15,7 @@ limitations under the License.
*/}}
{{- if .Values.manifests.job_snapshot_repository }}
{{- if .Values.conf.elasticsearch.repository.enabled }}
{{- $envAll := . }}
{{- $_ := set .Values "pod_dependency" .Values.dependencies.snapshot_repository -}}
@ -49,7 +50,7 @@ spec:
- name: REPO_TYPE
value: {{ .Values.conf.elasticsearch.repository.type | quote }}
- name: REPO_LOCATION
value: {{ .Values.conf.elasticsearch.config.path.repo | quote }}
value: {{ .Values.conf.elasticsearch.repository.location | quote }}
command:
- /tmp/register-repository.sh
volumeMounts:
@ -63,3 +64,4 @@ spec:
name: elasticsearch-bin
defaultMode: 0555
{{- end }}
{{- end }}

View File

@ -119,7 +119,7 @@ spec:
readOnly: true
{{ if .Values.storage.filesystem_repository.enabled }}
- name: snapshots
mountPath: {{ .Values.conf.elasticsearch.config.path.repo }}
mountPath: {{ .Values.conf.elasticsearch.repository.location }}
{{ end }}
- name: storage
mountPath: {{ .Values.conf.elasticsearch.config.path.data }}

View File

@ -246,9 +246,10 @@ conf:
path:
data: /usr/share/elasticsearch/data
logs: /usr/share/elasticsearch/logs
repo: /var/lib/openstack-helm/elasticsearch
repository:
enabled: true
name: default_repo
location: /var/lib/openstack-helm/elasticsearch
type: fs
env:
java_opts: "-Xms256m -Xmx256m"