apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ include "databasus.fullname" . }} namespace: {{ include "databasus.namespace" . }} labels: {{- include "databasus.labels" . | nindent 4 }} spec: serviceName: {{ include "databasus.fullname" . }}-headless replicas: {{ .Values.replicaCount }} selector: matchLabels: {{- include "databasus.selectorLabels" . | nindent 6 }} template: metadata: annotations: {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "databasus.selectorLabels" . | nindent 8 }} {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: serviceAccountName: {{ include "databasus.serviceAccountName" . }} automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.podSecurityContext }} securityContext: {{- toYaml . | nindent 8 }} {{- end }} containers: - name: {{ .Chart.Name }} {{- if .Values.image.digest }} image: "{{ .Values.image.repository }}@{{ .Values.image.digest }}" {{- else }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" {{- end }} imagePullPolicy: {{ .Values.image.pullPolicy }} {{- with .Values.securityContext }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} {{- if or .Values.customRootCA .Values.extraEnv }} env: {{- if .Values.customRootCA }} - name: SSL_CERT_FILE value: /etc/ssl/certs/custom-root-ca.crt {{- end }} {{- with .Values.extraEnv }} {{- toYaml . | nindent 12 }} {{- end }} {{- end }} {{- with .Values.extraEnvFrom }} envFrom: {{- toYaml . | nindent 12 }} {{- end }} ports: - name: http containerPort: {{ .Values.service.targetPort }} protocol: TCP volumeMounts: - name: databasus-storage mountPath: {{ .Values.persistence.mountPath }} {{- if .Values.customRootCA }} - name: custom-root-ca mountPath: /etc/ssl/certs/custom-root-ca.crt subPath: ca.crt readOnly: true {{- end }} {{- with .Values.extraVolumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- if .Values.livenessProbe.enabled }} livenessProbe: httpGet: {{- toYaml .Values.livenessProbe.httpGet | nindent 14 }} initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.livenessProbe.periodSeconds }} timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} failureThreshold: {{ .Values.livenessProbe.failureThreshold }} {{- end }} {{- if .Values.readinessProbe.enabled }} readinessProbe: httpGet: {{- toYaml .Values.readinessProbe.httpGet | nindent 14 }} initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.readinessProbe.periodSeconds }} timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} failureThreshold: {{ .Values.readinessProbe.failureThreshold }} {{- end }} {{- if or .Values.customRootCA .Values.extraVolumes }} volumes: {{- if .Values.customRootCA }} - name: custom-root-ca secret: secretName: {{ .Values.customRootCA }} {{- end }} {{- with .Values.extraVolumes }} {{- toYaml . | nindent 8 }} {{- end }} {{- end }} {{- if .Values.persistence.enabled }} volumeClaimTemplates: - metadata: name: databasus-storage {{- with .Values.persistence.annotations }} annotations: {{- toYaml . | nindent 10 }} {{- end }} spec: accessModes: - {{ .Values.persistence.accessMode }} {{- if .Values.persistence.storageClassName }} storageClassName: {{ .Values.persistence.storageClassName }} {{- end }} resources: requests: storage: {{ .Values.persistence.size }} {{- end }} updateStrategy: {{- toYaml .Values.updateStrategy | nindent 4 }}