tibordp / prefer-dual-stack-webhook

Admission controller that makes services dual-stack by default
Apache License 2.0
8 stars 0 forks source link

PreferDualStack Admission Controller

Currently Kubernetes services are created in single stack mode by default, defaulting to primary address family of the cluster.

This is a mutating webhook admission controller that adds ipFamilyPolicy: PreferDualStack to all newly created services if the field is not explicitely specified, making dual-stack the default.

Installation

kubectl apply -f https://raw.githubusercontent.com/tibordp/prefer-dual-stack-webhook/master/deploy.yaml

Demo

Before Afrer
```bash > kubectl apply -f - < kubectl describe svc dummy Name: dummy Namespace: default Labels: Annotations: Selector: app=dummy Type: ClusterIP IP Family Policy: SingleStack IP Families: IPv4 IP: 10.96.200.4 IPs: 10.96.200.4 Port: 80/TCP TargetPort: 80/TCP Endpoints: Session Affinity: None Events: ``` ```bash > kubectl apply -f - < kubectl describe svc dummy Name: dummy Namespace: default Labels: Annotations: Selector: app=dummy Type: ClusterIP IP Family Policy: PreferDualStack IP Families: IPv4,IPv6 IP: 10.96.19.47 IPs: 10.96.19.47,fd00:10:96::f31 Port: 80/TCP TargetPort: 80/TCP Endpoints: Session Affinity: None Events: ```

Acknowledgements

Admission controller webhook boilerplate adapted from douglasmakey/admissioncontroller by Douglas Makey Mendez Molero.