cmd/k8s-operator: add affinity rules to DNSConfig (#19360)

This commit modifies the `DNSConfig` custom resource to allow the
user to specify affinity rules on the nameserver pods.

Updates: https://github.com/tailscale/tailscale/issues/18556

Signed-off-by: David Bond <davidsbond93@gmail.com>
This commit is contained in:
David Bond
2026-04-15 22:39:04 +01:00
committed by GitHub
parent acc43356c6
commit eea39eaf52
7 changed files with 1792 additions and 0 deletions
+1
View File
@@ -483,6 +483,7 @@ _Appears in:_
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.3/#toleration-v1-core) array_ | If specified, applies tolerations to the pods deployed by the DNSConfig resource. | | |
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.3/#affinity-v1-core)_ | If specified, applies affinity rules to the pods deployed by the DNSConfig resource. | | |
#### NameserverService
@@ -113,6 +113,9 @@ type NameserverPod struct {
// If specified, applies tolerations to the pods deployed by the DNSConfig resource.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// If specified, applies affinity rules to the pods deployed by the DNSConfig resource.
// +optional
Affinity *corev1.Affinity `json:"affinity,omitzero"`
}
type DNSConfigStatus struct {
@@ -469,6 +469,11 @@ func (in *NameserverPod) DeepCopyInto(out *NameserverPod) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Affinity != nil {
in, out := &in.Affinity, &out.Affinity
*out = new(corev1.Affinity)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NameserverPod.