Last active
June 6, 2026 20:20
-
-
Save tibordp/09de5c4e43b541dc555afff18fc71e9b to your computer and use it in GitHub Desktop.
MutatingAdmissionPolicy for unqualified Services to default to PreferDualStack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: admissionregistration.k8s.io/v1 | |
| kind: MutatingAdmissionPolicy | |
| metadata: | |
| name: prefer-dual-stack-services | |
| spec: | |
| matchConstraints: | |
| resourceRules: | |
| - apiGroups: [""] | |
| apiVersions: ["v1"] | |
| operations: ["CREATE"] | |
| resources: ["services"] | |
| matchConditions: | |
| - name: ipfamilypolicy-unset | |
| expression: "!has(object.spec.ipFamilyPolicy)" | |
| - name: not-externalname | |
| expression: 'object.spec.type != "ExternalName"' | |
| failurePolicy: Ignore | |
| reinvocationPolicy: Never | |
| mutations: | |
| - patchType: ApplyConfiguration | |
| applyConfiguration: | |
| expression: > | |
| Object{ | |
| spec: Object.spec{ | |
| ipFamilyPolicy: "PreferDualStack" | |
| } | |
| } | |
| --- | |
| apiVersion: admissionregistration.k8s.io/v1 | |
| kind: MutatingAdmissionPolicyBinding | |
| metadata: | |
| name: prefer-dual-stack-services-binding | |
| spec: | |
| policyName: prefer-dual-stack-services |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment