Skip to content

Commit

Permalink
Merge pull request #10059 from olemarkus/nld-no-iptables
Browse files Browse the repository at this point in the history
Simplify node local dns
  • Loading branch information
k8s-ci-robot authored Oct 16, 2020
2 parents a466d1f + 29a1cb2 commit e3b050a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 deletions.
3 changes: 1 addition & 2 deletions pkg/model/components/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ func (b *KubeletOptionsBuilder) BuildOptions(o interface{}) error {
}

if clusterSpec.Kubelet.ClusterDNS == "" {
if clusterSpec.KubeDNS != nil && clusterSpec.KubeDNS.NodeLocalDNS != nil && fi.BoolValue(clusterSpec.KubeDNS.NodeLocalDNS.Enabled) &&
((clusterSpec.KubeProxy != nil && clusterSpec.KubeProxy.ProxyMode == "ipvs") || (clusterSpec.Networking != nil && clusterSpec.Networking.Cilium != nil)) {
if clusterSpec.KubeDNS != nil && clusterSpec.KubeDNS.NodeLocalDNS != nil && fi.BoolValue(clusterSpec.KubeDNS.NodeLocalDNS.Enabled) {
clusterSpec.Kubelet.ClusterDNS = clusterSpec.KubeDNS.NodeLocalDNS.LocalIP
} else {
ip, err := WellKnownServiceIP(clusterSpec, 10)
Expand Down
20 changes: 10 additions & 10 deletions upup/models/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ data:
}
reload
loop
bind {{ KubeDNS.NodeLocalDNS.LocalIP }}{{ if NodeLocalDNSServerIP }} {{ NodeLocalDNSServerIP }}{{ end }}
bind {{ KubeDNS.NodeLocalDNS.LocalIP }}
forward . {{ NodeLocalDNSClusterIP }} {
force_tcp
}
Expand All @@ -62,7 +62,7 @@ data:
cache 30
reload
loop
bind {{ KubeDNS.NodeLocalDNS.LocalIP }}{{ if NodeLocalDNSServerIP }} {{ NodeLocalDNSServerIP }}{{ end }}
bind {{ KubeDNS.NodeLocalDNS.LocalIP }}
forward . {{ NodeLocalDNSClusterIP }} {
force_tcp
}
Expand All @@ -73,7 +73,7 @@ data:
cache 30
reload
loop
bind {{ KubeDNS.NodeLocalDNS.LocalIP }}{{ if NodeLocalDNSServerIP }} {{ NodeLocalDNSServerIP }}{{ end }}
bind {{ KubeDNS.NodeLocalDNS.LocalIP }}
forward . {{ NodeLocalDNSClusterIP }} {
force_tcp
}
Expand All @@ -84,7 +84,7 @@ data:
cache 30
reload
loop
bind {{ KubeDNS.NodeLocalDNS.LocalIP }}{{ if NodeLocalDNSServerIP }} {{ NodeLocalDNSServerIP }}{{ end }}
bind {{ KubeDNS.NodeLocalDNS.LocalIP }}
forward . __PILLAR__UPSTREAM__SERVERS__
prometheus :9253
}
Expand Down Expand Up @@ -126,16 +126,16 @@ spec:
operator: "Exists"
containers:
- name: node-cache
image: k8s.gcr.io/k8s-dns-node-cache:1.15.10
image: k8s.gcr.io/dns/k8s-dns-node-cache:1.15.14
resources:
requests:
cpu: {{ KubeDNS.NodeLocalDNS.CPURequest }}
memory: {{ KubeDNS.NodeLocalDNS.MemoryRequest }}
{{ if NodeLocalDNSServerIP }}
args: [ "-localip", "{{ .KubeDNS.NodeLocalDNS.LocalIP }},{{ NodeLocalDNSServerIP }}", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ]
{{ else }}
args: [ "-localip", "{{ .KubeDNS.NodeLocalDNS.LocalIP }}", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ]
{{ end }}
args:
- -localip={{ .KubeDNS.NodeLocalDNS.LocalIP }}
- -conf=/etc/Corefile
- -upstreamsvc=kube-dns-upstream
- -setupiptables=false
securityContext:
privileged: true
ports:
Expand Down
6 changes: 0 additions & 6 deletions upup/pkg/fi/cloudup/template_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,6 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap, secretStore fi.SecretS
}
return "__PILLAR__CLUSTER__DNS__"
}
dest["NodeLocalDNSServerIP"] = func() string {
if cluster.Spec.KubeProxy.ProxyMode == "ipvs" {
return ""
}
return cluster.Spec.KubeDNS.ServerIP
}
dest["NodeLocalDNSHealthCheck"] = func() string {
return fmt.Sprintf("%d", wellknownports.NodeLocalDNSHealthCheck)
}
Expand Down

0 comments on commit e3b050a

Please sign in to comment.