kubernetes-sigs / cluster-api-provider-azure

Cluster API implementation for Microsoft Azure
https://capz.sigs.k8s.io/
Apache License 2.0
296 stars 427 forks source link

BYO PrivateDNSZone from a different ResourceGroup #5273

Open snehala27 opened 2 days ago

snehala27 commented 2 days ago

/kind bug

[Before submitting an issue, have you checked the Troubleshooting Guide self-managed & managed?]

What steps did you take and what happened: CAPZ only takes DNSPrivateZone name as input and uses the cluster ResourceGroup for PrivateDNSZone(ref) If the zone is not present in cluster resource group, CAPZ creates the zone and manages lifecycle

Scenario-1

Scenario-2

What did you expect to happen: CAPZ should support taking PrivateDNSZone ResourceGroup as input or support a flag UseVNETResourceGroup for PrivateDNSZone

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]

Environment:

kreeuwijk commented 2 days ago

There is a bit more nuance to this issue. Yes, as shown in the example, it is easy for the user to get themselves into duplicate DNS zone name conflicts, when using the same private dns zone name in different cluster resource groups, but with the same network resource group.

However another issue is the proliferation of private dns zones with the current design. Since you can't re-use a private dns zone unless you only have 1 cluster resource group, the current design requires a (unique) private dns zone to be created for every cluster resource group that can be targeted. This is both unnecessarily complex and error prone. We have a customer that has many cluster & network resource groups and the prospect of zone proliferation and future naming conflicts is not acceptable to them.

If instead, we give the user the (optional) ability to select a resource group for the private dns zone, it centralizes the private dns functionality. Users can use a single private dns zone across all cluster deployments, regardless of cluster/network resource groups. As this RG selection is optional, it would be backwards compatible with existing clusters as well.