Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding NS support for Azure DNS #2835

Closed

Conversation

sebader
Copy link

@sebader sebader commented Jun 21, 2022

Description

This adds support for managing NS records in Azure DNS as well. Not sure if there was a particular reason why this wasn't already there.
Required in k8gb k8gb-io/k8gb#912

Fixes #2826

I did update the unit tests but I do need some help on updating the one for deletion. I am not sure what is still missing but it's still failing:

--- FAIL: TestAzureApplyChangesZoneName (0.00s)
    azure_test.go:271: 
                Error Trace:    azure_test.go:271
                                                        azure_test.go:512
                Error:          Should be true
                Test:           TestAzureApplyChangesZoneName
                Messages:       expected and actual endpoints don't match. [deleted.foo.example.com 0 IN A   [] deletedcname.foo.example.com 0 IN CNAME   [] old.foo.example.com 0 IN A   [] oldcname.foo.example.com 0 IN CNAME   []]:[old.foo.example.com 0 IN A   [] oldcname.foo.example.com 0 IN CNAME   [] ns-old.nope.example.com 0 IN NS   [] deleted.foo.example.com 0 IN A   [] deletedcname.foo.example.com 0 IN CNAME   []]
FAIL

Checklist

  • Unit tests updated
  • End user documentation updated

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 21, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jun 21, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @sebader!

It looks like this is your first PR to kubernetes-sigs/external-dns 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/external-dns has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot requested review from njuettner and Raffo June 21, 2022 15:51
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 21, 2022
@sebader
Copy link
Author

sebader commented Jun 24, 2022

@JAORMX as I wrote, this is not yet ready to be approved. One test is failing....

@njuettner @Raffo could you maybe please take a look at this and help me out so we can get this forward? thanks!

@Ziphone
Copy link

Ziphone commented Oct 18, 2022

@sebader: Anything remaining but the LGTMs?

@sebader
Copy link
Author

sebader commented Oct 18, 2022

@Ziphone there is still the failing tests which I need help with

@Ziphone
Copy link

Ziphone commented Oct 18, 2022

/test ?

@k8s-ci-robot
Copy link
Contributor

@Ziphone: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test ?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Ziphone
Copy link

Ziphone commented Oct 30, 2022

@sebader: The test fails because it expects this record to get deleted:
https://github.com/sebader/external-dns/blob/feature/sebader-azure-ns/provider/azure/azure_test.go#L508

What blocks the deletion is the domain filter of the test provider:
https://github.com/sebader/external-dns/blob/feature/sebader-azure-ns/provider/azure/azure_test.go#L546

The test will pass if you replace the occurrences of ns-old.nope.example.com with e.g ns-old.foo.example.com (in file provider/azure/azure_test.go). Guess subdomain nope.example.com was introduced to ensure that External DNS will not tamper with records outside the scope of the domain filter.

Please involve me if you don't have time to get this change through. Very grateful for your initiative.

@sebader
Copy link
Author

sebader commented Oct 31, 2022

@Ziphone awesome, thanks so much for this! Indeed it fixed the failing test

ready for review :)

@Ziphone
Copy link

Ziphone commented Dec 1, 2022

Any thoughts on when we can get a review here, @Raffo?

@ytsarev
Copy link
Member

ytsarev commented Jan 26, 2023

/assign @Raffo

Copy link
Member

@ytsarev ytsarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebader, thanks a lot for this work! Could you please squash the commits?

@sebader sebader force-pushed the feature/sebader-azure-ns branch from b1ad23d to a9481fa Compare January 30, 2023 16:10
@sebader
Copy link
Author

sebader commented Jan 30, 2023

@sebader, thanks a lot for this work! Could you please squash the commits?

done

Copy link
Contributor

@Raffo Raffo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good, can you add information to the docs that NS records will not work if the managed-record-type is not configured to also use NS records?

@sebader
Copy link
Author

sebader commented Feb 4, 2023

PR looks good, can you add information to the docs that NS records will not work if the managed-record-type is not configured to also use NS records?

sorry, @Raffo I'm not sure what you refer to?

@Raffo
Copy link
Contributor

Raffo commented Feb 5, 2023

@sebader without that flag ( see

app.Flag("managed-record-types", "Comma separated list of record types to manage (default: A, CNAME) (supported records: CNAME, A, NS").Default("A", "CNAME").StringsVar(&cfg.ManagedDNSRecordTypes)
) the NS records will not work. We don't want to enable NS records by default because ExternalDNS was never made to manage all DNS records, rather to enable simpler PaaS like workflows in which apps want to expose DNS records. To make this feature usable by users, we need to add that information to the tutorial.

