Files
helm-charts/calibre-web-automated/templates/calibre-web-automated.sfs.yaml
T
jklein f6de7ffa80 Calibre-Web-Automated chart: naming scheme, security hardening (conventions batch 3)
All audit findings for the calibre-web-automated chart (#32) in one major
bump, 3.1.1+upv4.0.6 -> 4.0.0+upv4.0.6:

- Rename StatefulSet, Service, OnePasswordItem secret and Ingress from the
  inverted <chart>-<release>-cwa-<kind> scheme to
  <release>-<chart>-<kind>; spec.serviceName and all references follow.
  Both PVCs deliberately keep their historical names (documented naming
  exception; renaming would orphan the data).
- TLS secret renamed to the standard tls-<release>-<chart>-ingress.
- Ingress on the repo standard: ingress.className (default nginx),
  ingress.annotations merged with the chart-managed annotations,
  ingress.clusterIssuer now required (was silently defaulted to
  "letsencrypt-issuer").
- Security hardening, values-configurable via securityContext.pod /
  securityContext.container: allowPrivilegeEscalation false, all
  capabilities dropped except the minimal set the s6-overlay init needs
  (CHOWN, DAC_OVERRIDE, FOWNER, KILL, SETGID, SETUID). Documented
  deviations: the image must start as root (s6 drops to PUID 1000) and
  readOnlyRootFilesystem stays false (read-only mode disables PUID/PGID
  remapping upstream and breaks the ImageMagick policy setup).
- Additive env value rendered through tpl (value / secretKeyRef /
  configMapKeyRef forms).
- CI fixtures: secret renamed to the new scheme, clusterIssuer added to
  test-values.

Part of #32.
2026-08-22 18:46:07 +02:00

109 lines
4.2 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
spec:
serviceName: {{ .Release.Name }}-{{ .Chart.Name }}-service
replicas: {{ include "calibre-web-automated.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.cwa.replicas) }}
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.cwa.securityContext.pod | nindent 8 }}
containers:
- name: {{ .Release.Name }}-{{ .Chart.Name }}-container
image: "ghcr.io/crocodilestick/calibre-web-automated:{{ .Chart.AppVersion }}"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8083
name: http
protocol: TCP
env:
- name: TZ
value: "{{ .Values.cwa.timezone }}"
- name: PUID
value: "1000"
- name: PGID
value: "1000"
- name: HARDCOVER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-secret
key: hardcover-api-token
- name: CALIBRE_CONFIG_DIR
value: "/config/.config/calibre"
- name: NETWORK_SHARE_MODE
value: "false"
{{- range $value := .Values.cwa.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 }}
volumeMounts:
- mountPath: "/config"
name: cwa
subPath: config/
- mountPath: "/calibre-library"
name: cwa
subPath: calibre-library/
- mountPath: "/config/.config/calibre/plugins"
name: cwa
subPath: calibre-plugins/
- mountPath: "/config/.config/calibre/customize.py.json"
name: cwa-plugins-config
subPath: customize.py.json
- mountPath: "/cwa-book-ingest"
name: cwa-consume
livenessProbe:
{{- toYaml .Values.cwa.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.cwa.readinessProbe | nindent 12 }}
startupProbe:
{{- toYaml .Values.cwa.startupProbe | nindent 12 }}
resources:
{{- include "calibre-web-automated.resources" .Values.cwa.resources | nindent 12 }}
securityContext:
{{- toYaml .Values.cwa.securityContext.container | nindent 12 }}
restartPolicy: Always
volumes:
# Deliberate naming exception (see README): both PVCs keep their
# historical <chart>-<release>-cwa-* names — renaming a PVC would
# provision a new, empty volume and orphan the existing data.
- name: cwa
persistentVolumeClaim:
claimName: {{ .Chart.Name }}-{{ .Release.Name }}-cwa-pvc
- name: cwa-consume
persistentVolumeClaim:
claimName: {{ .Chart.Name }}-{{ .Release.Name }}-cwa-consume-pvc
- name: cwa-plugins-config
secret:
secretName: {{ .Release.Name }}-{{ .Chart.Name }}-secret
items:
- key: calibre-plugins
path: customize.py.json
mode: 0644