Skip to content

fix: cache Secrets in the operator namespace instead of cluster-wide - #2

Merged
krlex merged 1 commit into
mainfrom
hardening-followup-2026-07
Jul 25, 2026
Merged

fix: cache Secrets in the operator namespace instead of cluster-wide#2
krlex merged 1 commit into
mainfrom
hardening-followup-2026-07

Conversation

@krlex

@krlex krlex commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

M12 left the operator watching Secrets cluster-wide, which put it straight into a crash-loop on a real cluster. Found and fixed against the running dev cluster on 2026-07-23; blocking the 2026.07.0 release because the operator image is built from main.

The credential reconciler watches Secrets, and the manager cached them at
cluster scope. Once the Secret grant became a namespaced Role, that informer's
list was refused, the shared cache never reported synced, and the manager
exited with "failed to wait for ... caches to sync" — a crash loop that took
all nine controllers down, not just Credential.

Scope the Secret cache to the operator's own namespace so the informer asks
only for what the Role grants. The namespace comes from a POD_NAMESPACE
downward-API env (added to both the Helm deployment and the kustomize manager
manifest), falling back to the ServiceAccount namespace file so an older
manifest still scopes correctly. Out-of-cluster runs have neither and keep the
unscoped cache, which matches the cluster-admin kubeconfig they use.

Verified in the 7-node dev cluster: 0 restarts, all nine controllers start, a
Credential CR reconciles its Secret through the scoped cache, and the operator
still cannot read Secrets outside its namespace.
@krlex
krlex merged commit 1c3d88b into main Jul 25, 2026
2 checks passed
@krlex
krlex deleted the hardening-followup-2026-07 branch July 30, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant