# # 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. # apiVersion: apps/v1 kind: StatefulSet metadata: name: celeborn-master labels: helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/role: master {{- include "celeborn.labels" . | nindent 4 }} spec: selector: matchLabels: app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/role: master {{- include "celeborn.selectorLabels" . | nindent 6 }} serviceName: celeborn-master-svc replicas: {{ .Values.masterReplicas }} template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/role: master app.kubernetes.io/tag: {{ .Values.image.tag }} {{- include "celeborn.selectorLabels" . | nindent 8 }} spec: {{- with .Values.affinity.master }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.securityContext }} securityContext: {{- toYaml . | nindent 8 }} {{- end }} {{- if .Values.volumeUser }} {{- $userId := .Values.volumeUser }} {{- $userGroup := .Values.volumeGroup }} {{- $serverDir := get .Values.celeborn "celeborn.ha.master.ratis.raft.server.storage.dir" }} initContainers: - name: volume-permission image: public.ecr.aws/docker/library/busybox # grant volume access to hadoop user command: ['sh', '-c', 'mkdir {{ $serverDir }};chown -R {{ $userId}}:{{ $userGroup }} {{ $serverDir }}'] volumeMounts: - name: {{ include "celeborn.fullname" . }}-master-ratis mountPath: {{ $serverDir }} {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy | default "IfNotPresent"}} command: - "/usr/bin/tini" - "--" - "/bin/sh" - '-c' {{- $namespace := .Release.Namespace }} - "until {{ range until (.Values.masterReplicas |int) }}nslookup celeborn-master-{{ . }}.celeborn-master-svc.{{ $namespace }}.svc.{{ $.Values.cluster.name }}.local && {{ end }}true; do echo waiting for master; sleep 2; done && exec /opt/celeborn/sbin/start-master.sh" resources: {{- toYaml .Values.resources.master | nindent 12 }} ports: - containerPort: {{ .Values.service.port }} - containerPort: {{ get .Values.celeborn "celeborn.master.metrics.prometheus.port" | default 9098 }} name: metrics protocol: TCP volumeMounts: - mountPath: /opt/celeborn/conf name: {{ include "celeborn.fullname" . }}-volume readOnly: true - name: {{ include "celeborn.fullname" . }}-master-ratis mountPath: {{get .Values.celeborn "celeborn.ha.master.ratis.raft.server.storage.dir"}} env: {{- range $key, $val := .Values.environments }} - name: {{ $key }} value: {{ $val | quote }} {{- end}} terminationGracePeriodSeconds: 30 volumes: - configMap: name: {{ .Values.configmap }} name: {{ include "celeborn.fullname" . }}-volume {{- $vols := get .Values.celeborn "celeborn.volumes.hostpath" | splitList ","}} - hostPath: path: {{ index $vols 0 }}/ratis type: DirectoryOrCreate name: {{ include "celeborn.fullname" . }}-master-ratis