Skip to content

Commit

Permalink
Merge pull request #16005 from hakman/dns_none_default
Browse files Browse the repository at this point in the history
Use dns=none for newly created clusters except for AWS and GCE
  • Loading branch information
k8s-ci-robot committed Oct 9, 2023
2 parents 614efad + 4632188 commit 66835ec
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
1 change: 0 additions & 1 deletion cmd/kops/create_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ type CreateClusterOptions struct {
ContainerRuntime string
OutDir string
DisableSubnetTags bool
DNSZone string
NodeSecurityGroups []string
ControlPlaneSecurityGroups []string
AssociatePublicIP *bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ ControlPlaneImage: ami-control-plane
NodeImage: ami-worker-image
Bastion: true
Topology: private
DNSType: public
APIServerCount: 1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ spec:
zone: us-test1
topology:
dns:
type: Private
type: None

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ spec:
zone: us-test1
topology:
dns:
type: Private
type: None

---

Expand Down
21 changes: 12 additions & 9 deletions upup/pkg/fi/cloudup/new_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ type NewClusterOptions struct {
Topology string
// DNSType is the DNS type to use; "public" or "private". Defaults to "public".
DNSType string
// DNSZone is the DNS zone to use.
DNSZone string

// APILoadBalancerClass determines whether to use classic or network load balancers for the API
APILoadBalancerClass string
Expand Down Expand Up @@ -1376,16 +1378,17 @@ func setupTopology(opt *NewClusterOptions, cluster *api.Cluster, allZones sets.S
func setupDNSTopology(opt *NewClusterOptions, cluster *api.Cluster) error {
switch strings.ToLower(opt.DNSType) {
case "":
switch cluster.Spec.GetCloudProvider() {
case api.CloudProviderHetzner, api.CloudProviderDO, api.CloudProviderAzure:
// Use dns=none if not specified
if opt.DNSZone != "" {
// Use dns=public if zone is specified
cluster.Spec.Networking.Topology.DNS = api.DNSTypePublic
} else if cluster.UsesLegacyGossip() {
// Use dns=none if .k8s.local is specified instead of Gossip
klog.Warningf("Gossip is deprecated, using None DNS instead")
cluster.Spec.Networking.Topology.DNS = api.DNSTypeNone
} else if cluster.Spec.GetCloudProvider() == api.CloudProviderAWS || cluster.Spec.GetCloudProvider() == api.CloudProviderGCE {
cluster.Spec.Networking.Topology.DNS = api.DNSTypePublic
} else {
cluster.Spec.Networking.Topology.DNS = api.DNSTypeNone
default:
if cluster.UsesLegacyGossip() {
cluster.Spec.Networking.Topology.DNS = api.DNSTypePrivate
} else {
cluster.Spec.Networking.Topology.DNS = api.DNSTypePublic
}
}
case "public":
cluster.Spec.Networking.Topology.DNS = api.DNSTypePublic
Expand Down

0 comments on commit 66835ec

Please sign in to comment.