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

Custom data model fix #3134

Merged

Conversation

BrennenMM7
Copy link
Contributor

@BrennenMM7 BrennenMM7 commented Jan 31, 2023

What type of PR is this?

What this PR does / why we need it:
When Bootstrap token refreshes the VMSS needs to have the latest model in order for autoscaling machinepools to take place succesfully. Stores a hash of the current custom data contents into AzureMachinePool.Status.CustomDataHash. This allows to update the VMSS data if the custom data changes.

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 #2803

Special notes for your reviewer:
This is utilizing the same logic as created in this pull request https://github.com/kubernetes-sigs/cluster-api-provider-azure/pull/2803, the only changes are as follows:

  • Added to the mock tests to past all unit testing,
  • Removed logic from node surge to prevent constant node rolling updates.
  • Added the watcher to the Kubeadmconfig resource as mentioned in the issue/PR linked.
  • API resource conversions for v1alpha3 and v1alpha4.
    Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

- AzureMachinePool Controller will no watch KubeadmConfig to ensure AzureMachinePool Bootstrap data is updated on the VMSS
- The patch loop for the AzureMachinePool will now compare CustomData field to ensure the VMSS instance is updated with the latest model 

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Jan 31, 2023
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 31, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: BrennenMM7 / name: Brennen Murray (8c67bbb)

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

Welcome @BrennenMM7!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-azure 🎉. 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/cluster-api-provider-azure 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 added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 31, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @BrennenMM7. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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/test-infra repository.

@BrennenMM7 BrennenMM7 force-pushed the customData_Model_Fix branch 2 times, most recently from 37445d3 to 8c67bbb Compare January 31, 2023 21:38
@k8s-ci-robot k8s-ci-robot added 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 Jan 31, 2023
@willie-yao
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 31, 2023
@CecileRobertMichon
Copy link
Contributor

Should we consider only doing this when the MachinePool has the externally managed replicas annotation? I'd be worried about increasing the number of API calls for users that don't need this as this will now make a PUT API call per AzureMachinePool every 10 minutes or so (or whenever token is refreshed, I forget the exact number) which might not scale well for very large clusters with hundreds of MachinePools (granted this will be a problem for users with externally managed replicas too but if we can at least reduce the blast radius that would be an improvement).

@BrennenMM7
Copy link
Contributor Author

BrennenMM7 commented Feb 6, 2023

Should we consider only doing this when the MachinePool has the externally managed replicas annotation? I'd be worried about increasing the number of API calls for users that don't need this as this will now make a PUT API call per AzureMachinePool every 10 minutes or so (or whenever token is refreshed, I forget the exact number) which might not scale well for very large clusters with hundreds of MachinePools (granted this will be a problem for users with externally managed replicas too but if we can at least reduce the blast radius that would be an improvement).

I've added an if block around the return escape if nothing has changed, allowing to have two different behaviors for patching the VMSS object based on externally managed autoscaler annotations.

This should limit the number of API calls for users not utilizing an autoscaler

@CecileRobertMichon
Copy link
Contributor

/retest

@CecileRobertMichon
Copy link
Contributor

@BrennenMM7 build is failing, PTAL

@BrennenMM7
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 15, 2023
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 15, 2023
@BrennenMM7
Copy link
Contributor Author

@CecileRobertMichon Fixed the build failures and squashed commits again, should be good to go. 👍

Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

lgtm aside from comment on annotation const and failing unit test job, thanks again and sorry for all the back and forth on this one

@CecileRobertMichon
Copy link
Contributor

/hold cancel

please squash!

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 22, 2023
@BrennenMM7
Copy link
Contributor Author

/test pull-cluster-api-provider-azure-e2e

@BrennenMM7
Copy link
Contributor Author

Can I get a tag on this PR please 😄

Copy link
Member

@nawazkh nawazkh left a comment

Choose a reason for hiding this comment

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

I don't fully understand the problem, will go back try reproducing the error.
However, I had some doubts and questions jotted down below after reviewing the code.

exp/controllers/helpers.go Show resolved Hide resolved
azure/scope/machinepool.go Show resolved Hide resolved
azure/services/scalesets/scalesets.go Show resolved Hide resolved
@CecileRobertMichon
Copy link
Contributor

/lgtm
/hold

@nawazkh I think I've addressed all your questions/comments, let me know if you're good to remove the hold

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Feb 27, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 6e7cb98d401329488f5e99e47bdfcf68e0e0bbd3

@nawazkh
Copy link
Member

nawazkh commented Feb 27, 2023

Thanks for the updates @CecileRobertMichon ! Good to remove the hold!
Kudos @BrennenMM7 🎉
/lgtm

@CecileRobertMichon
Copy link
Contributor

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 27, 2023
@k8s-ci-robot k8s-ci-robot merged commit f2bbf36 into kubernetes-sigs:main Feb 28, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.8 milestone Feb 28, 2023
@k8s-infra-cherrypick-robot

@mboersma: #3134 failed to apply on top of branch "release-1.6":

Applying: Resolved refresh custom data when Bootstrap token rotates.
Using index info to reconstruct a base tree...
M	azure/const.go
M	azure/scope/machinepool.go
M	azure/services/scalesets/mock_scalesets/scalesets_mock.go
M	azure/services/scalesets/scalesets.go
M	azure/services/scalesets/scalesets_test.go
M	exp/controllers/helpers.go
M	main.go
Falling back to patching base and 3-way merge...
Auto-merging main.go
Auto-merging exp/controllers/helpers.go
Auto-merging azure/services/scalesets/scalesets_test.go
CONFLICT (content): Merge conflict in azure/services/scalesets/scalesets_test.go
Auto-merging azure/services/scalesets/scalesets.go
CONFLICT (content): Merge conflict in azure/services/scalesets/scalesets.go
Auto-merging azure/services/scalesets/mock_scalesets/scalesets_mock.go
Auto-merging azure/scope/machinepool.go
CONFLICT (content): Merge conflict in azure/scope/machinepool.go
Auto-merging azure/const.go
CONFLICT (content): Merge conflict in azure/const.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Resolved refresh custom data when Bootstrap token rotates.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.6

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.

@CecileRobertMichon
Copy link
Contributor

/cherry-pick release-1.7

@k8s-infra-cherrypick-robot

@CecileRobertMichon: new pull request created: #3205

In response to this:

/cherry-pick release-1.7

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.

@jackfrancis
Copy link
Contributor

@BrennenMM7 did this PR fix #2683 as well?

Thank you!

cc @primeroz

@BrennenMM7
Copy link
Contributor Author

@jackfrancis Yes this should resolve #2683 as the watcher will ensure that the VMSS always has the latest bootstrap token inside the model of the VMSS. 👍

@jackfrancis
Copy link
Contributor

@BrennenMM7 thank you! I'll close #2683 and advise that the original reporter of that issue validate the fix with v1.8.0 after it is released (next week), because this PR will be included in that release.

Thanks again for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants