sops: decrypt on every Flux Kustomization + static guard
`spec.decryption` is opt-in per Flux Kustomization, and a secret-*.sops.yaml
under a tree without it is still valid YAML: Flux applies the Secret with
literal ENC[AES256_GCM,...] values and reports success. The Secret is green and
wrong, and the first symptom is an auth failure days later that looks nothing
like a git problem. Only `apps` and `monitoring` had the block; the other six
trees were a trap for the next person to add a Secret there.
- add decryption: {provider: sops, secretRef: sops-age} to cert-manager,
databases, gateway-api-crds, infrastructure, logging and flux-system
(8/8 Kustomizations now decrypt; harmless where no encrypted files exist)
- scripts/check-sops-decryption.py + `make check-sops`: static guard that reads
the live sync path from gotk-sync.yaml, walks each Kustomization's kustomize
resource graph, and fails when a *.sops.yaml file is under a tree whose owner
cannot decrypt, is under no reconciled tree, or is not actually encrypted
(also catches `flux bootstrap` regenerating gotk-sync.yaml without the block)
- .gitattributes marks *.sops.yaml with diff=sopsdiffer; docs/secrets-sops.md
explains the opt-in trap, the eight Kustomizations and the guard
No secret contents, recipients or keys touched.
This commit is contained in:
parent
e9dbbbfbcd
commit
eea80f475e
10 changed files with 338 additions and 3 deletions
|
|
@ -15,4 +15,11 @@ spec:
|
|||
# release object, and the chart's CRDs carry `helm.sh/resource-policy: keep`
|
||||
# so they survive. Nothing here is a bare CRD in git, hence prune: true.
|
||||
prune: true
|
||||
# Uniform SOPS policy for every Flux Kustomization: a tree with no encrypted
|
||||
# files today is exactly where a stray secret-*.sops.yaml would otherwise be
|
||||
# applied as literal ENC[...] ciphertext — silently. See docs/secrets-sops.md.
|
||||
decryption:
|
||||
provider: sops
|
||||
secretRef:
|
||||
name: sops-age
|
||||
wait: true
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@ spec:
|
|||
# reasoning as gateway-api-crds. Reverting the operator Deployment args is a
|
||||
# git change, not a prune.
|
||||
prune: false
|
||||
# Uniform SOPS policy; harmless with no encrypted files in this tree, and it
|
||||
# removes the "which tree am I in" trap — see docs/secrets-sops.md.
|
||||
decryption:
|
||||
provider: sops
|
||||
secretRef:
|
||||
name: sops-age
|
||||
# The plugin's operator<->plugin mTLS pair is issued by cert-manager
|
||||
# (Issuer/Certificate in the vendored plugin manifest). Applying those before
|
||||
# the cert-manager CRDs and webhook exist just churns; wait for it.
|
||||
|
|
|
|||
|
|
@ -22,6 +22,15 @@ spec:
|
|||
interval: 10m0s
|
||||
path: ./clusters/homek8s
|
||||
prune: true
|
||||
# Added by hand on top of the generated manifest: uniform SOPS policy for every
|
||||
# Flux Kustomization (see docs/secrets-sops.md). This tree holds only Flux
|
||||
# manifests today; the field means a secret-*.sops.yaml dropped here fails
|
||||
# loudly instead of applying as literal ENC[...] ciphertext. `flux bootstrap`
|
||||
# regenerates this file and would drop the block — `make check-sops` catches that.
|
||||
decryption:
|
||||
provider: sops
|
||||
secretRef:
|
||||
name: sops-age
|
||||
sourceRef:
|
||||
kind: GitRepository
|
||||
name: flux-system
|
||||
|
|
|
|||
|
|
@ -13,4 +13,10 @@ spec:
|
|||
path: ./infrastructure/networking/gateway-api
|
||||
# CRDs must never be pruned automatically: dropping them would delete
|
||||
# every Gateway/HTTPRoute object in the cluster.
|
||||
prune: false
|
||||
prune: false
|
||||
# Uniform SOPS policy; harmless with no encrypted files in this tree, and it
|
||||
# removes the "which tree am I in" trap — see docs/secrets-sops.md.
|
||||
decryption:
|
||||
provider: sops
|
||||
secretRef:
|
||||
name: sops-age
|
||||
|
|
|
|||
|
|
@ -12,3 +12,9 @@ spec:
|
|||
name: flux-system
|
||||
path: ./infrastructure/home
|
||||
prune: true
|
||||
# Uniform SOPS policy; harmless with no encrypted files in this tree, and it
|
||||
# removes the "which tree am I in" trap — see docs/secrets-sops.md.
|
||||
decryption:
|
||||
provider: sops
|
||||
secretRef:
|
||||
name: sops-age
|
||||
|
|
|
|||
|
|
@ -12,6 +12,12 @@ spec:
|
|||
name: flux-system
|
||||
path: ./infrastructure/logging
|
||||
prune: true
|
||||
# Uniform SOPS policy; harmless with no encrypted files in this tree, and it
|
||||
# removes the "which tree am I in" trap — see docs/secrets-sops.md.
|
||||
decryption:
|
||||
provider: sops
|
||||
secretRef:
|
||||
name: sops-age
|
||||
# Namespace + local-path PVC provisioning come from infrastructure; the
|
||||
# ServiceMonitor/PrometheusRule CRDs come from kube-prometheus-stack via
|
||||
# monitoring, so nothing here is applied before its CRDs exist.
|
||||
|
|
|
|||
Loading…
Reference in a new issue