Skip to content

feat(spire,spectre): support secret-backed env vars via env.raw - #331

Merged
devkoriel merged 1 commit into
mainfrom
sc-18998-secret-env-spire-spectre
Aug 6, 2026
Merged

feat(spire,spectre): support secret-backed env vars via env.raw#331
devkoriel merged 1 commit into
mainfrom
sc-18998-secret-env-spire-spectre

Conversation

@devkoriel

Copy link
Copy Markdown
Contributor

Why

Neither chart can pass a secret to its container. helpers.list-env-variables renders only .Values.env.normal, which inlines every value as plain text, and there is no envFrom or secretKeyRef path anywhere in either deployment template.

That blocks RFC-036: the NATS transport needs CFG_NATS_TOKEN, which comes from Vault and cannot be committed to app-of-apps. Today 24 spectre relays and 4 spire deployments in staging simply cannot receive it.

What

Adds the env.raw passthrough that the validator chart already uses (charts/validator/templates/deployment.yaml:155 and deployment-vao.yaml:139), so the three Chronicle app charts behave consistently:

### -- ADDITIONAL ENV VARS FROM `.Values.env.raw`
{{- if .Values.env.raw }}
  {{- toYaml .Values.env.raw | nindent 12 }}
{{- end }}

spire 0.3.5 → 0.3.6, spectre 0.3.7 → 0.3.8. READMEs regenerated with helm-docs (only these two charts; helm-docs also wanted to rewrite nine unrelated chart READMEs from pre-existing drift, and I reverted those to keep this diff honest).

Backwards compatibility

env.raw defaults to [] and the block is skipped when unset, so output is byte-identical for every current consumer. Verified by rendering both charts with default values: spire still emits 0 env vars, spectre still emits its usual 7.

With the key set, both charts render the secret reference correctly alongside env.normal:

- name: CFG_NATS_ENABLE
  value: "true"
- name: CFG_NATS_TOKEN
  valueFrom:
    secretKeyRef:
      name: stage-nats-auth
      key: token

Usage after release

app-of-apps wires CFG_NATS_TOKEN into the spire and relay appsets, sourced from the same Vault key the stage-nats server authenticates against. That PR follows once these versions are published, since it needs the targetRevision bumps.

Both charts render only .Values.env.normal, which inlines every value as
plain text, so there is no way to pass a secret to spire or spectre. That
blocks RFC-036: the NATS transport needs CFG_NATS_TOKEN, which must come
from a Secret and cannot be committed to app-of-apps.

Adds the same env.raw passthrough the validator chart already uses, so a
list of core/v1 EnvVar entries can be supplied verbatim alongside the
existing normal map.

Backwards compatible: env.raw defaults to [] and the block is skipped
when unset, so charts render byte-identically for every current
consumer.
@devkoriel devkoriel self-assigned this Aug 6, 2026
@devkoriel devkoriel added the enhancement New feature or request label Aug 6, 2026
@devkoriel
devkoriel merged commit ca444ce into main Aug 6, 2026
2 of 3 checks passed
@devkoriel
devkoriel deleted the sc-18998-secret-env-spire-spectre branch August 6, 2026 03:43
devkoriel added a commit that referenced this pull request Aug 6, 2026
yamllint's new-line-at-end-of-file rule fails on this file. ct lint only
runs against charts a PR touches, so it stayed hidden until #331 modified
the spire chart, and it will fail every future spire PR until fixed.

Pre-existing, not introduced by #331: git show confirms the file already
ended without a newline before that change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant