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

Inconsistent behavior between Azure DNS and Azure Private DNS #4372

Open
khuedoan opened this issue Apr 9, 2024 · 4 comments
Open

Inconsistent behavior between Azure DNS and Azure Private DNS #4372

khuedoan opened this issue Apr 9, 2024 · 4 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@khuedoan
Copy link
Contributor

khuedoan commented Apr 9, 2024

What happened:

Thank you for the project! We use ExternalDNS to manage DNS for our Kubernetes clusters with Azure Private DNS. Here's our setup and example use case (with sensitive values replaced by placeholders):

  • Azure Private DNS zone: a single internal.example.com zone
  • Kubernetes clusters: cluster-1, cluster-2
  • Applications: service-a (deployed to cluster-1) and service-b (deployed to cluster-2)

The applications deployed to each cluster will have the following hosts in their Ingress object (following the $APP.$CLUSTER.internal.example.com convention):

  • service-a.cluster-1.internal.example.com
  • service-b.cluster-2.internal.example.com

Each cluster has a separate ExternalDNS controller.

Because each cluster is managed by a different team, we want to avoid accidental misconfiguration by specifying --domain-filter to limit the scope of ExternalDNS on each cluster to only Ingress hostnames with the $CLUSTER.internal.example.com suffix.

But when we add --domain-filter=$CLUSTER.internal.example.com, we get the following error:

Ignoring changes to 'service-a.cluster-1.internal.example.com' because a suitable Azure Private DNS zone was not found

(It does work without the --domain-filter flag)

After reading the code we noticed that --domain-filter actually filters the zone name, not the domain name in Ingress object, and the Azure DNS provider (--privider=azure) has an optional --zone-name-filter flag that changes the behaviour of --domain-filter to filter Ingress domains instead (implemented in #1060), but there's no implementation for that flag in the Azure Private DNS provider (--provider=azure-private-dns)

What you expected to happen:

Initially, I expected the --domain-filter flag to filter the hostnames in Ingress spec.rules.*.host, but seems like I misunderstood and it's a design decision.

If I understand correctly, the --zone-name-filter flag was added to Azure DNS to alter the behavior of --domain-filter to make it backward compatible and avoid breaking changes.

If that's the case, I expect Azure Private DNS to have the same consistent behaviour as Azure (public) DNS. I created a PR (#4346) to port the same feature to Azure Private DNS.

How to reproduce it (as minimally and precisely as possible):

Here's the relevant ExternalDNS configuration:

Cluster 1:

--registry=txt
--txt-owner-id=cluster-1
--domain-filter=cluster-1.internal.example.com
--provider=azure-private-dns

Cluster 2:

--registry=txt
--txt-owner-id=cluster-2
--domain-filter=cluster-2.internal.example.com
--provider=azure-private-dns

Anything else we need to know?:

Environment:

  • External-DNS version (use external-dns --version): v0.14.1
  • DNS provider: Azure Private DNS (not Azure DNS)
  • Others: we use AKS
@khuedoan khuedoan added the kind/bug Categorizes issue or PR as related to a bug. label Apr 9, 2024
@mloiseleur
Copy link
Contributor

I understand this frustration of different behavior between both Azure providers.
Nonetheless, this current behavior of changing one parameter behavior when a second one is set is bad UserXP.

After reading the code, we noticed that --domain-filter actually filters the zone name, not the domain name in Ingress object

A parameter named domain-filter should filter domain name, not zone name.
So if I follow you correctly, this is that behavior that should be changed and fixed, for both Azure providers.

@Raffo @szuecs Wdyt ?

@khuedoan
Copy link
Contributor Author

I totally agree with that, if we decide to do so I'm happy to submit a new PR

@szuecs
Copy link
Contributor

szuecs commented Apr 25, 2024

@khuedoan For migration purposes, I would say if we want to change the flag behavior, we need to have multiple steps:

  1. provide the current (--domain-filter) style by adding --zone-filter
  2. add a minor release to notify the other will change and everyone should migrate before the next minor release
  3. next minor release will break the --domain-filter behavior.

I think the faster way to enable you would be to review and merge your PR.

@khuedoan
Copy link
Contributor Author

Sounds good to me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants