{"record":{"id":"0d12609f7963af13","repo":"kubernetes/kops","slug":"dns-provider-t-does-not-support-zones","errorCode":null,"errorMessage":"dns provider %T does not support zones","messagePattern":"dns provider %T does not support zones","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/utils.go","lineNumber":241,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error initializing Akamai (Linode) cloud: %w\", err)\n\t\t}\n\n\t\tcloud = linodeCloud\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown CloudProvider %q\", cluster.GetCloudProvider())\n\t}\n\treturn cloud, nil\n}\n\nfunc FindDNSHostedZone(dns dnsprovider.Interface, clusterDNSName string, dnsType kops.DNSType) (string, error) {\n\tklog.V(2).Infof(\"Querying for all DNS zones to find match for %q\", clusterDNSName)\n\n\tclusterDNSName = \".\" + strings.TrimSuffix(clusterDNSName, \".\")\n\n\tzonesProvider, ok := dns.Zones()\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"dns provider %T does not support zones\", dns)\n\t}\n\n\tallZones, err := zonesProvider.List()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error querying zones: %v\", err)\n\t}\n\n\tvar zones []dnsprovider.Zone\n\tfor _, z := range allZones {\n\t\tzoneName := \".\" + strings.TrimSuffix(z.Name(), \".\")\n\n\t\tif !strings.HasSuffix(clusterDNSName, zoneName) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif dnsType != \"\" {\n\t\t\tif awsZone, ok := z.(*route53.Zone); ok {\n\t\t\t\thostedZone := awsZone.Route53HostedZone()","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/utils.go#L223-L259","documentation":"FindDNSHostedZone obtains the zone-listing capability from the configured DNS provider via dns.Zones(). The dnsprovider.Interface contract says the bool result is false when the provider cannot list zones. kops needs zone enumeration to match the cluster DNS name to a hosted zone, so a provider without zone support fails here.","triggerScenarios":"Calling FindDNSHostedZone (via the update/create run path) with a dnsprovider.Interface implementation whose Zones() returns (nil, false) — e.g. a stub or unsupported provider such as a gossip-based provider being asked for hosted zones, or a misconfigured DNS provider plugin.","commonSituations":"Using gossip DNS but expecting hosted-zone discovery; a DNS provider built without its zone-listing backend (e.g. missing cloud credentials cause the provider to report no zone support); custom/embedded kops controller code passing a minimal fake provider.","solutions":["Use a supported external-DNS provider (aws/route53, gcloud/dns, azure) in cluster.spec so dns.Zones() is backed by a real implementation.","If gossip is intended, do not route through FindDNSHostedZone — configure kopsModelContext to skip hosted-zone lookup for gossip clusters.","If writing custom code against dnsprovider.Interface, verify `zones, ok := dns.Zones(); ok` before calling List."],"exampleFix":"// before\nid, err := FindDNSHostedZone(provider, name, dnsType) // provider has no zones\n// after\nif zones, ok := provider.Zones(); !ok {\n    return fmt.Errorf(\"provider %T cannot list zones\", provider)\n}\nid, err := FindDNSHostedZone(provider, name, dnsType)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"zonesProvider, ok := dns.Zones()\nif !ok {\n    return fmt.Errorf(\"dns provider %T does not support zone listing\", dns)\n}","tryCatchPattern":null,"preventionTips":["Use a DNS provider implementation known to support Zones() (route53, google, azure).","Don't run hosted-zone discovery against gossip-DNS clusters.","Check the ok boolean from Zones() before every List() call."],"tags":["dns","dnsprovider","hosted-zone"],"backgroundTag":"dns-provider-unsupported-operation","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}