-
Notifications
You must be signed in to change notification settings - Fork 449
Add ability to disable creation of dns zone for unmanaged installs #5666
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Hi @sadasu. 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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5666 +/- ##
==========================================
+ Coverage 52.83% 52.94% +0.10%
==========================================
Files 278 279 +1
Lines 29610 29607 -3
==========================================
+ Hits 15645 15674 +29
+ Misses 13148 13117 -31
+ Partials 817 816 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4c7fe79
to
1ed0e07
Compare
/ok-to-test |
/retest @sadasu Can you please run |
7ce774b
to
b660d6d
Compare
/retest |
b660d6d
to
58dae51
Compare
@willie-yao could you please take another look? Thanks! |
LGTM, I don't have anything to add here. |
153fae0
to
14ce92f
Compare
azure/scope/cluster.go
Outdated
@@ -1251,3 +1251,11 @@ func (s *ClusterScope) getLastAppliedSecurityRules(nsgName string) map[string]in | |||
} | |||
return lastAppliedSecurityRules | |||
} | |||
|
|||
// PrivateDNSZoneMode returns the cluster resource group. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this comment is correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copypasta...fixed.
Thanks for catching that.
14ce92f
to
b3b085c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this @sadasu! One small design suggestion: Would you be able to change the PrivateDNSZoneModes to a custom type definition like how UpgradeChannel is defined right below?
@@ -459,6 +459,11 @@ type NetworkClassSpec struct { | |||
// +optional | |||
PrivateDNSZoneName string `json:"privateDNSZoneName,omitempty"` | |||
|
|||
// PrivateDNSZone enables private dns zone creation modes for a private cluster. | |||
// When unspecified, it defaults to PrivateDNSZoneModeSystem which creates a private DNS zone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you specify what are the valid options for this field? Looks like it'll be "System or None". Can this also be validated in a webhook?
4aa36d1
to
42e6cda
Compare
Similar to managed installs, add ability to optionally create DNS zones for unmanged installs.
42e6cda
to
487fa67
Compare
@sadasu: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
@willie-yao This change is causing pull-cluster-api-provider-azure-apidiff to fail. |
For what it's worth, that's not a required check. It's up to maintainers of a given project, but if the api diff is failing because of a change they know will break, then the PR can still be merged. For this specific change, I think it's alright because it's a) a Go-level change and b) it's a type alias around a string, so the YAML values that most users interact with will not be affected. |
@nrb is correct! The failure is expected since it is a change to a type, but it won't have any functional differences to the user. This change will help users not be confused on what the field can be set to |
// PrivateDNSZoneMode determines if the Private DNS Zone gets created. | ||
// It is created by default on a private cluster and can be skipped based on a configured value. | ||
type PrivateDNSZoneMode string | ||
|
||
const ( | ||
// ManagedClusterFinalizer allows Reconcile to clean up Azure resources associated with the AzureManagedControlPlane before | ||
// removing it from the apiserver. | ||
ManagedClusterFinalizer = "azuremanagedcontrolplane.infrastructure.cluster.x-k8s.io" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can you move ManagedClusterFinalizer
to its own const
block?
// PrivateDNSZoneMode determines if the Private DNS Zone gets created. | ||
// It is created by default on a private cluster and can be skipped based on a configured value. | ||
type PrivateDNSZoneMode string | ||
|
||
const ( | ||
// ManagedClusterFinalizer allows Reconcile to clean up Azure resources associated with the AzureManagedControlPlane before | ||
// removing it from the apiserver. | ||
ManagedClusterFinalizer = "azuremanagedcontrolplane.infrastructure.cluster.x-k8s.io" | ||
|
||
// PrivateDNSZoneModeSystem represents mode System for azuremanagedcontrolplane. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// PrivateDNSZoneModeSystem represents mode System for azuremanagedcontrolplane. | |
// PrivateDNSZoneModeSystem represents mode System for Private DNS Zones. |
I think this is a better description but feel free to disregard if not.
const ( | ||
// ManagedClusterFinalizer allows Reconcile to clean up Azure resources associated with the AzureManagedControlPlane before | ||
// removing it from the apiserver. | ||
ManagedClusterFinalizer = "azuremanagedcontrolplane.infrastructure.cluster.x-k8s.io" | ||
|
||
// PrivateDNSZoneModeSystem represents mode System for azuremanagedcontrolplane. | ||
PrivateDNSZoneModeSystem string = "System" | ||
PrivateDNSZoneModeSystem PrivateDNSZoneMode = "System" | ||
|
||
// PrivateDNSZoneModeNone represents mode None for azuremanagedcontrolplane. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// PrivateDNSZoneModeNone represents mode None for azuremanagedcontrolplane. | |
// PrivateDNSZoneModeNone represents mode None for Private DNS Zones. |
Same as above
@@ -21,16 +21,20 @@ import ( | |||
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" | |||
) | |||
|
|||
// PrivateDNSZoneMode determines if the Private DNS Zone gets created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this comment mean that if PrivateDNSZoneMode
is not set, the Private DNS Zone is not created? Or is it not created if set to None? I think the comment is fine but may need a bit more clarification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If PrivateDNSZoneMode
is not set, it would follow the default behavior where Private DNS Zone will be created. That is the same behavior when its value ti set to PrivateDNSZoneModeSystem.
We set to PrivateDNSZoneModeNone, Private DNS Zone creation would be skipped.
Updated comment to hepefully make it clearer.
Thank you @nrb and @willie-yao for the explanation. |
Similar to managed installs, add ability to optionally create DNS zones for unmanged installs.
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR adds the ability to optionally create private DNS zones for unmanaged clusters. Without this feature they are always created. There are some instances we would like to use a DNS service other than Azure DNS and would like CAPI to withhold creation of private DNS Zones at those times. This feature adds a new field to NetworkSpec that allows us to skip creation of the DNS zone. Default behavior remains unchanged where DNS zones are created during cluster creation.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
TODOs:
Release note: