feat(nodelocaldns): Add possibility to set an ExternalCoreFile

Allow users to provide entirely custom CoreFile for NodeLocalDNS to provide improved flexibility.
This commit is contained in:
Anthony Hausman 2023-02-27 18:03:29 +01:00
parent d50995ece3
commit cc47bd278c
No known key found for this signature in database
GPG Key ID: 23BDC0D0EF22F0C5
7 changed files with 19 additions and 0 deletions

View File

@ -3220,6 +3220,11 @@ spec:
enabled:
description: Enabled activates the node-local-dns addon.
type: boolean
externalCoreFile:
description: ExternalCoreFile is used to provide a complete
NodeLocalDNS CoreFile by the user - ignores other provided
flags which modify the CoreFile.
type: string
forwardToKubeDNS:
description: If enabled, nodelocal dns will use kubedns as
a default upstream

View File

@ -580,6 +580,8 @@ type KubeDNSConfig struct {
type NodeLocalDNSConfig struct {
// Enabled activates the node-local-dns addon.
Enabled *bool `json:"enabled,omitempty"`
// ExternalCoreFile is used to provide a complete NodeLocalDNS CoreFile by the user - ignores other provided flags which modify the CoreFile.
ExternalCoreFile string `json:"externalCoreFile,omitempty"`
// Image overrides the default docker image used for node-local-dns addon.
Image *string `json:"image,omitempty"`
// Local listen IP address. It can be any IP in the 169.254.20.0/16 space or any other IP address that can be guaranteed to not collide with any existing IP.

View File

@ -570,6 +570,8 @@ type KubeDNSConfig struct {
type NodeLocalDNSConfig struct {
// Enabled activates the node-local-dns addon.
Enabled *bool `json:"enabled,omitempty"`
// ExternalCoreFile is used to provide a complete NodeLocalDNS CoreFile by the user - ignores other provided flags which modify the CoreFile.
ExternalCoreFile string `json:"externalCoreFile,omitempty"`
// Image overrides the default docker image used for node-local-dns addon.
Image *string `json:"image,omitempty"`
// Local listen IP address. It can be any IP in the 169.254.20.0/16 space or any other IP address that can be guaranteed to not collide with any existing IP.

View File

@ -6270,6 +6270,7 @@ func Convert_kops_NodeAuthorizerSpec_To_v1alpha2_NodeAuthorizerSpec(in *kops.Nod
func autoConvert_v1alpha2_NodeLocalDNSConfig_To_kops_NodeLocalDNSConfig(in *NodeLocalDNSConfig, out *kops.NodeLocalDNSConfig, s conversion.Scope) error {
out.Enabled = in.Enabled
out.ExternalCoreFile = in.ExternalCoreFile
out.Image = in.Image
out.LocalIP = in.LocalIP
out.ForwardToKubeDNS = in.ForwardToKubeDNS
@ -6286,6 +6287,7 @@ func Convert_v1alpha2_NodeLocalDNSConfig_To_kops_NodeLocalDNSConfig(in *NodeLoca
func autoConvert_kops_NodeLocalDNSConfig_To_v1alpha2_NodeLocalDNSConfig(in *kops.NodeLocalDNSConfig, out *NodeLocalDNSConfig, s conversion.Scope) error {
out.Enabled = in.Enabled
out.ExternalCoreFile = in.ExternalCoreFile
out.Image = in.Image
out.LocalIP = in.LocalIP
out.ForwardToKubeDNS = in.ForwardToKubeDNS

View File

@ -549,6 +549,8 @@ type KubeDNSConfig struct {
type NodeLocalDNSConfig struct {
// Enabled activates the node-local-dns addon.
Enabled *bool `json:"enabled,omitempty"`
// ExternalCoreFile is used to provide a complete NodeLocalDNS CoreFile by the user - ignores other provided flags which modify the CoreFile.
ExternalCoreFile string `json:"externalCoreFile,omitempty"`
// Image overrides the default docker image used for node-local-dns addon.
Image *string `json:"image,omitempty"`
// Local listen IP address. It can be any IP in the 169.254.20.0/16 space or any other IP address that can be guaranteed to not collide with any existing IP.

View File

@ -6487,6 +6487,7 @@ func Convert_kops_NetworkingSpec_To_v1alpha3_NetworkingSpec(in *kops.NetworkingS
func autoConvert_v1alpha3_NodeLocalDNSConfig_To_kops_NodeLocalDNSConfig(in *NodeLocalDNSConfig, out *kops.NodeLocalDNSConfig, s conversion.Scope) error {
out.Enabled = in.Enabled
out.ExternalCoreFile = in.ExternalCoreFile
out.Image = in.Image
out.LocalIP = in.LocalIP
out.ForwardToKubeDNS = in.ForwardToKubeDNS
@ -6503,6 +6504,7 @@ func Convert_v1alpha3_NodeLocalDNSConfig_To_kops_NodeLocalDNSConfig(in *NodeLoca
func autoConvert_kops_NodeLocalDNSConfig_To_v1alpha3_NodeLocalDNSConfig(in *kops.NodeLocalDNSConfig, out *NodeLocalDNSConfig, s conversion.Scope) error {
out.Enabled = in.Enabled
out.ExternalCoreFile = in.ExternalCoreFile
out.Image = in.Image
out.LocalIP = in.LocalIP
out.ForwardToKubeDNS = in.ForwardToKubeDNS

View File

@ -41,6 +41,9 @@ metadata:
addonmanager.kubernetes.io/mode: Reconcile
data:
Corefile: |
{{- if KubeDNS.NodeLocalDNS.ExternalCoreFile }}
{{ KubeDNS.NodeLocalDNS.ExternalCoreFile | indent 4 }}
{{- else }}
{{ KubeDNS.Domain }}:53 {
errors
cache {
@ -104,6 +107,7 @@ data:
{{- end }}
}
{{- end }}
{{- end }}
---
apiVersion: apps/v1
kind: DaemonSet