mirror of https://github.com/kubernetes/kops.git
Merge pull request #14846 from hakman/gossip_to_dns-none
Allow migration from Gossip DNS to no DNS
This commit is contained in:
commit
b647e4413f
|
|
@ -820,10 +820,10 @@ func (c *Cluster) IsSharedAzureRouteTable() bool {
|
|||
}
|
||||
|
||||
func (c *Cluster) IsGossip() bool {
|
||||
if dns.IsGossipClusterName(c.Name) {
|
||||
return true
|
||||
}
|
||||
if c.UsesNoneDNS() || !dns.IsGossipClusterName(c.Name) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (c *Cluster) UsesPublicDNS() bool {
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ data:
|
|||
fallthrough in-addr.arpa ip6.arpa
|
||||
ttl 30
|
||||
}
|
||||
{{- if GossipDomains }}
|
||||
hosts /rootfs/etc/hosts {{ join " " GossipDomains }} {
|
||||
{{- if GossipName }}
|
||||
hosts /rootfs/etc/hosts k8s.local {
|
||||
ttl 30
|
||||
fallthrough
|
||||
}
|
||||
|
|
@ -167,7 +167,7 @@ spec:
|
|||
- name: config-volume
|
||||
mountPath: /etc/coredns
|
||||
readOnly: true
|
||||
{{- if GossipDomains }}
|
||||
{{- if GossipName }}
|
||||
- name: etc-hosts
|
||||
mountPath: /rootfs/etc/hosts
|
||||
readOnly: true
|
||||
|
|
@ -209,7 +209,7 @@ spec:
|
|||
- name: config-volume
|
||||
configMap:
|
||||
name: coredns
|
||||
{{- if GossipDomains }}
|
||||
{{- if GossipName }}
|
||||
- name: etc-hosts
|
||||
hostPath:
|
||||
path: /etc/hosts
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ rules:
|
|||
- list
|
||||
- watch
|
||||
- patch
|
||||
{{- if GossipDomains }}
|
||||
{{- if GossipEnabled }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
|
|
@ -213,7 +213,7 @@ rules:
|
|||
- leases
|
||||
verbs:
|
||||
- create
|
||||
{{- if GossipDomains }}
|
||||
{{- if GossipEnabled }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
|
|
|
|||
|
|
@ -45,15 +45,14 @@ import (
|
|||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/kops/pkg/flagbuilder"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
kopscontrollerconfig "k8s.io/kops/cmd/kops-controller/pkg/config"
|
||||
"k8s.io/kops/pkg/apis/kops"
|
||||
apiModel "k8s.io/kops/pkg/apis/kops/model"
|
||||
"k8s.io/kops/pkg/apis/kops/util"
|
||||
"k8s.io/kops/pkg/apis/nodeup"
|
||||
"k8s.io/kops/pkg/dns"
|
||||
"k8s.io/kops/pkg/featureflag"
|
||||
"k8s.io/kops/pkg/flagbuilder"
|
||||
"k8s.io/kops/pkg/kubemanifest"
|
||||
"k8s.io/kops/pkg/model"
|
||||
"k8s.io/kops/pkg/model/components/kopscontroller"
|
||||
|
|
@ -66,6 +65,7 @@ import (
|
|||
gcetpm "k8s.io/kops/upup/pkg/fi/cloudup/gce/tpm"
|
||||
"k8s.io/kops/upup/pkg/fi/cloudup/hetzner"
|
||||
"k8s.io/kops/util/pkg/env"
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
|
||||
// TemplateFunctions provides a collection of methods used throughout the templates
|
||||
|
|
@ -124,14 +124,17 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap, secretStore fi.SecretS
|
|||
return cluster.Spec.KubeDNS
|
||||
}
|
||||
|
||||
dest["GossipDomains"] = func() []string {
|
||||
var names []string
|
||||
|
||||
dest["GossipEnabled"] = func() bool {
|
||||
if cluster.IsGossip() {
|
||||
names = append(names, "k8s.local")
|
||||
return true
|
||||
}
|
||||
|
||||
return names
|
||||
return false
|
||||
}
|
||||
dest["GossipName"] = func() bool {
|
||||
if dns.IsGossipClusterName(cluster.Name) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
dest["NodeLocalDNSClusterIP"] = func() string {
|
||||
|
|
|
|||
Loading…
Reference in New Issue