feat(paperless-ngx)!: quote every operator scalar, pin the consume mover, drop oidcSecretRef
Three issues on one chart, bundled because they share values.yaml, values.schema.json and the version line, and because the first half of #11 lives in the same template as #101. Gitea #11, first half: the consume CronJob's schedule was rendered bare, so a schedule in the commonest cron notation there is - a star, a slash, an interval - aborted the render with a YAML parse error pointing at the template while the operator's value appeared nowhere in the message. Quoting it in the values file does not help; Helm passes the content through. Reproduced before the fix, at the line the issue names, and fixed with | quote. Gitea #11, second half: secrets.oidcSecretRef is removed, values and schema both. No template ever read it, so no OnePasswordItem was created and nothing reached the pod - the quiet kind of defect that looks like successful configuration. It is not reimplemented, and the reason is in paperless: the whole OIDC configuration travels in one json environment variable with no _FILE variant, so a secretKeyRef cannot substitute a fragment into it. The operational question is answered by #83 - Keycloak marks a client public per client, so nothing forces a confidential one here. In the same breath, oidc.provider.tokenAuthMethod is restricted to "none". Its comment named client_secret_basic as the example, which asks the provider for an authentication this chart cannot perform: it configures no client secret and cannot. The two values read together looked like a working secret setup, and the symptom was a login dying at the callback with invalid_client. No live release sets it (measured against all three instances). Gitea #112 asked for an extraEnv and the chart already had the standard additive env block - the issue was measured against a deployed 12.2.0 and read only the top-level keys. What was actually broken is the block itself: it rendered its operand bare, so a "*"-leading value aborted the render and "true" or "0755" arrived as a bool or an integer, which the API server rejects after a green render. It is brought to the repository's documented quoted form (template-chart carries the rule), which is what makes an arbitrary PAPERLESS_* variable settable in practice. PAPERLESS_LOGGING_DIR is documented as the worked example, with the cross-reference it needs: the root cause is the NFS-exported RWX data volume in jk-cluster-config #360 and this does not fix it - it only moves the log off that volume. The two Ingress upload-size annotations had the same bare render and are quoted too. Gitea #101: the consume mover now runs on the node of the StatefulSet pod, via a required podAffinity on its label. It mounts the RWX consume volume, and Longhorn's CSI driver refuses that mount unless it finds a workload pod in Pending, so a mover on another node left the StatefulSet node's kubelet retrying every two minutes - 291 events in 10 hours in both releases with SMB on, none in the release without the CronJob. A static nodeSelector would be wrong because the StatefulSet pod is not pinned either, and preferred would reproduce the bug more rarely and harder to find. The cost of a required term is handled rather than left open: concurrencyPolicy: Forbid, a startingDeadlineSeconds that also keeps the controller away from its 100-missed-schedules stop, and an activeDeadlineSeconds that fails a job which cannot be placed instead of leaving one Pending pod per schedule. scaleDown already suspends the CronJob; what remains is paperless.replicas: 0 with SMB on, which now reports a bounded, visible failure. successfulJobsHistoryLimit is deliberately untouched: Longhorn's check asks for the existence of a Pending pod, not the absence of Succeeded ones, so those three pods are the error message's evidence and not its cause. Side defect fixed on the way: every read of smbConnection.cron dereferenced the block directly, so an override that had erased it aborted with a nil-pointer error naming an internal template path instead of falling back to the defaults this chart promises everywhere else. Measured on origin/main; all reads now go through a merged-defaults helper that preserves an explicit false. Major: a value is removed and fails the strict schema afterwards, and runtime placement changes. Fixes #11 Fixes #101 Fixes #112
This commit is contained in:
8 files changed
+427
-42
No files matched your search
@@ -8,6 +8,9 @@
|
||||
{{- $valkeySvc := printf "%s-valkey-service" .Release.Name -}}
|
||||
{{- $pre := default (list) $scripts.preConsumptionScripts -}}
|
||||
{{- $post := default (list) $scripts.postConsumptionScripts -}}
|
||||
{{- $cron := fromYaml (include "paperless-ngx.cron.scheduling" .Values.smbConnection.cron) -}}
|
||||
{{- $cronPinned := $cron.pinToServerNode -}}
|
||||
{{- $cronDeadline := include "paperless-ngx.formatNumber" $cron.activeDeadlineSeconds -}}
|
||||
{{- $httpRoute := .Values.httpRoute | default dict -}}
|
||||
{{- $hostnames := $httpRoute.hostnames | default list -}}
|
||||
{{- if not $hostnames -}}
|
||||
@@ -184,15 +187,14 @@ WHAT THE 1PASSWORD ITEMS MUST CONTAIN
|
||||
here, so a wrong field name surfaces as a mount failure on the CronJob's
|
||||
pod — a describe on that pod, never a missing variable.
|
||||
{{- end }}
|
||||
{{- if .Values.secrets.oidcSecretRef }}
|
||||
|
||||
secrets.oidcSecretRef IS SET AND IS READ BY NOTHING
|
||||
"{{ .Values.secrets.oidcSecretRef }}" — no template in this chart references
|
||||
that value. No OnePasswordItem is created for it and no Secret appears. The
|
||||
OIDC client id travels as plain env from oidc.provider.clientId, and no
|
||||
client secret is configured at all (see the OIDC section below). Whatever
|
||||
you put in that item has no effect on this release.
|
||||
{{- end }}
|
||||
{{- /*
|
||||
The warning that used to stand here - "secrets.oidcSecretRef IS SET AND IS READ
|
||||
BY NOTHING" - is gone with the value itself (13.0.0, Gitea #11). It cannot be
|
||||
printed any more and would not be reached: the key is out of values.schema.json
|
||||
too, so a release that still sets it fails BEFORE any template renders, with
|
||||
"additional properties 'oidcSecretRef' not allowed". The fix is to delete the
|
||||
key; values.yaml says why it is not coming back.
|
||||
*/}}
|
||||
|
||||
CHANGING A SECRET'S CONTENT RESTARTS NOTHING
|
||||
Helm never sees the content of a OnePasswordItem, so it cannot hash it, and
|
||||
@@ -340,12 +342,44 @@ HOW DOCUMENTS GET IN
|
||||
move, not a copy: once the job has run, the share no longer holds the file
|
||||
and the only copy is on the consume volume.
|
||||
|
||||
One thing to know before you edit that schedule: it is rendered into the
|
||||
manifest unquoted, so a schedule that STARTS with "*" ("*/15 * * * *")
|
||||
aborts the render with a YAML parse error on this template — YAML reads the
|
||||
leading * as an alias. Quoting it in your values file does not help, the
|
||||
quotes are gone by then. Use an equivalent that starts with a digit
|
||||
("5,20,35,50 * * * *"); a "*" anywhere but in first position is fine.
|
||||
The schedule is quoted on the way into the manifest since 13.0.0, so any
|
||||
cron notation works — one starting with "*" or an "@daily" macro included.
|
||||
Before that such a schedule aborted the render with a YAML parse error
|
||||
pointing at the template, and the advice here was to avoid it; if you are
|
||||
carrying a workaround schedule from that era ("5,20,35,50 * * * *" instead
|
||||
of every 15 minutes), you can write what you meant now.
|
||||
{{- if $cronPinned }}
|
||||
|
||||
PLACEMENT: the mover runs on the NODE OF THE STATEFULSET POD, via a
|
||||
required podAffinity on its label (Gitea #101). Without that it lands
|
||||
anywhere, and because it mounts the consume volume — RWX, from Longhorn —
|
||||
the kubelet of the StatefulSet's node then retries the mount every two
|
||||
minutes with "no Pending workload pods for volume ... to be mounted". It
|
||||
was measured at 291 such events in 10 hours.
|
||||
|
||||
THE PRICE, and it is the one thing to know before scaling down: with no
|
||||
StatefulSet pod the mover CANNOT BE SCHEDULED. scaleDown: true suspends
|
||||
this CronJob outright, so that case is covered — but paperless.replicas: 0
|
||||
with SMB still on is not, and there the job fails once per schedule after
|
||||
activeDeadlineSeconds ({{ $cronDeadline }}s) with reason DeadlineExceeded. That is
|
||||
deliberate: a bounded, visible failure rather than a Pending pod per
|
||||
schedule that nobody sees. Switch smbConnection.cron.pinToServerNode to
|
||||
false to go back to unpinned placement — and to the mount errors.
|
||||
|
||||
What the pinning does NOT fix: the consume volume stays RWX with a
|
||||
share-manager behind it. Co-locating the two consumers removes the
|
||||
cross-node mount, not the second consumer.
|
||||
{{- else }}
|
||||
|
||||
PLACEMENT IS OFF (smbConnection.cron.pinToServerNode: false). The mover
|
||||
will be scheduled wherever there is room, and when that is not the node of
|
||||
the StatefulSet pod, Longhorn refuses to mount the shared RWX consume
|
||||
volume there: the kubelet of the StatefulSet's node retries every two
|
||||
minutes with "no Pending workload pods for volume ... to be mounted"
|
||||
(Gitea #101, measured at 291 events in 10 hours). The errors stop when the
|
||||
StatefulSet pod is deleted and comes back Pending, and return with the next
|
||||
firing of this job.
|
||||
{{- end }}
|
||||
|
||||
The job has NO probes (the documented exception to the chart conventions),
|
||||
and it cannot fail usefully either: with nothing to move it exits 0, which
|
||||
@@ -432,8 +466,13 @@ OIDC IS ON, AND IT IS PKCE-ONLY
|
||||
{{- if not .Values.oidc.provider.tokenAuthMethod }}
|
||||
|
||||
oidc.provider.tokenAuthMethod is unset. Since the allauth update in 3.0 some
|
||||
providers need it spelled out (client_secret_basic); the symptom is a login
|
||||
that dies at the callback with invalid_client.
|
||||
providers need it spelled out, and the symptom when they do is a login that
|
||||
dies at the callback with invalid_client. The only value this chart accepts is
|
||||
"none" — it states the public client explicitly. A method that authenticates
|
||||
WITH a client secret cannot work here and is rejected by the schema (13.0.0,
|
||||
Gitea #11): this release configures no client secret and cannot, because
|
||||
paperless reads the whole OIDC configuration out of one json environment
|
||||
variable with no _FILE variant.
|
||||
{{- end }}
|
||||
{{- if or .Values.oidc.autoLoginWithProvider .Values.oidc.disableRegularLogin }}
|
||||
|
||||
@@ -453,6 +492,20 @@ paperless.scripts IS SET AND DOES NOTHING
|
||||
PAPERLESS_PRE_CONSUME_SCRIPT nor PAPERLESS_POST_CONSUME_SCRIPT is set on the
|
||||
container. These values render no object and change no behaviour.
|
||||
{{- end }}
|
||||
{{- if .Values.paperless.env }}
|
||||
|
||||
paperless.env ADDS {{ len .Values.paperless.env }} VARIABLE(S) — AND AN OVERRIDE ONLY BITES AT INSTALL
|
||||
{{ range $i, $e := .Values.paperless.env }}{{ if $i }}, {{ end }}{{ $e.name }}{{ end }}
|
||||
|
||||
These are appended AFTER the variables the chart sets itself, so at INSTALL an
|
||||
entry repeating one of those names wins. On an upgrade of an EXISTING release
|
||||
the same entry is lost: Kubernetes merges env by name, the pair collapses to
|
||||
the chart's own value, and helm upgrade still reports success. Read the value
|
||||
back off the StatefulSet, never off the upgrade's exit code:
|
||||
|
||||
kubectl -n {{ .Release.Namespace }} get statefulset {{ .Release.Name }}-{{ .Chart.Name }}-sfs \
|
||||
-o jsonpath='{.spec.template.spec.containers[0].env}'
|
||||
{{- end }}
|
||||
{{- if gt (int $replicas) 1 }}
|
||||
|
||||
paperless.replicas IS {{ $replicas }} — EXPECT ONE POD TO WORK AND THE REST TO WAIT
|
||||
|
||||
Reference in new issue
Block a user