diff --git a/tests/integration/update_cluster/minimal-dns-none/data/aws_s3_object_minimal.example.com-addons-bootstrap_content b/tests/integration/update_cluster/minimal-dns-none/data/aws_s3_object_minimal.example.com-addons-bootstrap_content index 8f1b282a48..5d8f3f2929 100644 --- a/tests/integration/update_cluster/minimal-dns-none/data/aws_s3_object_minimal.example.com-addons-bootstrap_content +++ b/tests/integration/update_cluster/minimal-dns-none/data/aws_s3_object_minimal.example.com-addons-bootstrap_content @@ -14,7 +14,7 @@ spec: version: 9.99.0 - id: k8s-1.12 manifest: coredns.addons.k8s.io/k8s-1.12.yaml - manifestHash: d2bbb7cbee5835c3891fe80fbacf8963508359ef9159f8480325ce9a7174f14a + manifestHash: 881d2ec248edb7ef6466985a51f30b4d50ec3e5f4997ca8fca95b03cb448d663 name: coredns.addons.k8s.io selector: k8s-addon: coredns.addons.k8s.io diff --git a/tests/integration/update_cluster/minimal-dns-none/data/aws_s3_object_minimal.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content b/tests/integration/update_cluster/minimal-dns-none/data/aws_s3_object_minimal.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content index 477b37ebbe..4b008730cd 100644 --- a/tests/integration/update_cluster/minimal-dns-none/data/aws_s3_object_minimal.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content +++ b/tests/integration/update_cluster/minimal-dns-none/data/aws_s3_object_minimal.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content @@ -80,6 +80,10 @@ data: fallthrough in-addr.arpa ip6.arpa ttl 30 } + hosts /rootfs/etc/hosts minimal.example.com { + ttl 30 + fallthrough + } prometheus :9153 forward . /etc/resolv.conf { max_concurrent 1000 @@ -180,6 +184,9 @@ spec: - mountPath: /etc/coredns name: config-volume readOnly: true + - mountPath: /rootfs/etc/hosts + name: etc-hosts + readOnly: true dnsPolicy: Default nodeSelector: kubernetes.io/os: linux @@ -205,6 +212,10 @@ spec: - configMap: name: coredns name: config-volume + - hostPath: + path: /etc/hosts + type: File + name: etc-hosts --- diff --git a/tests/integration/update_cluster/minimal_gce_dns-none/data/aws_s3_object_minimal-gce.example.com-addons-bootstrap_content b/tests/integration/update_cluster/minimal_gce_dns-none/data/aws_s3_object_minimal-gce.example.com-addons-bootstrap_content index bf95923fd4..7551a7ca53 100644 --- a/tests/integration/update_cluster/minimal_gce_dns-none/data/aws_s3_object_minimal-gce.example.com-addons-bootstrap_content +++ b/tests/integration/update_cluster/minimal_gce_dns-none/data/aws_s3_object_minimal-gce.example.com-addons-bootstrap_content @@ -14,7 +14,7 @@ spec: version: 9.99.0 - id: k8s-1.12 manifest: coredns.addons.k8s.io/k8s-1.12.yaml - manifestHash: d2bbb7cbee5835c3891fe80fbacf8963508359ef9159f8480325ce9a7174f14a + manifestHash: 9d6912241710a76fda7c973a9b116ca9da6d7827c57a0977e223b777018a5913 name: coredns.addons.k8s.io selector: k8s-addon: coredns.addons.k8s.io diff --git a/tests/integration/update_cluster/minimal_gce_dns-none/data/aws_s3_object_minimal-gce.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content b/tests/integration/update_cluster/minimal_gce_dns-none/data/aws_s3_object_minimal-gce.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content index 477b37ebbe..3cf3adacd5 100644 --- a/tests/integration/update_cluster/minimal_gce_dns-none/data/aws_s3_object_minimal-gce.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content +++ b/tests/integration/update_cluster/minimal_gce_dns-none/data/aws_s3_object_minimal-gce.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content @@ -80,6 +80,10 @@ data: fallthrough in-addr.arpa ip6.arpa ttl 30 } + hosts /rootfs/etc/hosts minimal-gce.example.com { + ttl 30 + fallthrough + } prometheus :9153 forward . /etc/resolv.conf { max_concurrent 1000 @@ -180,6 +184,9 @@ spec: - mountPath: /etc/coredns name: config-volume readOnly: true + - mountPath: /rootfs/etc/hosts + name: etc-hosts + readOnly: true dnsPolicy: Default nodeSelector: kubernetes.io/os: linux @@ -205,6 +212,10 @@ spec: - configMap: name: coredns name: config-volume + - hostPath: + path: /etc/hosts + type: File + name: etc-hosts --- diff --git a/tests/integration/update_cluster/minimal_hetzner/data/aws_s3_object_minimal.example.com-addons-bootstrap_content b/tests/integration/update_cluster/minimal_hetzner/data/aws_s3_object_minimal.example.com-addons-bootstrap_content index 361adc51c9..55ff5d81bb 100644 --- a/tests/integration/update_cluster/minimal_hetzner/data/aws_s3_object_minimal.example.com-addons-bootstrap_content +++ b/tests/integration/update_cluster/minimal_hetzner/data/aws_s3_object_minimal.example.com-addons-bootstrap_content @@ -14,7 +14,7 @@ spec: version: 9.99.0 - id: k8s-1.12 manifest: coredns.addons.k8s.io/k8s-1.12.yaml - manifestHash: d2bbb7cbee5835c3891fe80fbacf8963508359ef9159f8480325ce9a7174f14a + manifestHash: 881d2ec248edb7ef6466985a51f30b4d50ec3e5f4997ca8fca95b03cb448d663 name: coredns.addons.k8s.io selector: k8s-addon: coredns.addons.k8s.io diff --git a/tests/integration/update_cluster/minimal_hetzner/data/aws_s3_object_minimal.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content b/tests/integration/update_cluster/minimal_hetzner/data/aws_s3_object_minimal.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content index 477b37ebbe..4b008730cd 100644 --- a/tests/integration/update_cluster/minimal_hetzner/data/aws_s3_object_minimal.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content +++ b/tests/integration/update_cluster/minimal_hetzner/data/aws_s3_object_minimal.example.com-addons-coredns.addons.k8s.io-k8s-1.12_content @@ -80,6 +80,10 @@ data: fallthrough in-addr.arpa ip6.arpa ttl 30 } + hosts /rootfs/etc/hosts minimal.example.com { + ttl 30 + fallthrough + } prometheus :9153 forward . /etc/resolv.conf { max_concurrent 1000 @@ -180,6 +184,9 @@ spec: - mountPath: /etc/coredns name: config-volume readOnly: true + - mountPath: /rootfs/etc/hosts + name: etc-hosts + readOnly: true dnsPolicy: Default nodeSelector: kubernetes.io/os: linux @@ -205,6 +212,10 @@ spec: - configMap: name: coredns name: config-volume + - hostPath: + path: /etc/hosts + type: File + name: etc-hosts --- diff --git a/upup/models/cloudup/resources/addons/coredns.addons.k8s.io/k8s-1.12.yaml.template b/upup/models/cloudup/resources/addons/coredns.addons.k8s.io/k8s-1.12.yaml.template index 851faf1358..ee44c9367c 100644 --- a/upup/models/cloudup/resources/addons/coredns.addons.k8s.io/k8s-1.12.yaml.template +++ b/upup/models/cloudup/resources/addons/coredns.addons.k8s.io/k8s-1.12.yaml.template @@ -76,8 +76,8 @@ data: fallthrough in-addr.arpa ip6.arpa ttl 30 } - {{- if GossipName }} - hosts /rootfs/etc/hosts k8s.local { + {{- if not PublishesDNSRecords }} + hosts /rootfs/etc/hosts {{ ClusterDNSDomain }} { ttl 30 fallthrough } @@ -173,7 +173,7 @@ spec: - name: config-volume mountPath: /etc/coredns readOnly: true -{{- if GossipName }} +{{- if not PublishesDNSRecords }} - name: etc-hosts mountPath: /rootfs/etc/hosts readOnly: true @@ -220,7 +220,7 @@ spec: - name: config-volume configMap: name: coredns -{{- if GossipName }} +{{- if not PublishesDNSRecords }} - name: etc-hosts hostPath: path: /etc/hosts diff --git a/upup/pkg/fi/cloudup/template_functions.go b/upup/pkg/fi/cloudup/template_functions.go index 65fdae49ba..1881d23472 100644 --- a/upup/pkg/fi/cloudup/template_functions.go +++ b/upup/pkg/fi/cloudup/template_functions.go @@ -51,7 +51,6 @@ import ( apiModel "k8s.io/kops/pkg/apis/kops/model" "k8s.io/kops/pkg/apis/kops/util" "k8s.io/kops/pkg/bootstrap/pkibootstrap" - "k8s.io/kops/pkg/dns" "k8s.io/kops/pkg/featureflag" "k8s.io/kops/pkg/flagbuilder" "k8s.io/kops/pkg/kubemanifest" @@ -134,11 +133,14 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap, secretStore fi.SecretS } return false } - dest["GossipName"] = func() bool { - if dns.IsGossipClusterName(cluster.Name) { - return true + dest["PublishesDNSRecords"] = func() bool { + return cluster.PublishesDNSRecords() + } + dest["ClusterDNSDomain"] = func() string { + if cluster.UsesLegacyGossip() { + return "k8s.local" } - return false + return cluster.Name } dest["NodeLocalDNSClusterIP"] = func() string {