kubernetes/kops

Private dns=none clusters incorrectly creating bastion DNS name tasks

Closed this issue · 0 comments

/kind bug
/kind failing-test

https://testgrid.k8s.io/kops-misc#kops-aws-private

kops is trying to create a DNS record for the bastion hosts:

 I0208 03:29:19.850427   14272 loader.go:90] Known tasks:
...
I0208 03:29:19.850581   14272 loader.go:92]   DNSName/bastion.e2e-e2e-kops-aws-private.test-cncf-aws.k8s.io
I0208 03:29:19.850589   14272 loader.go:92]   DNSName/bastion.e2e-e2e-kops-aws-private.test-cncf-aws.k8s.io-AAAA 

which then fails because the DNSZone task hasn't been defined, because the cluster uses dns=none:

Error: error building tasks: unexpected error resolving task "DNSName/bastion.e2e-e2e-kops-aws-private.test-cncf-aws.k8s.io": unable to find task "DNSZone/", referenced from DNSName/bastion.e2e-e2e-kops-aws-private.test-cncf-aws.k8s.io:Zone

The cluster.yaml shows a bastion's public name field is set:

  topology:
    bastion:
      bastionPublicName: bastion.e2e-e2e-kops-aws-private.test-cncf-aws.k8s.io
    dns:
      type: None

which is what creates the bastion DNSName tasks:

publicName := ""
if b.Cluster.Spec.Networking.Topology != nil && b.Cluster.Spec.Networking.Topology.Bastion != nil {
publicName = b.Cluster.Spec.Networking.Topology.Bastion.PublicName
}
if publicName != "" {
// Here we implement the bastion CNAME logic
// By default bastions will create a CNAME that follows the `bastion-$clustername` formula
t := &awstasks.DNSName{
Name: fi.PtrTo(publicName),

what I dont understand is how that field is being set in the cluster spec, because new_cluster.go only sets it if we're publishing DNS records:

if cluster.PublishesDNSRecords() {
cluster.Spec.Networking.Topology.Bastion = &api.BastionSpec{
PublicName: "bastion." + cluster.Name,
}
}

func (c *Cluster) PublishesDNSRecords() bool {
if c.UsesNoneDNS() || dns.IsGossipClusterName(c.Name) {
return false
}
return true
}

If we can have kops stop populating that cluster spec field for dns=none clusters, the DNSName tasks should stop being added.