mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-24 01:26:39 +00:00
cmd/k8s-operator: allow pod tolerations on nameservers (#17260)
This commit modifies the `DNSConfig` custom resource to allow specifying [tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) on the nameserver pods. This will allow users to dictate where their nameserver pods are located within their clusters. Fixes: https://github.com/tailscale/tailscale/issues/17092 Signed-off-by: David Bond <davidsbond93@gmail.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
@@ -84,6 +85,9 @@ type Nameserver struct {
|
||||
// Service configuration.
|
||||
// +optional
|
||||
Service *NameserverService `json:"service,omitempty"`
|
||||
// Pod configuration.
|
||||
// +optional
|
||||
Pod *NameserverPod `json:"pod,omitempty"`
|
||||
// Replicas specifies how many Pods to create. Defaults to 1.
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
@@ -105,6 +109,12 @@ type NameserverService struct {
|
||||
ClusterIP string `json:"clusterIP,omitempty"`
|
||||
}
|
||||
|
||||
type NameserverPod struct {
|
||||
// If specified, applies tolerations to the pods deployed by the DNSConfig resource.
|
||||
// +optional
|
||||
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
|
||||
}
|
||||
|
||||
type DNSConfigStatus struct {
|
||||
// +listType=map
|
||||
// +listMapKey=type
|
||||
|
||||
@@ -422,6 +422,11 @@ func (in *Nameserver) DeepCopyInto(out *Nameserver) {
|
||||
*out = new(NameserverService)
|
||||
**out = **in
|
||||
}
|
||||
if in.Pod != nil {
|
||||
in, out := &in.Pod, &out.Pod
|
||||
*out = new(NameserverPod)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Replicas != nil {
|
||||
in, out := &in.Replicas, &out.Replicas
|
||||
*out = new(int32)
|
||||
@@ -454,6 +459,28 @@ func (in *NameserverImage) DeepCopy() *NameserverImage {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NameserverPod) DeepCopyInto(out *NameserverPod) {
|
||||
*out = *in
|
||||
if in.Tolerations != nil {
|
||||
in, out := &in.Tolerations, &out.Tolerations
|
||||
*out = make([]corev1.Toleration, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NameserverPod.
|
||||
func (in *NameserverPod) DeepCopy() *NameserverPod {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NameserverPod)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NameserverService) DeepCopyInto(out *NameserverService) {
|
||||
*out = *in
|
||||
|
||||
Reference in New Issue
Block a user