mirror of
https://github.com/kubernetes-sigs/kind.git
synced 2025-12-01 07:26:05 +07:00
Add dnsSearch cluster option
Fixes https://github.com/kubernetes-sigs/kind/issues/3097
This commit is contained in:
@@ -189,6 +189,8 @@ type Networking struct {
|
||||
// KubeProxyMode defines if kube-proxy should operate in iptables or ipvs mode
|
||||
// Defaults to 'iptables' mode
|
||||
KubeProxyMode ProxyMode `yaml:"kubeProxyMode,omitempty" json:"kubeProxyMode,omitempty"`
|
||||
// DNSSearch defines the DNS search domain to use for nodes. If not set, this will be inherited from the host.
|
||||
DNSSearch *[]string `yaml:"dnsSearch,omitempty" json:"dnsSearch,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterIPFamily defines cluster network IP family
|
||||
|
||||
@@ -199,6 +199,22 @@ func commonArgs(cluster string, cfg *config.Cluster, networkName string, nodeNam
|
||||
if mountFuse() {
|
||||
args = append(args, "--device", "/dev/fuse")
|
||||
}
|
||||
|
||||
if cfg.Networking.DNSSearch != nil {
|
||||
if len(*cfg.Networking.DNSSearch) == 0 {
|
||||
return nil, errors.New("docker provider requires a non-empty dnsSearch")
|
||||
}
|
||||
for _, s := range *cfg.Networking.DNSSearch {
|
||||
args = append(args, "--dns-search", s)
|
||||
}
|
||||
args = append(args, "--dns", "8.8.8.8")
|
||||
args = append(args, "--dns", "8.8.4.4")
|
||||
if config.ClusterHasIPv6(cfg) {
|
||||
args = append(args, "--dns", "2001:4860:4860::8888")
|
||||
args = append(args, "--dns", "2001:4860:4860::8844")
|
||||
}
|
||||
}
|
||||
|
||||
return args, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -164,6 +164,15 @@ func commonArgs(cfg *config.Cluster, networkName string, nodeNames []string) ([]
|
||||
args = append(args, "--device", "/dev/fuse")
|
||||
}
|
||||
|
||||
if cfg.Networking.DNSSearch != nil {
|
||||
if len(*cfg.Networking.DNSSearch) == 0 {
|
||||
args = append(args, "--dns-search", "")
|
||||
}
|
||||
for _, s := range *cfg.Networking.DNSSearch {
|
||||
args = append(args, "--dns-search", s)
|
||||
}
|
||||
}
|
||||
|
||||
return args, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ func convertv1alpha4Networking(in *v1alpha4.Networking, out *Networking) {
|
||||
out.KubeProxyMode = ProxyMode(in.KubeProxyMode)
|
||||
out.ServiceSubnet = in.ServiceSubnet
|
||||
out.DisableDefaultCNI = in.DisableDefaultCNI
|
||||
out.DNSSearch = in.DNSSearch
|
||||
}
|
||||
|
||||
func convertv1alpha4Mount(in *v1alpha4.Mount, out *Mount) {
|
||||
|
||||
@@ -150,6 +150,8 @@ type Networking struct {
|
||||
DisableDefaultCNI bool
|
||||
// KubeProxyMode defines if kube-proxy should operate in iptables or ipvs mode
|
||||
KubeProxyMode ProxyMode
|
||||
// DNSSearch defines the DNS search domain to use for nodes. If not set, this will be inherited from the host.
|
||||
DNSSearch *[]string
|
||||
}
|
||||
|
||||
// ClusterIPFamily defines cluster network IP family
|
||||
|
||||
Reference in New Issue
Block a user