Skip to content

Policy that enforces the usage of ndots in the pod's DNS configuration

License

Notifications You must be signed in to change notification settings

kubewarden/pod-ndots-policy

Repository files navigation

Kubewarden Policy Repository Stable

Kubewarden policy that enforces the DNS lookup configuration of a Pod to have a specific ndots value.

This is done by mutating the Pod's .spec.dnsConfig.options field to have the desired ndots value.

Configuration

The number of ndots to enforce can be configured using the ndots field.

ndots: 2

When no configuration is provided, the default value is 1.

Examples

Assuming the no configuration is provided, the policy will enforce the ndots value to be 1.

This will change the following Pod:

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
    - name: nginx
      image: nginx

To the following Pod:

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  dnsConfig:
    options:
      - name: ndots
        value: "1"
  containers:
    - name: nginx
      image: nginx