From e717e0584bfc5374c6a9c4eadcdc487789f1e326 Mon Sep 17 00:00:00 2001 From: John Coffey Date: Wed, 18 Nov 2026 22:09:26 -0700 Subject: [PATCH 1/2] Pre-flight check before each server pod starts (K-C5) An init container runs inbuxa --check: a pod that can't use the data store, the blob store or NATS stays in Init:Error, and its status names the part and why. The server container keeps its last log lines as its termination message too. server.check, on by default; needs server 27.1-rc.32. --- CHANGELOG.md | 7 ++++ .../inbuxa/templates/server/deployment.yaml | 40 +++++++++++++++++++ charts/inbuxa/tests/server_test.yaml | 30 ++++++++++++++ charts/inbuxa/values.schema.json | 12 ++++++ charts/inbuxa/values.yaml | 14 +++++++ 5 files changed, 103 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bee425d..92c2e92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,13 @@ runs, pinned by digest. address from the PROXY header, believed only from `trustedNetworks`, the load balancer's own addresses. It needs `externalTrafficPolicy: Local`, and server 27.1-rc.32. +- A pre-flight check before each server pod starts (`server.check`, on by + default): an init container runs `inbuxa --check`, which opens the data + store, writes, reads and deletes a small object in the blob store, and + connects to NATS. A pod that can't use one stays in `Init:Error`, and its + status names the part and why. The server container keeps its last log + lines as its termination message too. Needs server 27.1-rc.32: an older + server doesn't know `--check`. - `networkPolicy`, on by default: every pod starts from deny all, in and out, and gets only what it needs. The server takes mail on its listeners from anywhere and connects anywhere; `networkPolicy.httpFrom` and diff --git a/charts/inbuxa/templates/server/deployment.yaml b/charts/inbuxa/templates/server/deployment.yaml index b78eb9b..cb5e4a8 100644 --- a/charts/inbuxa/templates/server/deployment.yaml +++ b/charts/inbuxa/templates/server/deployment.yaml @@ -126,11 +126,51 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} + {{- if $server.check.enabled }} + initContainers: + # The data layer can be used, or the pod's status says which part + # can't, and why (server --check: exit 78 bad configuration, + # 69 unreachable, 77 credentials refused, 76 TLS failed) + - name: check + image: {{ include "inbuxa.server.image" $root }} + imagePullPolicy: {{ $server.image.pullPolicy }} + args: ["--config", "/etc/inbuxa/config.json", "--check"] + terminationMessagePolicy: FallbackToLogsOnError + env: + - name: INBUXA_HOSTNAME + valueFrom: + fieldRef: + fieldPath: metadata.name + {{- with $g.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} + resources: + {{- toYaml $server.check.resources | nindent 12 }} + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: [ALL] + volumeMounts: + - name: config + mountPath: /etc/inbuxa/config.json + subPath: config.json + readOnly: true + {{- if $server.secretMounts }} + - name: secrets + mountPath: /etc/inbuxa/secrets + readOnly: true + {{- end }} + - name: tmp + mountPath: /tmp + {{- end }} containers: - name: server image: {{ include "inbuxa.server.image" $root }} imagePullPolicy: {{ $server.image.pullPolicy }} args: ["--config", "/etc/inbuxa/config.json"] + # A start that can't open the data store says why on its last lines + terminationMessagePolicy: FallbackToLogsOnError env: - name: INBUXA_HOSTNAME valueFrom: diff --git a/charts/inbuxa/tests/server_test.yaml b/charts/inbuxa/tests/server_test.yaml index 5aea33e..f6bb027 100644 --- a/charts/inbuxa/tests/server_test.yaml +++ b/charts/inbuxa/tests/server_test.yaml @@ -309,3 +309,33 @@ tests: asserts: - failedTemplate: errorPattern: needs externalTrafficPolicy Local + + - it: checks the data layer before each server pod starts + template: server/deployment.yaml + documentIndex: 0 + asserts: + - equal: + path: spec.template.spec.initContainers[0].name + value: check + - equal: + path: spec.template.spec.initContainers[0].args + value: ["--config", "/etc/inbuxa/config.json", "--check"] + - equal: + path: spec.template.spec.initContainers[0].terminationMessagePolicy + value: FallbackToLogsOnError + - equal: + path: spec.template.spec.initContainers[0].securityContext.readOnlyRootFilesystem + value: true + - equal: + path: spec.template.spec.containers[0].terminationMessagePolicy + value: FallbackToLogsOnError + + - it: leaves the check out when it's turned off + template: server/deployment.yaml + documentIndex: 0 + set: + server.check.enabled: false + asserts: + - notExists: + path: spec.template.spec.initContainers + diff --git a/charts/inbuxa/values.schema.json b/charts/inbuxa/values.schema.json index 728f833..9423528 100644 --- a/charts/inbuxa/values.schema.json +++ b/charts/inbuxa/values.schema.json @@ -287,6 +287,18 @@ } } }, + "check": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean" + }, + "resources": { + "type": "object" + } + } + }, "publicUrl": { "type": "string", "pattern": "^(https?://[^/\\s]+)?$" diff --git a/charts/inbuxa/values.yaml b/charts/inbuxa/values.yaml index 25706f1..e6903dc 100644 --- a/charts/inbuxa/values.yaml +++ b/charts/inbuxa/values.yaml @@ -76,6 +76,20 @@ server: timeoutSeconds: 1800 resources: {} + # Before each server pod starts, an init container checks the data layer + # (`inbuxa --check`): it opens the data store, writes, reads and deletes a + # small object in the blob store, and connects to NATS. A pod that can't + # use one stays in Init:Error, and its status names the part and why + # (kubectl describe pod). Needs server 27.1-rc.32 or later. + check: + enabled: true + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + memory: 256Mi + # Where browsers and clients reach the server, as https://host. Sign-in # pages and OAuth metadata name it. publicUrl: "" -- 2.54.0 From 939bd85a7addd9785fd43d2122d37454791e4abc Mon Sep 17 00:00:00 2001 From: John Coffey Date: Thu, 19 Nov 2026 06:54:12 -0700 Subject: [PATCH 2/2] --check is in server 27.1-rc.33, not rc.32 --- CHANGELOG.md | 2 +- charts/inbuxa/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92c2e92..a964bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,7 +70,7 @@ runs, pinned by digest. store, writes, reads and deletes a small object in the blob store, and connects to NATS. A pod that can't use one stays in `Init:Error`, and its status names the part and why. The server container keeps its last log - lines as its termination message too. Needs server 27.1-rc.32: an older + lines as its termination message too. Needs server 27.1-rc.33: an older server doesn't know `--check`. - `networkPolicy`, on by default: every pod starts from deny all, in and out, and gets only what it needs. The server takes mail on its listeners diff --git a/charts/inbuxa/values.yaml b/charts/inbuxa/values.yaml index e6903dc..d73633f 100644 --- a/charts/inbuxa/values.yaml +++ b/charts/inbuxa/values.yaml @@ -80,7 +80,7 @@ server: # (`inbuxa --check`): it opens the data store, writes, reads and deletes a # small object in the blob store, and connects to NATS. A pod that can't # use one stays in Init:Error, and its status names the part and why - # (kubectl describe pod). Needs server 27.1-rc.32 or later. + # (kubectl describe pod). Needs server 27.1-rc.33 or later. check: enabled: true resources: -- 2.54.0