github.com/microsoft/fabrikate@v1.0.0-alpha.1.0.20210115014322-dc09194d0885/testdata/generate/infra/fabrikate-jaeger/helm_repos/jaeger/charts/elasticsearch/templates/client-deployment.yaml (about) 1 apiVersion: apps/v1 2 kind: Deployment 3 metadata: 4 labels: 5 app: {{ template "elasticsearch.name" . }} 6 chart: {{ .Chart.Name }}-{{ .Chart.Version }} 7 component: "{{ .Values.client.name }}" 8 heritage: {{ .Release.Service }} 9 release: {{ .Release.Name }} 10 name: {{ template "elasticsearch.client.fullname" . }} 11 spec: 12 selector: 13 matchLabels: 14 app: {{ template "elasticsearch.name" . }} 15 component: "{{ .Values.client.name }}" 16 release: {{ .Release.Name }} 17 replicas: {{ .Values.client.replicas }} 18 template: 19 metadata: 20 labels: 21 app: {{ template "elasticsearch.name" . }} 22 component: "{{ .Values.client.name }}" 23 release: {{ .Release.Name }} 24 annotations: 25 checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} 26 {{- if .Values.client.podAnnotations }} 27 {{ toYaml .Values.client.podAnnotations | indent 8 }} 28 {{- end }} 29 spec: 30 serviceAccountName: {{ template "elasticsearch.serviceAccountName.client" . }} 31 {{- if .Values.client.priorityClassName }} 32 priorityClassName: "{{ .Values.client.priorityClassName }}" 33 {{- end }} 34 securityContext: 35 fsGroup: 1000 36 {{- if or .Values.client.antiAffinity .Values.client.nodeAffinity }} 37 affinity: 38 {{- end }} 39 {{- if eq .Values.client.antiAffinity "hard" }} 40 podAntiAffinity: 41 requiredDuringSchedulingIgnoredDuringExecution: 42 - topologyKey: "kubernetes.io/hostname" 43 labelSelector: 44 matchLabels: 45 app: "{{ template "elasticsearch.name" . }}" 46 release: "{{ .Release.Name }}" 47 component: "{{ .Values.client.name }}" 48 {{- else if eq .Values.client.antiAffinity "soft" }} 49 podAntiAffinity: 50 preferredDuringSchedulingIgnoredDuringExecution: 51 - weight: 1 52 podAffinityTerm: 53 topologyKey: kubernetes.io/hostname 54 labelSelector: 55 matchLabels: 56 app: "{{ template "elasticsearch.name" . }}" 57 release: "{{ .Release.Name }}" 58 component: "{{ .Values.client.name }}" 59 {{- end }} 60 {{- with .Values.client.nodeAffinity }} 61 nodeAffinity: 62 {{ toYaml . | indent 10 }} 63 {{- end }} 64 {{- if .Values.client.nodeSelector }} 65 nodeSelector: 66 {{ toYaml .Values.client.nodeSelector | indent 8 }} 67 {{- end }} 68 {{- if .Values.client.tolerations }} 69 tolerations: 70 {{ toYaml .Values.client.tolerations | indent 8 }} 71 {{- end }} 72 {{- if .Values.client.terminationGracePeriodSeconds }} 73 terminationGracePeriodSeconds: {{ .Values.client.terminationGracePeriodSeconds }} 74 {{- end }} 75 {{- if or .Values.extraInitContainers .Values.sysctlInitContainer.enabled .Values.cluster.plugins }} 76 initContainers: 77 {{- if .Values.sysctlInitContainer.enabled }} 78 # see https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html 79 # and https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration-memory.html#mlockall 80 - name: "sysctl" 81 image: "{{ .Values.initImage.repository }}:{{ .Values.initImage.tag }}" 82 imagePullPolicy: {{ .Values.initImage.pullPolicy | quote }} 83 resources: 84 {{ toYaml .Values.client.initResources | indent 12 }} 85 command: ["sysctl", "-w", "vm.max_map_count=262144"] 86 securityContext: 87 privileged: true 88 {{- end }} 89 {{- if .Values.extraInitContainers }} 90 {{ tpl .Values.extraInitContainers . | indent 6 }} 91 {{- end }} 92 {{- if .Values.cluster.plugins }} 93 {{ include "plugin-installer" . | indent 6 }} 94 {{- end }} 95 {{- end }} 96 containers: 97 - name: elasticsearch 98 env: 99 - name: NODE_DATA 100 value: "false" 101 {{- if hasPrefix "5." .Values.appVersion }} 102 - name: NODE_INGEST 103 value: "false" 104 {{- end }} 105 - name: NODE_MASTER 106 value: "false" 107 - name: DISCOVERY_SERVICE 108 value: {{ template "elasticsearch.fullname" . }}-discovery 109 - name: PROCESSORS 110 valueFrom: 111 resourceFieldRef: 112 resource: limits.cpu 113 - name: ES_JAVA_OPTS 114 value: "-Djava.net.preferIPv4Stack=true -Xms{{ .Values.client.heapSize }} -Xmx{{ .Values.client.heapSize }} {{ .Values.cluster.additionalJavaOpts }} {{ .Values.client.additionalJavaOpts }}" 115 {{- range $key, $value := .Values.cluster.env }} 116 - name: {{ $key }} 117 value: {{ $value | quote }} 118 {{- end }} 119 resources: 120 {{ toYaml .Values.client.resources | indent 12 }} 121 readinessProbe: 122 httpGet: 123 path: /_cluster/health 124 port: 9200 125 initialDelaySeconds: 5 126 livenessProbe: 127 httpGet: 128 path: /_cluster/health?local=true 129 port: 9200 130 initialDelaySeconds: 90 131 image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" 132 imagePullPolicy: {{ .Values.image.pullPolicy | quote }} 133 {{- if .Values.securityContext.enabled }} 134 securityContext: 135 runAsUser: {{ .Values.securityContext.runAsUser }} 136 {{- end }} 137 ports: 138 - containerPort: 9200 139 name: http 140 - containerPort: 9300 141 name: transport 142 volumeMounts: 143 - mountPath: /usr/share/elasticsearch/config/elasticsearch.yml 144 name: config 145 subPath: elasticsearch.yml 146 {{- if .Values.cluster.plugins }} 147 - mountPath: /usr/share/elasticsearch/plugins/ 148 name: plugindir 149 {{- end }} 150 {{- if hasPrefix "2." .Values.appVersion }} 151 - mountPath: /usr/share/elasticsearch/config/logging.yml 152 name: config 153 subPath: logging.yml 154 {{- end }} 155 {{- if hasPrefix "5." .Values.appVersion }} 156 - mountPath: /usr/share/elasticsearch/config/log4j2.properties 157 name: config 158 subPath: log4j2.properties 159 {{- end }} 160 {{- if .Values.cluster.keystoreSecret }} 161 - name: keystore 162 mountPath: "/usr/share/elasticsearch/config/elasticsearch.keystore" 163 subPath: elasticsearch.keystore 164 readOnly: true 165 {{- end }} 166 {{- if .Values.client.hooks.preStop }} 167 - name: config 168 mountPath: /client-pre-stop-hook.sh 169 subPath: client-pre-stop-hook.sh 170 {{- end }} 171 {{- if .Values.client.hooks.postStart }} 172 - name: config 173 mountPath: /client-post-start-hook.sh 174 subPath: client-post-start-hook.sh 175 {{- end }} 176 {{- if or .Values.client.hooks.preStop .Values.client.hooks.postStart }} 177 lifecycle: 178 {{- if .Values.client.hooks.preStop }} 179 preStop: 180 exec: 181 command: ["/bin/bash","/client-pre-stop-hook.sh"] 182 {{- end }} 183 {{- if .Values.client.hooks.postStart }} 184 postStart: 185 exec: 186 command: ["/bin/bash","/client-post-start-hook.sh"] 187 {{- end }} 188 {{- end }} 189 {{- if .Values.image.pullSecrets }} 190 imagePullSecrets: 191 {{- range $pullSecret := .Values.image.pullSecrets }} 192 - name: {{ $pullSecret }} 193 {{- end }} 194 {{- end }} 195 volumes: 196 - name: config 197 configMap: 198 name: {{ template "elasticsearch.fullname" . }} 199 {{- if .Values.cluster.plugins }} 200 - name: plugindir 201 emptyDir: {} 202 {{- end }} 203 {{- if .Values.cluster.keystoreSecret }} 204 - name: keystore 205 secret: 206 secretName: {{ .Values.cluster.keystoreSecret }} 207 {{- end }}