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 {
|
func (c *Cluster) IsGossip() bool {
|
||||||
if dns.IsGossipClusterName(c.Name) {
|
if c.UsesNoneDNS() || !dns.IsGossipClusterName(c.Name) {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cluster) UsesPublicDNS() bool {
|
func (c *Cluster) UsesPublicDNS() bool {
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,8 @@ data:
|
||||||
fallthrough in-addr.arpa ip6.arpa
|
fallthrough in-addr.arpa ip6.arpa
|
||||||
ttl 30
|
ttl 30
|
||||||
}
|
}
|
||||||
{{- if GossipDomains }}
|
{{- if GossipName }}
|
||||||
hosts /rootfs/etc/hosts {{ join " " GossipDomains }} {
|
hosts /rootfs/etc/hosts k8s.local {
|
||||||
ttl 30
|
ttl 30
|
||||||
fallthrough
|
fallthrough
|
||||||
}
|
}
|
||||||
|
|
@ -167,7 +167,7 @@ spec:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
mountPath: /etc/coredns
|
mountPath: /etc/coredns
|
||||||
readOnly: true
|
readOnly: true
|
||||||
{{- if GossipDomains }}
|
{{- if GossipName }}
|
||||||
- name: etc-hosts
|
- name: etc-hosts
|
||||||
mountPath: /rootfs/etc/hosts
|
mountPath: /rootfs/etc/hosts
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
|
@ -209,7 +209,7 @@ spec:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
configMap:
|
configMap:
|
||||||
name: coredns
|
name: coredns
|
||||||
{{- if GossipDomains }}
|
{{- if GossipName }}
|
||||||
- name: etc-hosts
|
- name: etc-hosts
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /etc/hosts
|
path: /etc/hosts
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ rules:
|
||||||
- list
|
- list
|
||||||
- watch
|
- watch
|
||||||
- patch
|
- patch
|
||||||
{{- if GossipDomains }}
|
{{- if GossipEnabled }}
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- ""
|
- ""
|
||||||
resources:
|
resources:
|
||||||
|
|
@ -213,7 +213,7 @@ rules:
|
||||||
- leases
|
- leases
|
||||||
verbs:
|
verbs:
|
||||||
- create
|
- create
|
||||||
{{- if GossipDomains }}
|
{{- if GossipEnabled }}
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- ""
|
- ""
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
|
|
@ -45,15 +45,14 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
"k8s.io/kops/pkg/flagbuilder"
|
|
||||||
"sigs.k8s.io/yaml"
|
|
||||||
|
|
||||||
kopscontrollerconfig "k8s.io/kops/cmd/kops-controller/pkg/config"
|
kopscontrollerconfig "k8s.io/kops/cmd/kops-controller/pkg/config"
|
||||||
"k8s.io/kops/pkg/apis/kops"
|
"k8s.io/kops/pkg/apis/kops"
|
||||||
apiModel "k8s.io/kops/pkg/apis/kops/model"
|
apiModel "k8s.io/kops/pkg/apis/kops/model"
|
||||||
"k8s.io/kops/pkg/apis/kops/util"
|
"k8s.io/kops/pkg/apis/kops/util"
|
||||||
"k8s.io/kops/pkg/apis/nodeup"
|
"k8s.io/kops/pkg/apis/nodeup"
|
||||||
|
"k8s.io/kops/pkg/dns"
|
||||||
"k8s.io/kops/pkg/featureflag"
|
"k8s.io/kops/pkg/featureflag"
|
||||||
|
"k8s.io/kops/pkg/flagbuilder"
|
||||||
"k8s.io/kops/pkg/kubemanifest"
|
"k8s.io/kops/pkg/kubemanifest"
|
||||||
"k8s.io/kops/pkg/model"
|
"k8s.io/kops/pkg/model"
|
||||||
"k8s.io/kops/pkg/model/components/kopscontroller"
|
"k8s.io/kops/pkg/model/components/kopscontroller"
|
||||||
|
|
@ -66,6 +65,7 @@ import (
|
||||||
gcetpm "k8s.io/kops/upup/pkg/fi/cloudup/gce/tpm"
|
gcetpm "k8s.io/kops/upup/pkg/fi/cloudup/gce/tpm"
|
||||||
"k8s.io/kops/upup/pkg/fi/cloudup/hetzner"
|
"k8s.io/kops/upup/pkg/fi/cloudup/hetzner"
|
||||||
"k8s.io/kops/util/pkg/env"
|
"k8s.io/kops/util/pkg/env"
|
||||||
|
"sigs.k8s.io/yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TemplateFunctions provides a collection of methods used throughout the templates
|
// 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
|
return cluster.Spec.KubeDNS
|
||||||
}
|
}
|
||||||
|
|
||||||
dest["GossipDomains"] = func() []string {
|
dest["GossipEnabled"] = func() bool {
|
||||||
var names []string
|
|
||||||
|
|
||||||
if cluster.IsGossip() {
|
if cluster.IsGossip() {
|
||||||
names = append(names, "k8s.local")
|
return true
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
return names
|
}
|
||||||
|
dest["GossipName"] = func() bool {
|
||||||
|
if dns.IsGossipClusterName(cluster.Name) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
dest["NodeLocalDNSClusterIP"] = func() string {
|
dest["NodeLocalDNSClusterIP"] = func() string {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue