Merge pull request #17315 from rsicart/rsi/coredns-pod-annotations

Allow to setup CoreDNS pod annotations
This commit is contained in:
Kubernetes Prow Robot 2025-07-04 05:53:26 -07:00 committed by GitHub
commit c95d2dc2b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 47 additions and 0 deletions

View File

@ -3681,6 +3681,13 @@ spec:
Default: none
type: object
type: object
podAnnotations:
additionalProperties:
type: string
description: |-
PodAnnotations makes possible to add additional annotations to CoreDNS Pods.
Default: none
type: object
provider:
description: Provider indicates whether CoreDNS or kube-dns will
be the default service discovery.

View File

@ -599,6 +599,9 @@ type KubeDNSConfig struct {
MemoryLimit *resource.Quantity `json:"memoryLimit,omitempty"`
// NodeLocalDNS specifies the configuration for the node-local-dns addon
NodeLocalDNS *NodeLocalDNSConfig `json:"nodeLocalDNS,omitempty"`
// PodAnnotations makes possible to add additional annotations to CoreDNS Pods.
// Default: none
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
}
// NodeLocalDNSConfig are options of the node-local-dns

View File

@ -578,6 +578,9 @@ type KubeDNSConfig struct {
MemoryLimit *resource.Quantity `json:"memoryLimit,omitempty"`
// NodeLocalDNS specifies the configuration for the node-local-dns addon
NodeLocalDNS *NodeLocalDNSConfig `json:"nodeLocalDNS,omitempty"`
// PodAnnotations makes possible to add additional annotations to CoreDNS Pods.
// Default: none
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
}
// NodeLocalDNSConfig are options of the node-local-dns

View File

@ -5437,6 +5437,7 @@ func autoConvert_v1alpha2_KubeDNSConfig_To_kops_KubeDNSConfig(in *KubeDNSConfig,
} else {
out.NodeLocalDNS = nil
}
out.PodAnnotations = in.PodAnnotations
return nil
}
@ -5470,6 +5471,7 @@ func autoConvert_kops_KubeDNSConfig_To_v1alpha2_KubeDNSConfig(in *kops.KubeDNSCo
} else {
out.NodeLocalDNS = nil
}
out.PodAnnotations = in.PodAnnotations
return nil
}

View File

@ -3881,6 +3881,13 @@ func (in *KubeDNSConfig) DeepCopyInto(out *KubeDNSConfig) {
*out = new(NodeLocalDNSConfig)
(*in).DeepCopyInto(*out)
}
if in.PodAnnotations != nil {
in, out := &in.PodAnnotations, &out.PodAnnotations
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}

View File

@ -564,6 +564,9 @@ type KubeDNSConfig struct {
MemoryLimit *resource.Quantity `json:"memoryLimit,omitempty"`
// NodeLocalDNS specifies the configuration for the node-local-dns addon
NodeLocalDNS *NodeLocalDNSConfig `json:"nodeLocalDNS,omitempty"`
// PodAnnotations makes possible to add additional annotations to CoreDNS Pods.
// Default: none
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
}
// NodeLocalDNSConfig are options of the node-local-dns

View File

@ -5832,6 +5832,7 @@ func autoConvert_v1alpha3_KubeDNSConfig_To_kops_KubeDNSConfig(in *KubeDNSConfig,
} else {
out.NodeLocalDNS = nil
}
out.PodAnnotations = in.PodAnnotations
return nil
}
@ -5865,6 +5866,7 @@ func autoConvert_kops_KubeDNSConfig_To_v1alpha3_KubeDNSConfig(in *kops.KubeDNSCo
} else {
out.NodeLocalDNS = nil
}
out.PodAnnotations = in.PodAnnotations
return nil
}

View File

@ -3860,6 +3860,13 @@ func (in *KubeDNSConfig) DeepCopyInto(out *KubeDNSConfig) {
*out = new(NodeLocalDNSConfig)
(*in).DeepCopyInto(*out)
}
if in.PodAnnotations != nil {
in, out := &in.PodAnnotations, &out.PodAnnotations
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}

View File

@ -3963,6 +3963,13 @@ func (in *KubeDNSConfig) DeepCopyInto(out *KubeDNSConfig) {
*out = new(NodeLocalDNSConfig)
(*in).DeepCopyInto(*out)
}
if in.PodAnnotations != nil {
in, out := &in.PodAnnotations, &out.PodAnnotations
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}

View File

@ -122,6 +122,12 @@ spec:
metadata:
labels:
k8s-app: kube-dns
{{- if KubeDNS.PodAnnotations }}
annotations:
{{- range $key, $value := KubeDNS.PodAnnotations }}
{{ $key }}: "{{ $value }}"
{{- end }}
{{- end }}
spec:
priorityClassName: system-cluster-critical
serviceAccountName: coredns