apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ include "trilium.fullname" . }} labels: {{- include "trilium.labels" . | nindent 4 }} spec: serviceName: {{ template "trilium.fullname" . }}-headless replicas: {{ .Values.replicaCount }} selector: matchLabels: {{- include "trilium.selectorLabels" . | nindent 6 }} template: metadata: labels: {{- include "trilium.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "trilium.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: TRILIUM_DATA_DIR value: "{{ .Values.dataDir }}" {{- if not (empty .Values.trilium.extraEnv) }} {{- toYaml .Values.trilium.extraEnv | nindent 10 }} {{- end }} ports: - name: http containerPort: 8080 protocol: TCP livenessProbe: httpGet: path: / port: 8080 readinessProbe: httpGet: path: / port: 8080 resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: - name: trilium-data mountPath: "{{ .Values.dataDir }}" {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- if .Values.persistentVolume.enabled }} volumeClaimTemplates: - metadata: name: trilium-data {{- if .Values.persistentVolume.annotations }} annotations: {{ toYaml .Values.persistentVolume.annotations | indent 10 }} {{- end }} spec: accessModes: {{ toYaml .Values.persistentVolume.accessModes | indent 10 }} resources: requests: storage: "{{ .Values.persistentVolume.size }}" {{- if .Values.persistentVolume.storageClass }} {{- if (eq "-" .Values.persistentVolume.storageClass) }} storageClassName: "" {{- else }} storageClassName: "{{ .Values.persistentVolume.storageClass }}" {{- end }} {{- end }} {{- else }} volumes: - name: trilium-data emptyDir: {} {{- end }}