kubernetes-sigs / external-dns

Configure external DNS servers (AWS Route53, Google CloudDNS and others) for Kubernetes Ingresses and Services
Apache License 2.0
7.76k stars 2.58k forks source link

fix(Google DNS): ensure trailing dot on NS records #4847

Closed abaguas closed 1 week ago

abaguas commented 3 weeks ago

Description

NS records added in Google Cloud DNS must have a trailing dot. Otherwise the API throws the following error:

time="2024-11-04T10:34:20Z" level=error msg="googleapi: Error 400: Invalid value for 'entity.change.additions[cloud.k8gb.io.][NS].rrdata[0]': 'gslb-ns-eu-cloud.k8gb.io', invalid"

This is similar to CNAME, MX and SRV records.


This change was tested with the a DNSEndpoint CRD containing the following endpoints:

    endpoints:
    - dnsName: cloud.k8gb.io
      recordTTL: 5
      recordType: NS
      targets:
      - gslb-ns-eu-cloud.k8gb.io
      - gslb-ns-us-cloud.k8gb.io
    - dnsName: gslb-ns-eu-cloud.k8gb.io

And the record was successfully created

gcloud dns record-sets list --zone="k8gb" --type=NS --name "cloud.k8gb.io."
NAME            TYPE  TTL  DATA
cloud.k8gb.io.  NS    5    gslb-ns-eu-cloud.k8gb.io.,gslb-ns-us-cloud.k8gb.io.

Checklist

k8s-ci-robot commented 3 weeks ago

Hi @abaguas. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
mloiseleur commented 2 weeks ago

Would you please add a test for this change ?

abaguas commented 2 weeks ago

Would you please add a test for this change ?

Ups. Done @mloiseleur

mloiseleur commented 2 weeks ago

/ok-to-test

mloiseleur commented 2 weeks ago

/lgtm

mloiseleur commented 1 week ago

/retitle fix(Google DNS): ensure trailing dot on NS records

Raffo commented 1 week ago

/approve

k8s-ci-robot commented 1 week ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Raffo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/external-dns/blob/master/OWNERS)~~ [Raffo] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment