Skip to content

Commit 54903bc

Browse files
feat(platform): gate deletion-protection VAP on Kubernetes 1.30+ capability
Address review feedback from gemini-code-assist on packages/core/platform/templates/deletion-protection.yaml:42: wrap the ValidatingAdmissionPolicy and Binding in a Helm capability check so the template stays renderable on clusters that pre-date 1.30 (when ValidatingAdmissionPolicy graduated to GA). The check targets the specific Kind, not the API group/version — admissionregistration.k8s.io/v1 itself has existed since 1.16 for ValidatingWebhookConfiguration, so the group/version alone is not a meaningful capability gate. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 8d7fa9a commit 54903bc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎packages/core/platform/templates/deletion-protection.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
platform.cozystack.io/no-delete=true label. Native, in-process CEL eval —
44
no webhook DaemonSet, no Service, no TLS, no image to maintain.
55

6-
Requires Kubernetes 1.30+ (admissionregistration.k8s.io/v1 GA).
6+
Requires Kubernetes 1.30+ (ValidatingAdmissionPolicy GA). The capability
7+
gate below keeps the template renderable on clusters that pre-date 1.30
8+
(the install simply skips the guardrail there).
79

810
Bypass: remove the label, then delete.
911
kubectl label <kind> <name> platform.cozystack.io/no-delete-
1012
*/}}
13+
{{- if .Capabilities.APIVersions.Has "admissionregistration.k8s.io/v1/ValidatingAdmissionPolicy" }}
1114
---
1215
apiVersion: admissionregistration.k8s.io/v1
1316
kind: ValidatingAdmissionPolicy
@@ -40,3 +43,4 @@ spec:
4043
objectSelector:
4144
matchLabels:
4245
platform.cozystack.io/no-delete: "true"
46+
{{- end }}

0 commit comments

Comments
 (0)