0c4e37391f
Where we have the style '{{ ...' we should use the style '... }}'. Change-Id: Ic3e779e4681370d396f95d3804ca27db5b9d3642
194 lines
7.0 KiB
YAML
194 lines
7.0 KiB
YAML
{{/*
|
|
Copyright 2017 The Openstack-Helm Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/}}
|
|
|
|
{{- if .Values.manifests.statefulset_data }}
|
|
{{- $envAll := . }}
|
|
|
|
{{- $mounts_elasticsearch := .Values.pod.mounts.elasticsearch.elasticsearch }}
|
|
|
|
{{- $serviceAccountName := printf "%s-%s" .Release.Name "elasticsearch-data" }}
|
|
{{ tuple $envAll "elasticsearch_data" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: run-elasticsearch-data
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: {{ $serviceAccountName }}
|
|
namespace: {{ .Release.Namespace }}
|
|
roleRef:
|
|
kind: ClusterRole
|
|
name: {{ $serviceAccountName }}
|
|
apiGroup: rbac.authorization.k8s.io
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: {{ $serviceAccountName }}
|
|
rules:
|
|
- nonResourceURLs:
|
|
- /
|
|
verbs:
|
|
- get
|
|
- apiGroups:
|
|
- ""
|
|
resources:
|
|
- endpoints
|
|
verbs:
|
|
- get
|
|
- apiGroups:
|
|
- apps
|
|
resources:
|
|
- statefulsets/status
|
|
verbs:
|
|
- get
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: elasticsearch-data
|
|
annotations:
|
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
|
|
labels:
|
|
{{ tuple $envAll "elasticsearch" "data" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
|
spec:
|
|
serviceName: {{ tuple "elasticsearch" "data" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
|
replicas: {{ .Values.pod.replicas.data }}
|
|
selector:
|
|
matchLabels:
|
|
{{ tuple $envAll "elasticsearch" "data" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{ tuple $envAll "elasticsearch" "data" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
|
spec:
|
|
serviceAccountName: {{ $serviceAccountName }}
|
|
affinity:
|
|
{{ tuple $envAll "elasticsearch" "data" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
|
|
nodeSelector:
|
|
{{ .Values.labels.elasticsearch.node_selector_key }}: {{ .Values.labels.elasticsearch.node_selector_value | quote }}
|
|
terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.data.timeout | default "600" }}
|
|
initContainers:
|
|
{{ tuple $envAll "elasticsearch_data" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
|
- name: memory-map-increase
|
|
{{ tuple $envAll "memory_init" | include "helm-toolkit.snippets.image" | indent 10 }}
|
|
{{ tuple $envAll $envAll.Values.pod.resources.data | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
|
securityContext:
|
|
privileged: true
|
|
runAsUser: 0
|
|
command:
|
|
- sysctl
|
|
- -w
|
|
- vm.max_map_count={{ .Values.conf.init.max_map_count }}
|
|
containers:
|
|
- name: elasticsearch-data
|
|
{{ tuple $envAll "elasticsearch" | include "helm-toolkit.snippets.image" | indent 10 }}
|
|
{{ tuple $envAll $envAll.Values.pod.resources.data | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
|
securityContext:
|
|
privileged: true
|
|
capabilities:
|
|
add:
|
|
- IPC_LOCK
|
|
- SYS_RESOURCE
|
|
command:
|
|
- /tmp/elasticsearch.sh
|
|
- start
|
|
lifecycle:
|
|
preStop:
|
|
exec:
|
|
command:
|
|
- /tmp/elasticsearch.sh
|
|
- stop
|
|
ports:
|
|
- name: transport
|
|
containerPort: {{ tuple "elasticsearch" "internal" "discovery" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
|
readinessProbe:
|
|
tcpSocket:
|
|
port: {{ tuple "elasticsearch" "internal" "discovery" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
|
initialDelaySeconds: 20
|
|
periodSeconds: 10
|
|
env:
|
|
- name: NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
- name: NODE_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: NODE_MASTER
|
|
value: "false"
|
|
- name: NODE_DATA
|
|
value: "true"
|
|
- name: HTTP_ENABLE
|
|
value: "false"
|
|
- name: ES_JAVA_OPTS
|
|
value: "{{ .Values.conf.elasticsearch.env.java_opts }}"
|
|
- name: DISCOVERY_SERVICE
|
|
value: {{ tuple "elasticsearch" "discovery" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
|
- name: ES_PLUGINS_INSTALL
|
|
value: "elasticsearch-s3"
|
|
volumeMounts:
|
|
- name: elasticsearch-logs
|
|
mountPath: {{ .Values.conf.elasticsearch.config.path.logs }}
|
|
- name: elasticsearch-bin
|
|
mountPath: /tmp/elasticsearch.sh
|
|
subPath: elasticsearch.sh
|
|
readOnly: true
|
|
- name: elasticsearch-config
|
|
mountPath: /usr/share/elasticsearch/config
|
|
- name: elasticsearch-etc
|
|
mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
|
|
subPath: elasticsearch.yml
|
|
readOnly: true
|
|
- name: elasticsearch-etc
|
|
mountPath: /usr/share/elasticsearch/config/log4j2.properties
|
|
subPath: log4j2.properties
|
|
readOnly: true
|
|
- name: storage
|
|
mountPath: {{ .Values.conf.elasticsearch.config.path.data }}
|
|
{{ if $mounts_elasticsearch.volumeMounts }}{{ toYaml $mounts_elasticsearch.volumeMounts | indent 12 }}{{ end }}
|
|
volumes:
|
|
- name: elasticsearch-logs
|
|
emptyDir: {}
|
|
- name: elasticsearch-config
|
|
emptyDir: {}
|
|
- name: elasticsearch-bin
|
|
configMap:
|
|
name: elasticsearch-bin
|
|
defaultMode: 0555
|
|
- name: elasticsearch-etc
|
|
secret:
|
|
secretName: elasticsearch-etc
|
|
defaultMode: 0444
|
|
{{ if $mounts_elasticsearch.volumes }}{{ toYaml $mounts_elasticsearch.volumes | indent 8 }}{{ end }}
|
|
{{- if not .Values.storage.enabled }}
|
|
- name: storage
|
|
emptyDir: {}
|
|
{{- else }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: storage
|
|
spec:
|
|
accessModes: {{ .Values.storage.pvc.access_mode }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.storage.requests.storage }}
|
|
storageClassName: {{ .Values.storage.storage_class }}
|
|
{{- end }}
|
|
{{- end }}
|