charts/ozone/templates/s3g/s3g-statefulset.yaml (120 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.s3g.env }}
{{- $envFrom := concat .Values.envFrom .Values.s3g.envFrom }}
{{- $nodeSelector := or .Values.s3g.nodeSelector .Values.nodeSelector }}
{{- $affinity := or .Values.s3g.affinity .Values.affinity }}
{{- $tolerations := or .Values.s3g.tolerations .Values.tolerations }}
{{- $securityContext := or .Values.s3g.securityContext .Values.securityContext }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Release.Name }}-s3g
labels:
{{- include "ozone.labels" . | nindent 4 }}
app.kubernetes.io/component: s3g
spec:
replicas: {{ .Values.s3g.replicas }}
serviceName: {{ .Release.Name }}-s3g-headless
selector:
matchLabels:
{{- include "ozone.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: s3g
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/ozone-configmap.yaml") . | sha256sum }}
labels:
{{- include "ozone.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: s3g
spec:
containers:
- name: s3g
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.s3g.command }}
command: {{- tpl (toYaml .) $ | nindent 12 }}
{{- end }}
{{- with .Values.s3g.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: rest
containerPort: {{ .Values.s3g.service.port }}
livenessProbe:
httpGet:
path: /
port: rest
initialDelaySeconds: 30
{{- with .Values.s3g.resources }}
resources: {{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: config
mountPath: {{ .Values.configuration.dir }}
- name: {{ .Release.Name }}-s3g
mountPath: {{ .Values.s3g.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.s3g.persistence.enabled }}
- name: {{ .Release.Name }}-s3g
emptyDir: {}
{{- end }}
{{- if .Values.s3g.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: {{ .Release.Name }}-s3g
labels:
{{- include "ozone.labels" . | nindent 10 }}
app.kubernetes.io/component: s3g
spec:
{{- with .Values.s3g.persistence.accessModes }}
accessModes: {{- toYaml . | nindent 10 }}
{{- end }}
resources:
requests:
storage: {{ .Values.s3g.persistence.size }}
{{- with .Values.scm.persistence.storageClassName }}
storageClassName: {{ . }}
{{- end }}
{{- end }}