-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Add node affinity for Azure unzoned managed disks #67229
Conversation
/retest |
2 similar comments
/retest |
/retest |
// This is required because unzoned AzureDisk can't be attached to zoned nodes. | ||
// There are at most 3 fault domains available in each region. | ||
// Refer https://docs.microsoft.com/en-us/azure/virtual-machines/windows/manage-availability. | ||
for i := 0; i < 3; i++ { |
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.
Is there a way to get the number of fault domains dynamically (e.g. from Azure metadata) instead of hardcoding it to 3 here? Some of the regions do not appear to have 3 fault domains like West Central US, Canada East according to the link above.
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.
There is no API for such use cases. 3 works for all regions, so it won't break any clusters, even with 2 FDs.
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.
Is there any chance in the future that you would have more than 3 fault domains?
MatchExpressions: requirements, | ||
}) | ||
} else { | ||
// Set node affinity labels based on fault domains. |
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.
Is it going to be legal to have AllowedTopology set for un-zoned AzureDisks (with zones set to fault domains)? It seems that should not be allowed based on the logic below. If so, should it be checked for and rejected?
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.
Good catch. Added in the new commit.
d5ba5f4
to
9e6ad14
Compare
ping @andyzhangx for review |
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.
lgtm in general, I will wait for @ddebroy comments, thanks.
nodeSelectorTerms := make([]v1.NodeSelectorTerm, 0) | ||
|
||
if zoned { | ||
// Set node affinity labels based availability zone labels. |
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.
based on
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.
Fixed.
9e6ad14
to
145cc41
Compare
lgtm. Is there going to be a followup PR for unmanaged disks where nodeAffinity is populated in a similar fashion as for managed non-zoned disks? |
@ddebroy Thanks and good catch. Let add address this within this PR. |
145cc41
to
dbdfd0f
Compare
Added in the new commit. @andyzhangx @ddebroy PTAL |
lgtm ... thank you! |
/retest |
/test pull-kubernetes-e2e-kops-aws |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andyzhangx, feiskyer 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:
Approvers can indicate their approval by writing |
Automatic merge from submit-queue (batch tested with PRs 66884, 67410, 67229, 67409). If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
Continue of Azure Availability Zone feature.
Add node affinity for Azure unzoned managed disks, so that unzoned disks only scheduled to unzoned nodes.
This is required because Azure doesn't allow attaching unzoned disks to zoned VMs.
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:
Unzoned nodes would label
failure-domain.beta.kubernetes.io/zone=0
and the value is fault domain ( while availability zone is used for zoned nodes). So fault domain is used to populate unzoned disks.Since there are at most 3 fault domains in each region, the PR adds 3 terms for them:
Release note:
/sig azure
/kind feature
/cc @brendandburns @khenidak @andyzhangx @msau42