charts/ozone/templates/scm/scm-statefulset.yaml (141 lines of code) (raw):

{{/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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. */}} {{- $env := concat .Values.env .Values.scm.env }} {{- $envFrom := concat .Values.envFrom .Values.scm.envFrom }} {{- $nodeSelector := or .Values.scm.nodeSelector .Values.nodeSelector }} {{- $affinity := or .Values.scm.affinity .Values.affinity }} {{- $tolerations := or .Values.scm.tolerations .Values.tolerations }} {{- $securityContext := or .Values.scm.securityContext .Values.securityContext }} apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ .Release.Name }}-scm labels: {{- include "ozone.labels" . | nindent 4 }} app.kubernetes.io/component: scm spec: replicas: {{ .Values.scm.replicas }} serviceName: {{ .Release.Name }}-scm-headless selector: matchLabels: {{- include "ozone.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: scm template: metadata: annotations: checksum/config: {{ include (print $.Template.BasePath "/ozone-configmap.yaml") . | sha256sum }} labels: {{- include "ozone.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: scm spec: initContainers: - name: init image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" args: ["ozone", "scm", "--init"] env: {{- include "ozone.configuration.env" . | nindent 12 }} {{- with $env }} {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} {{- with $envFrom }} envFrom: {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} volumeMounts: - name: config mountPath: {{ .Values.configuration.dir }} - name: {{ .Release.Name }}-scm mountPath: {{ .Values.scm.persistence.path }} containers: - name: scm image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} {{- with .Values.scm.command }} command: {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} {{- with .Values.scm.args }} args: {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} env: {{- include "ozone.configuration.env" . | nindent 12 }} {{- with $env }} {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} {{- with $envFrom }} envFrom: {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} ports: - name: rpc-client containerPort: 9860 - name: rpc-datanode containerPort: 9861 - name: ui containerPort: {{ .Values.scm.service.port }} livenessProbe: httpGet: path: / port: ui initialDelaySeconds: 30 {{- with .Values.scm.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} volumeMounts: - name: config mountPath: {{ .Values.configuration.dir }} - name: {{ .Release.Name }}-scm mountPath: {{ .Values.scm.persistence.path }} {{- with $nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with $affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with $tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- with $securityContext }} securityContext: {{- toYaml . | nindent 8 }} {{- end }} volumes: - name: config projected: sources: - configMap: name: {{ .Release.Name }}-ozone {{- with .Values.configuration.filesFrom }} {{- tpl (toYaml .) $ | nindent 14 }} {{- end }} {{- if not .Values.scm.persistence.enabled }} - name: {{ .Release.Name }}-scm emptyDir: {} {{- end }} {{- if .Values.scm.persistence.enabled }} volumeClaimTemplates: - metadata: name: {{ .Release.Name }}-scm labels: {{- include "ozone.labels" . | nindent 10 }} app.kubernetes.io/component: scm spec: {{- with .Values.scm.persistence.accessModes }} accessModes: {{- toYaml . | nindent 10 }} {{- end }} resources: requests: storage: {{ .Values.scm.persistence.size }} {{- with .Values.scm.persistence.storageClassName }} storageClassName: {{ . }} {{- end }} {{- end }}