Every Deployment/StatefulSet now takes its replica count from a replicas value (default 1, explicit 0 allowed) via a new per-chart <chart>.replicas helper; the helper uses a kindIs "invalid" nil check so an explicit 0 is not swallowed by Helm's default function. A chart-global scaleDown flag (default false) takes precedence: it renders every workload with replicas: 0 and suspends the paperless-ngx consume CronJob, stopping the app without uninstalling it (PVCs, Secrets, Services and Ingress remain). Defaults leave the rendered manifests byte-identical to main, so all published charts get a minor version bump; the template-chart carries the reference helper implementation and stays unversioned. Fixes #25
133 lines
5.4 KiB
YAML
133 lines
5.4 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
labels:
|
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
spec:
|
|
replicas: {{ include "voucher-vault.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.voucherVault.replicas) }}
|
|
serviceName: {{ .Release.Name }}-{{ .Chart.Name }}-service
|
|
selector:
|
|
matchLabels:
|
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
template:
|
|
metadata:
|
|
name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
labels:
|
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
spec:
|
|
automountServiceAccountToken: false
|
|
securityContext:
|
|
{{- toYaml .Values.voucherVault.securityContext.pod | nindent 8 }}
|
|
containers:
|
|
- name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
image: "l4rm4nd/vouchervault:{{ .Chart.AppVersion }}"
|
|
imagePullPolicy: IfNotPresent
|
|
env:
|
|
{{- range $value := .Values.voucherVault.env }}
|
|
{{- if $value.value }}
|
|
- name: {{ $value.name | quote }}
|
|
value: {{ tpl $value.value $ | quote }}
|
|
{{- else if $value.valueFrom }}
|
|
{{- if $value.valueFrom.secretKeyRef }}
|
|
- name: {{ $value.name }}
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ tpl $value.valueFrom.secretKeyRef.name $ | quote }}
|
|
key: {{ tpl $value.valueFrom.secretKeyRef.key $ | quote }}
|
|
{{- else if $value.valueFrom.configMapKeyRef }}
|
|
- name: {{ $value.name }}
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: {{ tpl $value.valueFrom.configMapKeyRef.name $ | quote }}
|
|
key: {{ tpl $value.valueFrom.configMapKeyRef.key $ | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
ports:
|
|
{{- toYaml .Values.voucherVault.ports | nindent 12 }}
|
|
{{- if .Values.voucherVault.livenessProbe }}
|
|
livenessProbe:
|
|
{{- toYaml .Values.voucherVault.livenessProbe | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.voucherVault.readinessProbe }}
|
|
readinessProbe:
|
|
{{- toYaml .Values.voucherVault.readinessProbe | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.voucherVault.startupProbe }}
|
|
startupProbe:
|
|
{{- toYaml .Values.voucherVault.startupProbe | nindent 12 }}
|
|
{{- end }}
|
|
resources:
|
|
{{- include "voucher-vault.resources" .Values.voucherVault.resources | nindent 12 }}
|
|
securityContext:
|
|
{{- toYaml .Values.voucherVault.securityContext.container | nindent 12 }}
|
|
volumeMounts:
|
|
{{- if .Values.voucherVault.storage.volumeMounts }}
|
|
{{- range $value := .Values.voucherVault.storage.volumeMounts }}
|
|
- name: {{ tpl $value.name $ | quote }}
|
|
mountPath: {{ tpl $value.mountPath $ | quote }}
|
|
{{- if $value.subPath }}
|
|
subPath: {{ tpl $value.subPath $ | quote }}
|
|
{{- end }}
|
|
{{- if $value.subPathExpr }}
|
|
subPathExpr: {{ tpl $value.subPathExpr $ | quote }}
|
|
{{- end }}
|
|
{{- if $value.readOnly }}
|
|
readOnly: {{ tpl $value.readOnly $ | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- else }}
|
|
[]
|
|
{{- end }}
|
|
restartPolicy: Always
|
|
volumes:
|
|
{{- if .Values.voucherVault.storage.volumes }}
|
|
{{- range $value := .Values.voucherVault.storage.volumes }}
|
|
- name: {{ tpl $value.name $ | quote }}
|
|
{{- if $value.persistentVolumeClaim }}
|
|
persistentVolumeClaim:
|
|
claimName: {{ tpl $value.persistentVolumeClaim.claimName $ | quote }}
|
|
{{- if $value.persistentVolumeClaim.readOnly }}
|
|
readOnly: {{ tpl $value.persistentVolumeClaim.readOnly $ | quote }}
|
|
{{- end }}
|
|
{{- else if $value.configMap }}
|
|
configMap:
|
|
name: {{ tpl $value.configMap.name $ | quote }}
|
|
{{- if $value.configMap.defaultMode }}
|
|
defaultMode: {{ tpl $value.configMap.defaultMode $ | quote }}
|
|
{{- end }}
|
|
{{- else if $value.secret }}
|
|
secret:
|
|
secretName: {{ tpl $value.secret.secretName $ | quote }}
|
|
{{- if $value.secret.defaultMode }}
|
|
defaultMode: {{ tpl $value.secret.defaultMode $ | quote }}
|
|
{{- end }}
|
|
{{- if $value.secret.optional }}
|
|
optional: {{ tpl $value.secret.optional $ | quote }}
|
|
{{- end }}
|
|
{{- if $value.secret.items }}
|
|
items:
|
|
{{ range $item := $value.secret.items }}
|
|
- key: {{ tpl $item.key $ | quote }}
|
|
{{- if $item.path }}
|
|
path: {{ tpl $item.path $ | quote }}
|
|
{{- end }}
|
|
{{- if $item.mode }}
|
|
mode: {{ tpl $item.mode $ | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- else if $value.emptyDir }}
|
|
emptyDir:
|
|
{{- if $value.emptyDir.medium }}
|
|
medium: {{ tpl $value.emptyDir.medium $ | quote }}
|
|
{{- end }}
|
|
{{- if $value.emptyDir.sizeLimit }}
|
|
sizeLimit: {{ tpl $value.emptyDir.sizeLimit $ | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- else }}
|
|
[]
|
|
{{- end }} |