github.com/microsoft/fabrikate@v1.0.0-alpha.1.0.20210115014322-dc09194d0885/testdata/generate/infra/fabrikate-jaeger/helm_repos/jaeger/charts/elasticsearch/templates/master-statefulset.yaml (about) 1 apiVersion: apps/v1 2 kind: StatefulSet 3 metadata: 4 labels: 5 app: {{ template "elasticsearch.name" . }} 6 chart: {{ .Chart.Name }}-{{ .Chart.Version }} 7 component: "{{ .Values.master.name }}" 8 heritage: {{ .Release.Service }} 9 release: {{ .Release.Name }} 10 name: {{ template "elasticsearch.master.fullname" . }} 11 spec: 12 selector: 13 matchLabels: 14 app: {{ template "elasticsearch.name" . }} 15 component: "{{ .Values.master.name }}" 16 release: {{ .Release.Name }} 17 role: master 18 serviceName: {{ template "elasticsearch.master.fullname" . }} 19 replicas: {{ .Values.master.replicas }} 20 template: 21 metadata: 22 labels: 23 app: {{ template "elasticsearch.name" . }} 24 component: "{{ .Values.master.name }}" 25 release: {{ .Release.Name }} 26 role: master 27 {{- if or .Values.master.podAnnotations (eq .Values.master.updateStrategy.type "RollingUpdate") }} 28 annotations: 29 {{- if .Values.master.podAnnotations }} 30 {{ toYaml .Values.master.podAnnotations | indent 8 }} 31 {{- end }} 32 {{- if eq .Values.master.updateStrategy.type "RollingUpdate" }} 33 checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} 34 {{- end }} 35 {{- end }} 36 spec: 37 {{- if .Values.schedulerName }} 38 schedulerName: "{{ .Values.schedulerName }}" 39 {{- end }} 40 serviceAccountName: {{ template "elasticsearch.serviceAccountName.master" . }} 41 {{- if .Values.master.priorityClassName }} 42 priorityClassName: "{{ .Values.master.priorityClassName }}" 43 {{- end }} 44 securityContext: 45 fsGroup: 1000 46 {{- if or .Values.master.antiAffinity .Values.master.nodeAffinity }} 47 affinity: 48 {{- end }} 49 {{- if eq .Values.master.antiAffinity "hard" }} 50 podAntiAffinity: 51 requiredDuringSchedulingIgnoredDuringExecution: 52 - topologyKey: "kubernetes.io/hostname" 53 labelSelector: 54 matchLabels: 55 app: "{{ template "elasticsearch.name" . }}" 56 release: "{{ .Release.Name }}" 57 component: "{{ .Values.master.name }}" 58 {{- else if eq .Values.master.antiAffinity "soft" }} 59 podAntiAffinity: 60 preferredDuringSchedulingIgnoredDuringExecution: 61 - weight: 1 62 podAffinityTerm: 63 topologyKey: kubernetes.io/hostname 64 labelSelector: 65 matchLabels: 66 app: "{{ template "elasticsearch.name" . }}" 67 release: "{{ .Release.Name }}" 68 component: "{{ .Values.master.name }}" 69 {{- end }} 70 {{- with .Values.master.nodeAffinity }} 71 nodeAffinity: 72 {{ toYaml . | indent 10 }} 73 {{- end }} 74 {{- if .Values.master.nodeSelector }} 75 nodeSelector: 76 {{ toYaml .Values.master.nodeSelector | indent 8 }} 77 {{- end }} 78 {{- if .Values.master.tolerations }} 79 tolerations: 80 {{ toYaml .Values.master.tolerations | indent 8 }} 81 {{- end }} 82 {{- if .Values.master.terminationGracePeriodSeconds }} 83 terminationGracePeriodSeconds: {{ .Values.master.terminationGracePeriodSeconds }} 84 {{- end }} 85 {{- if or .Values.extraInitContainers .Values.sysctlInitContainer.enabled .Values.chownInitContainer.enabled .Values.cluster.plugins }} 86 initContainers: 87 {{- end }} 88 {{- if .Values.sysctlInitContainer.enabled }} 89 # see https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html 90 # and https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration-memory.html#mlockall 91 - name: "sysctl" 92 image: "{{ .Values.initImage.repository }}:{{ .Values.initImage.tag }}" 93 imagePullPolicy: {{ .Values.initImage.pullPolicy | quote }} 94 resources: 95 {{ toYaml .Values.master.initResources | indent 12 }} 96 command: ["sysctl", "-w", "vm.max_map_count=262144"] 97 securityContext: 98 privileged: true 99 {{- end }} 100 {{- if .Values.chownInitContainer.enabled }} 101 - name: "chown" 102 image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" 103 imagePullPolicy: {{ .Values.image.pullPolicy | quote }} 104 resources: 105 {{ toYaml .Values.master.initResources | indent 12 }} 106 command: 107 - /bin/bash 108 - -c 109 - > 110 set -e; 111 set -x; 112 chown elasticsearch:elasticsearch /usr/share/elasticsearch/data; 113 for datadir in $(find /usr/share/elasticsearch/data -mindepth 1 -maxdepth 1 -not -name ".snapshot"); do 114 chown -R elasticsearch:elasticsearch $datadir; 115 done; 116 chown elasticsearch:elasticsearch /usr/share/elasticsearch/logs; 117 for logfile in $(find /usr/share/elasticsearch/logs -mindepth 1 -maxdepth 1 -not -name ".snapshot"); do 118 chown -R elasticsearch:elasticsearch $logfile; 119 done 120 securityContext: 121 runAsUser: 0 122 volumeMounts: 123 - mountPath: /usr/share/elasticsearch/data 124 name: data 125 {{- end }} 126 {{- if .Values.extraInitContainers }} 127 {{ tpl .Values.extraInitContainers . | indent 6 }} 128 {{- end }} 129 {{- if .Values.cluster.plugins }} 130 {{ include "plugin-installer" . | indent 6 }} 131 {{- end }} 132 containers: 133 - name: elasticsearch 134 env: 135 - name: NODE_DATA 136 value: "false" 137 {{- if hasPrefix "5." .Values.appVersion }} 138 - name: NODE_INGEST 139 value: "false" 140 {{- end }} 141 - name: DISCOVERY_SERVICE 142 value: {{ template "elasticsearch.fullname" . }}-discovery 143 - name: PROCESSORS 144 valueFrom: 145 resourceFieldRef: 146 resource: limits.cpu 147 - name: ES_JAVA_OPTS 148 value: "-Djava.net.preferIPv4Stack=true -Xms{{ .Values.master.heapSize }} -Xmx{{ .Values.master.heapSize }} {{ .Values.cluster.additionalJavaOpts }} {{ .Values.master.additionalJavaOpts }}" 149 {{- range $key, $value := .Values.cluster.env }} 150 - name: {{ $key }} 151 value: {{ $value | quote }} 152 {{- end }} 153 resources: 154 {{ toYaml .Values.master.resources | indent 12 }} 155 readinessProbe: 156 {{ toYaml .Values.master.readinessProbe | indent 10 }} 157 image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" 158 imagePullPolicy: {{ .Values.image.pullPolicy | quote }} 159 {{- if .Values.securityContext.enabled }} 160 securityContext: 161 runAsUser: {{ .Values.securityContext.runAsUser }} 162 {{- end }} 163 ports: 164 - containerPort: 9300 165 name: transport 166 {{ if .Values.master.exposeHttp }} 167 - containerPort: 9200 168 name: http 169 {{ end }} 170 volumeMounts: 171 - mountPath: /usr/share/elasticsearch/data 172 name: data 173 - mountPath: /usr/share/elasticsearch/config/elasticsearch.yml 174 name: config 175 subPath: elasticsearch.yml 176 {{- if .Values.cluster.plugins }} 177 - mountPath: /usr/share/elasticsearch/plugins/ 178 name: plugindir 179 {{- end }} 180 {{- if hasPrefix "2." .Values.appVersion }} 181 - mountPath: /usr/share/elasticsearch/config/logging.yml 182 name: config 183 subPath: logging.yml 184 {{- end }} 185 {{- if hasPrefix "5." .Values.appVersion }} 186 - mountPath: /usr/share/elasticsearch/config/log4j2.properties 187 name: config 188 subPath: log4j2.properties 189 {{- end }} 190 {{- if .Values.cluster.keystoreSecret }} 191 - name: keystore 192 mountPath: "/usr/share/elasticsearch/config/elasticsearch.keystore" 193 subPath: elasticsearch.keystore 194 readOnly: true 195 {{- end }} 196 {{- if .Values.master.hooks.preStop }} 197 - name: config 198 mountPath: /master-pre-stop-hook.sh 199 subPath: master-pre-stop-hook.sh 200 {{- end }} 201 {{- if .Values.master.hooks.postStart }} 202 - name: config 203 mountPath: /master-post-start-hook.sh 204 subPath: master-post-start-hook.sh 205 {{- end }} 206 {{- if or .Values.master.hooks.preStop .Values.master.hooks.postStart }} 207 lifecycle: 208 {{- if .Values.master.hooks.preStop }} 209 preStop: 210 exec: 211 command: ["/bin/bash","/master-pre-stop-hook.sh"] 212 {{- end }} 213 {{- if .Values.master.hooks.postStart }} 214 postStart: 215 exec: 216 command: ["/bin/bash","/master-post-start-hook.sh"] 217 {{- end }} 218 {{- end }} 219 {{- if .Values.image.pullSecrets }} 220 imagePullSecrets: 221 {{- range $pullSecret := .Values.image.pullSecrets }} 222 - name: {{ $pullSecret }} 223 {{- end }} 224 {{- end }} 225 volumes: 226 - name: config 227 configMap: 228 name: {{ template "elasticsearch.fullname" . }} 229 {{- if .Values.cluster.plugins }} 230 - name: plugindir 231 emptyDir: {} 232 {{- end }} 233 {{- if .Values.cluster.keystoreSecret }} 234 - name: keystore 235 secret: 236 secretName: {{ .Values.cluster.keystoreSecret }} 237 {{- end }} 238 {{- if not .Values.master.persistence.enabled }} 239 - name: data 240 emptyDir: {} 241 {{- end }} 242 podManagementPolicy: {{ .Values.master.podManagementPolicy }} 243 updateStrategy: 244 type: {{ .Values.master.updateStrategy.type }} 245 {{- if .Values.master.persistence.enabled }} 246 volumeClaimTemplates: 247 - metadata: 248 name: {{ .Values.master.persistence.name }} 249 spec: 250 accessModes: 251 - {{ .Values.master.persistence.accessMode | quote }} 252 {{- if .Values.master.persistence.storageClass }} 253 {{- if (eq "-" .Values.master.persistence.storageClass) }} 254 storageClassName: "" 255 {{- else }} 256 storageClassName: "{{ .Values.master.persistence.storageClass }}" 257 {{- end }} 258 {{- end }} 259 resources: 260 requests: 261 storage: "{{ .Values.master.persistence.size }}" 262 {{ end }}