|
| 1 | +apiVersion: extensions/v1beta1 |
| 2 | +kind: Deployment |
| 3 | +metadata: |
| 4 | + name: elasticsearch |
| 5 | + namespace: "{{ .Values.namespace }}" |
| 6 | + labels: |
| 7 | + app: elasticsearch |
| 8 | +spec: |
| 9 | + replicas: 1 |
| 10 | + revisionHistoryLimit: 3 |
| 11 | + strategy: |
| 12 | + type: Recreate |
| 13 | + template: |
| 14 | + metadata: |
| 15 | + annotations: |
| 16 | + releasetime: {{ $.Release.Time }} |
| 17 | + labels: |
| 18 | + app: elasticsearch |
| 19 | + spec: |
| 20 | + affinity: |
| 21 | + nodeAffinity: |
| 22 | + requiredDuringSchedulingIgnoredDuringExecution: |
| 23 | + nodeSelectorTerms: |
| 24 | + - matchExpressions: |
| 25 | + - key: role |
| 26 | + operator: NotIn |
| 27 | + values: |
| 28 | + - master |
| 29 | +{{- if .Values.elasticsearch.nodeSelector }} |
| 30 | + nodeSelector: |
| 31 | +{{ toYaml .Values.data.nodeSelector | indent 8 }} |
| 32 | +{{- end }} |
| 33 | +{{- if .Values.elasticsearch.tolerations }} |
| 34 | + tolerations: |
| 35 | +{{ toYaml .Values.elasticsearch.tolerations | indent 8 }} |
| 36 | +{{- end }} |
| 37 | + initContainers: |
| 38 | + - name: set-vm-max-map-count |
| 39 | + image: quay.io/giantswarm/busybox:1.28.3 |
| 40 | + imagePullPolicy: IfNotPresent |
| 41 | + command: ['sysctl', '-w', 'vm.max_map_count=262144'] |
| 42 | + securityContext: |
| 43 | + privileged: true |
| 44 | + {{- if .Values.elasticsearch.persistence.enabled }} |
| 45 | + - name: volume-mount-hack |
| 46 | + image: quay.io/giantswarm/busybox:1.28.3 |
| 47 | + imagePullPolicy: IfNotPresent |
| 48 | + command: ["sh", "-c", "chown -R 1000:1000 /usr/share/elasticsearch/data"] |
| 49 | + volumeMounts: |
| 50 | + - name: elasticsearch-data |
| 51 | + mountPath: /usr/share/elasticsearch/data |
| 52 | + {{- end }} |
| 53 | + serviceAccountName: elasticsearch |
| 54 | + containers: |
| 55 | + - name: elasticsearch |
| 56 | + image: "{{ .Values.elasticsearch.image.repository }}:{{ .Values.elasticsearch.image.tag }}" |
| 57 | + imagePullPolicy: {{ .Values.elasticsearch.image.pullPolicy | quote }} |
| 58 | + env: |
| 59 | + - name: ES_JAVA_OPTS |
| 60 | + value: "-Djava.net.preferIPv4Stack=true -Xms4g -Xmx4g" |
| 61 | + ports: |
| 62 | + - containerPort: 9200 |
| 63 | + livenessProbe: |
| 64 | + httpGet: |
| 65 | + path: /_cluster/health?local=true |
| 66 | + port: 9200 |
| 67 | + initialDelaySeconds: 60 |
| 68 | + readinessProbe: |
| 69 | + httpGet: |
| 70 | + path: /_cluster/health?local=true |
| 71 | + port: 9200 |
| 72 | + initialDelaySeconds: 30 |
| 73 | + resources: |
| 74 | +{{ toYaml .Values.elasticsearch.resources | indent 12 }} |
| 75 | + volumeMounts: |
| 76 | + - name: config |
| 77 | + mountPath: /usr/share/elasticsearch/elasticsearch.yml |
| 78 | + subPath: elasticsearch.yml |
| 79 | + - name: elasticsearch-data |
| 80 | + mountPath: /usr/share/elasticsearch/data |
| 81 | + restartPolicy: Always |
| 82 | + volumes: |
| 83 | + - name: config |
| 84 | + configMap: |
| 85 | + name: elasticsearch |
| 86 | + - name: elasticsearch-data |
| 87 | + {{- if .Values.elasticsearch.persistence.enabled }} |
| 88 | + persistentVolumeClaim: |
| 89 | + claimName: {{ .Values.elasticsearch.persistence.pvcName | quote }} |
| 90 | + {{- else }} |
| 91 | + emptyDir: {} |
| 92 | + {{- end }} |
0 commit comments