{{- if and .Values.initPassword.enabled .Values.initPassword.isInstall .Release.IsInstall }} apiVersion: batch/v1 kind: Job metadata: name: {{ template "starrockscluster.name" . }}-initpwd namespace: {{ template "starrockscluster.namespace" . }} labels: cluster: {{ template "starrockscluster.name" . }} {{- if .Values.initPassword.annotations }} annotations: {{- toYaml .Values.initPassword.annotations | nindent 4 }} {{- end }} spec: template: {{- if .Values.initPassword.podAnnotations }} metadata: annotations: {{- toYaml .Values.initPassword.podAnnotations | nindent 8 }} {{- end }} spec: {{- if or .Values.starrocksFESpec.imagePullSecrets .Values.starrocksCluster.componentValues.imagePullSecrets }} imagePullSecrets: {{- include "starrockscluster.fe.imagePullSecrets" . | nindent 6 }} {{- end }} {{- if or .Values.starrocksFESpec.affinity .Values.starrocksCluster.componentValues.affinity }} affinity: {{- include "starrockscluster.fe.affinity" . | nindent 8 }} {{- end }} {{- if or .Values.starrocksFESpec.tolerations .Values.starrocksCluster.componentValues.tolerations }} tolerations: {{- include "starrockscluster.fe.tolerations" . | nindent 8 }} {{- end }} containers: - name: {{ template "starrockscluster.name" . }}-initpwd {{- if .Values.initPassword.image }} image: {{ .Values.initPassword.image }} {{- else }} image: {{ .Values.starrocksFESpec.image.repository }}:{{ include "starrockscluster.fe.image.tag" . }} {{- end }} imagePullPolicy: IfNotPresent {{- if .Values.initPassword.resources }} resources: {{- toYaml .Values.initPassword.resources | nindent 10 }} {{- end }} command: - /bin/bash args: - /opt/starrocks/fe_initpwd.sh - {{ template "starrockscluster.name" . }}-fe-0.{{ template "starrockscluster.name" . }}-fe-search - "{{- default 9030 (include "starrockscluster.fe.query.port" .) }}" env: - name: INIT_PWD valueFrom: secretKeyRef: key: password name: {{ template "starrockscluster.initpassword.secret.name" . }} volumeMounts: - mountPath: /opt/starrocks/fe_initpwd.sh name: {{ template "starrockscluster.name" . }}-initpwd-shell subPath: fe_initpwd.sh volumes: - configMap: defaultMode: 420 items: - key: fe_initpwd.sh path: fe_initpwd.sh name: {{ template "starrockscluster.name" . }}-initpwd-shell optional: false name: {{ template "starrockscluster.name" . }}-initpwd-shell restartPolicy: OnFailure backoffLimit: 10 {{- end }}