{{- if eq .Values.database.type "internal" -}} {{- $database := .Values.persistence.persistentVolumeClaim.database -}} apiVersion: apps/v1 kind: StatefulSet metadata: name: "{{ template "harbor.database" . }}" labels: {{ include "harbor.labels" . | indent 4 }} app: database spec: replicas: 1 serviceName: "{{ template "harbor.database" . }}" selector: matchLabels: {{ include "harbor.matchLabels" . | indent 6 }} app: database template: metadata: labels: {{ include "harbor.labels" . | indent 8 }} app: database annotations: checksum/secret: {{ include (print $.Template.BasePath "/database/database-secret.yaml") . | sha256sum }} {{- if .Values.database.podAnnotations }} {{ toYaml .Values.database.podAnnotations | indent 8 }} {{- end }} spec: initContainers: - name: "remove-lost-found" image: {{ .Values.database.internal.image.repository }}:{{ .Values.database.internal.image.tag }} imagePullPolicy: {{ .Values.imagePullPolicy }} command: ["rm", "-Rf", "/var/lib/postgresql/data/lost+found"] volumeMounts: - name: database-data mountPath: /var/lib/postgresql/data containers: - name: database image: {{ .Values.database.internal.image.repository }}:{{ .Values.database.internal.image.tag }} imagePullPolicy: {{ .Values.imagePullPolicy }} livenessProbe: exec: command: - /docker-healthcheck.sh initialDelaySeconds: 1 periodSeconds: 10 readinessProbe: exec: command: - /docker-healthcheck.sh initialDelaySeconds: 1 periodSeconds: 10 {{- if .Values.database.internal.resources }} resources: {{ toYaml .Values.database.internal.resources | indent 10 }} {{- end }} envFrom: - secretRef: name: "{{ template "harbor.database" . }}" volumeMounts: - name: database-data mountPath: /var/lib/postgresql/data - name: etc-localtime mountPath: /etc/localtime volumes: - name: etc-localtime hostPath: path: /etc/localtime - name: "database-data" hostPath: path: /data/{{ .Release.Namespace }}/{{ .Release.Name }}/database {{- with .Values.database.internal.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} {{- end }} {{- with .Values.database.internal.affinity }} affinity: {{ toYaml . | indent 8 }} {{- end }} {{- with .Values.database.internal.tolerations }} tolerations: {{ toYaml . | indent 8 }} {{- end }} {{- end -}}