Hook Jobs under a deny-all on a first install too #34

Merged
jcoffey-dev merged 1 commits from fix/hook-network-policies into main 2026-11-20 05:37:55 +00:00
Owner

The seed Job is a pre-install hook, so on a first install it ran before any of the release's NetworkPolicies existed: unconfined for its run, and refused outright by a cluster that requires a deny-all over every pod. The lab's Kyverno policy does exactly that:

admission webhook "vpol.validate.kyverno.svc-fail" denied the request: Policy inbuxa-network-policy failed: every pod is under a deny-all NetworkPolicy

Every earlier lab run upgraded an existing release, so the policies were already there. The lab's first from-scratch run (lab/e2e.sh, coming in the lab repo) found it.

Fix: the deny-all and the jobs' policy are rendered a second time as pre-install,pre-upgrade,pre-rollback hooks at weight -20 (before the seed's ConfigMap at -5 and the upgrade's objects at -10), with before-hook-creation,hook-succeeded, so they go once the hooks succeed, when the release's own copies are created. The hook deny-all has no matchExpressions, as a deny-all over the whole release.

tools/check.sh all green locally (both Helm versions, kubeconform 1.35–1.37, kube-linter, helm-unittest with three new tests). The from-scratch lab run on this branch is going now; I'll add its result here.

The seed Job is a `pre-install` hook, so on a **first install** it ran before any of the release's NetworkPolicies existed: unconfined for its run, and refused outright by a cluster that requires a deny-all over every pod. The lab's Kyverno policy does exactly that: > admission webhook "vpol.validate.kyverno.svc-fail" denied the request: Policy inbuxa-network-policy failed: every pod is under a deny-all NetworkPolicy Every earlier lab run upgraded an existing release, so the policies were already there. The lab's first from-scratch run (`lab/e2e.sh`, coming in the lab repo) found it. **Fix:** the deny-all and the jobs' policy are rendered a second time as `pre-install,pre-upgrade,pre-rollback` hooks at weight -20 (before the seed's ConfigMap at -5 and the upgrade's objects at -10), with `before-hook-creation,hook-succeeded`, so they go once the hooks succeed, when the release's own copies are created. The hook deny-all has no `matchExpressions`, as a deny-all over the whole release. `tools/check.sh` all green locally (both Helm versions, kubeconform 1.35–1.37, kube-linter, helm-unittest with three new tests). The from-scratch lab run on this branch is going now; I'll add its result here.
jcoffey-dev added 1 commit 2026-11-20 05:08:26 +00:00
Hook Jobs under a deny-all on a first install too
ci / chart (pull_request) Successful in 39s
a47a4db04e
The seed Job is a pre-install hook, so on a first install it ran before
any of the release's NetworkPolicies existed: unconfined, and refused by
a cluster that requires a deny-all over every pod (the lab's Kyverno
policy). The deny-all and the jobs' policy are now rendered a second time
as pre-install/pre-upgrade/pre-rollback hooks at weight -20, deleted once
the hooks succeed; by then the release's own copies are in place.

Found by the lab's first from-scratch run (lab/e2e.sh); every earlier run
upgraded an existing release.
Author
Owner

Lab, from scratch on the bench with this branch (lab/down.sh && lab/e2e.sh): passed in 179 s: the seed ran under the hook deny-all, then mail in over SMTP and found over IMAPS, the webmail signed in across both replicas, the console signed in. Before this change the same run stopped at the seed with the Kyverno denial above.

Lab, from scratch on the bench with this branch (`lab/down.sh && lab/e2e.sh`): **passed in 179 s**: the seed ran under the hook deny-all, then mail in over SMTP and found over IMAPS, the webmail signed in across both replicas, the console signed in. Before this change the same run stopped at the seed with the Kyverno denial above.
jcoffey-dev merged commit db8fed7e1c into main 2026-11-20 05:37:55 +00:00
jcoffey-dev deleted branch fix/hook-network-policies 2026-11-20 05:37:55 +00:00
Sign in to join this conversation.