Files
helm-charts/gotenberg/templates/gotenberg.deployment.yaml
jklein 8bc673d80d gotenberg: null-safe hardening, probes and resources
Retrofit of #99 for a chart that already carries a values.schema.json,
plus the schema type change that goes with it.

An override written without children is YAML null. Where the chart
defines a default, Helm's coalescing deletes the default before schema
validation runs, so the schema never sees the null and cannot reject it:
the container rendered "securityContext: null" - unhardened, healthy,
silent. Where the chart defines no default (resources.limits), the null
survives into validation and a strict "object" type aborted the render.

The defaultedDict helper from #96 handles the first case; widening the
types of exactly these blocks to ["object", "null"] handles the second.
All other keys stay strict, additionalProperties: false is untouched.

The probes address the container port by name, so a rebuilt default probe
needs no further context.

Rendering with normal values is byte-identical to 5.0.0.
2026-08-23 20:37:12 +02:00

76 lines
3.1 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
spec:
replicas: {{ include "gotenberg.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.gotenberg.replicas) }}
selector:
matchLabels:
app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
template:
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
spec:
automountServiceAccountToken: false
securityContext:
{{- include "gotenberg.podSecurityContext" .Values.gotenberg.securityContext | nindent 8 }}
containers:
- name: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
image: "gotenberg/gotenberg:{{ .Chart.AppVersion }}"
imagePullPolicy: IfNotPresent
{{- if .Values.gotenberg.env }}
env:
{{- range $value := .Values.gotenberg.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 }}
{{- end }}
securityContext:
{{- include "gotenberg.containerSecurityContext" .Values.gotenberg.securityContext | nindent 12 }}
volumeMounts:
# Gotenberg (and the Chromium/LibreOffice it drives) needs writable
# /tmp and home directories; with a read-only root filesystem these
# are provided as emptyDirs.
- name: tmp
mountPath: /tmp
- name: gotenberg-home
mountPath: /home/gotenberg
ports:
- containerPort: 3000
protocol: TCP
name: gotenberg-port
livenessProbe:
{{- include "gotenberg.livenessProbe" .Values.gotenberg.livenessProbe | nindent 12 }}
readinessProbe:
{{- include "gotenberg.readinessProbe" .Values.gotenberg.readinessProbe | nindent 12 }}
startupProbe:
{{- include "gotenberg.startupProbe" .Values.gotenberg.startupProbe | nindent 12 }}
resources:
{{- include "gotenberg.effectiveResources" .Values.gotenberg.resources | nindent 12 }}
volumes:
- name: tmp
emptyDir: {}
- name: gotenberg-home
emptyDir: {}
restartPolicy: Always