I would also ask if you end-to-end tested this with azure because we don't really have infra to test on azure at this time, I'd be great if you can verify that everything works.

@sebader
Copy link
Author

sebader commented Feb 6, 2023

ah got it @Raffo. I added a note to the docs, is that ok?

Yes, I have tested the new NS records through k8gb - I guess there the managed-record-types is already set to enable NS under the hood, which is why I wasnt aware of this.

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 7, 2023
@ytsarev
Copy link
Member

ytsarev commented May 8, 2023

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 8, 2023
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 16, 2023
@mloiseleur
Copy link
Contributor

mloiseleur commented Dec 20, 2023

@sebader Do you think you can rebase this PR ?

@sebader
Copy link
Author

sebader commented Dec 20, 2023

@sebader Sebastian Bader FTE Do you think you can rebase this PR ?

puh... I haven't touched this in ages and not even a working local setup for this at the moment. But if anybody else could pick this up, as you can see, the actual change was pretty minimal to re-create that from scratch.

@mloiseleur
Copy link
Contributor

Ok. I'll close this PR then.
If/when anyone needs it, a new PR can be opened.
/close

@k8s-ci-robot
Copy link
Contributor

@mloiseleur: Closed this PR.

In response to this:

Ok. I'll close this PR then.
If/when anyone needs it, a new PR can be opened.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ytsarev
Copy link
Member

ytsarev commented Jan 2, 2024

/reopen

I would love to get this PR merged and avoid running a fork with NS support in https://github.com/k8gb-io/external-dns

@k8s-ci-robot k8s-ci-robot reopened this Jan 2, 2024
@k8s-ci-robot
Copy link
Contributor

@ytsarev: Reopened this PR.

In response to this:

/reopen

I would love to get this PR merged and avoid running a fork with NS support in https://github.com/k8gb-io/external-dns

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: JAORMX
Once this PR has been reviewed and has the lgtm label, please ask for approval from raffo. For more information see the Kubernetes Code Review Process.

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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mloiseleur
Copy link
Contributor

@ytsarev Sure. Do you think you can make your own or rebase this PR, then ?

@ytsarev
Copy link
Member

ytsarev commented Jan 2, 2024

@mloiseleur yes, I will be also able to test it e2e

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 1, 2024
@ytsarev
Copy link
Member

ytsarev commented Apr 1, 2024

/remove-lifecycle stale

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 1, 2024
@ytsarev
Copy link
Member

ytsarev commented May 2, 2024

/remove-lifecycle stale

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ytsarev
Copy link
Member

ytsarev commented Jun 1, 2024

we will switch to new webhook based implementation and eventually contribute NS support to this one

abaguas added a commit to abaguas/external-dns that referenced this pull request Nov 4, 2024
Azure supports NS records on public DNS zones: https://learn.microsoft.com/en-us/rest/api/dns/record-sets/create-or-update?view=rest-dns-2018-05-01&tabs=HTTP#create-ns-recordset
This PR adds this support to external dns. The implementation is similar to the other records.

Besides the unit tests this PR was also tested by creating a DNSEndpoint with the following spec:
```
    endpoints:
    - dnsName: cloud.k8gb.io
      recordTTL: 5
      recordType: NS
      targets:
      - gslb-ns-eu-cloud.k8gb.io
      - gslb-ns-us-cloud.k8gb.io
```
The creation of the NS record in Azure was successful:
```
az network dns record-set ns list --resource-group rg-k8gb  --zone-name "$EDGE_DNS_ZONE" --output json
[
  {...},
  {
    "NSRecords": [
      {
        "nsdname": "gslb-ns-eu-cloud.k8gb.io"
      },
      {
        "nsdname": "gslb-ns-us-cloud.k8gb.io"
      }
    ],
    "TTL": 5,
    "etag": "97a7199f-3be9-47bd-ab00-37013b775180",
    "fqdn": "cloud.k8gb.io.",
    "id": "/subscriptions/<redacted>/resourceGroups/rg-k8gb/providers/Microsoft.Network/dnszones/k8gb.io/NS/cloud",
    "name": "cloud",
    "provisioningState": "Succeeded",
    "resourceGroup": "rg-k8gb",
    "targetResource": {},
    "trafficManagementProfile": {},
    "type": "Microsoft.Network/dnszones/NS"
  }
]
```

This change was already attempted in kubernetes-sigs#2835, but it was never merged due to inactivity.

Signed-off-by: Andre Aguas <andre.aguas@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for NS records for Azure DNS
8 participants