fix(cozystack-basics): gate the hostname VAP policies on the VAP API - #3409
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughHostname policy Helm templates now check for the Kubernetes ValidatingAdmissionPolicy API before rendering. Existing tests declare the capability, and new coverage verifies that route, gateway, and ingress policies produce no documents when it is unavailable. ChangesHostname policy capability gating
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)packages/system/cozystack-basics/templates/gateway-hostname-policy.yamlTraceback (most recent call last): packages/system/cozystack-basics/templates/ingress-hostname-policy.yamlTraceback (most recent call last): packages/system/cozystack-basics/templates/route-hostname-policy.yamlTraceback (most recent call last):
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Render the route, gateway and ingress hostname ValidatingAdmissionPolicies only where the admissionregistration.k8s.io/v1/ValidatingAdmissionPolicy API is served, matching the deletion-protection guard, so a cluster without that API does not receive an unrenderable resource. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
41fdd91 to
267ea51
Compare
|
Successfully created backport PR for |
|
Created backport PR for
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin backport-3409-to-release-1.5
git worktree add --checkout .worktree/backport-3409-to-release-1.5 backport-3409-to-release-1.5
cd .worktree/backport-3409-to-release-1.5
git reset --hard HEAD^
git cherry-pick -x 267ea513adeee270e97f8d91d21b6242fc09f8f1
git push --force-with-lease |
Backport of #3409 to release-1.5. gateway-hostname-policy.yaml and route-hostname-policy.yaml rendered their ValidatingAdmissionPolicy and binding documents unconditionally, so installing the chart against an API server that does not serve admissionregistration.k8s.io/v1/ValidatingAdmissionPolicy failed. Guard both on the capability, matching the existing pattern in packages/core/platform/templates/deletion-protection.yaml, and declare the capability in the two rendering test suites so they keep exercising the policies. hostname-policies-capability-gate_test.yaml pins the absent-API case at suite level, since helm-unittest merges per-test capabilities into the suite's rather than replacing them. The upstream change also gated a third template, ingress-hostname-policy.yaml. That legacy-Ingress hostname policy landed on main in d89ad7069 and was never backported, so it does not exist on release-1.5 and is deliberately excluded here: importing it would ship an unreviewed admission policy that starts rejecting tenant Ingress hostnames in a patch release. Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
What this PR does
Wraps the route, gateway, and ingress hostname
ValidatingAdmissionPolicytemplates in a.Capabilities.APIVersions.Hasgate so they render only where the VAP API is available. Without it, an operator-generated HelmRelease with drift detection off renders the policies out at first install on a cluster missing the API and never adds them back. Each template gains a sibling test asserting it renders zero documents when the API is absent. Install-robustness fix, split out from #3299.Summary by CodeRabbit