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

🌱 Move MachineSet patching to a defer call #3904

Merged

Conversation

srm09
Copy link
Contributor

@srm09 srm09 commented Nov 5, 2020

What this PR does / why we need it:
This patch refactors the implementation of the machinset controller to follow the new conventions and patterns.

Which issue(s) this PR fixes:
Fixes #1689

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 5, 2020
@k8s-ci-robot k8s-ci-robot requested review from justinsb and ncdc November 5, 2020 00:29
@srm09 srm09 force-pushed the refactor/machineset-controller branch from aafcd97 to e0f0144 Compare November 5, 2020 04:34
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 5, 2020
@srm09
Copy link
Contributor Author

srm09 commented Nov 5, 2020

I went down another rabbit hole of using the FilterableMachineCollection & MachineFilters currently under the controlplane/kubeadm directory to list/traverse machines managed/to be adopted by the machinesets.

Held those changes back since there were many other changes (irrelevant to this PR) required for that. I plan to open a WIP PR for that later for further discussion. The same format could be useful for MachinePools and maybe MachineDeployments too.

@srm09 srm09 marked this pull request as ready for review November 5, 2020 17:37
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 5, 2020
@srm09 srm09 force-pushed the refactor/machineset-controller branch 2 times, most recently from 4e7252f to c825f89 Compare November 5, 2020 18:05
@srm09
Copy link
Contributor Author

srm09 commented Nov 5, 2020

/assign @vincepri

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/hold

Holding for others to take a look as well

controllers/machineset_controller.go Outdated Show resolved Hide resolved
controllers/machineset_controller.go Outdated Show resolved Hide resolved
controllers/machineset_controller.go Outdated Show resolved Hide resolved
controllers/machineset_controller_test.go Outdated Show resolved Hide resolved
controllers/machineset_controller.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 9, 2020
@vincepri
Copy link
Member

vincepri commented Nov 9, 2020

/milestone v0.4.0

Could we retitle this PR to something like "MachineSet controller now patches in a defer call" or similar?

@k8s-ci-robot k8s-ci-robot added this to the v0.4.0 milestone Nov 9, 2020
@srm09
Copy link
Contributor Author

srm09 commented Nov 10, 2020

Thanks for the review @vincepri

I agree with the comment about merging the calculateStatus and patchMachineSetStatus into a single method now. Will work on merging those into a single one, and resolve the other comments.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 10, 2020
@srm09
Copy link
Contributor Author

srm09 commented Nov 10, 2020

/test pull-cluster-api-e2e-main

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 11, 2020
@srm09
Copy link
Contributor Author

srm09 commented Nov 11, 2020

/retitle Move MachineSet patching to a defer call

@k8s-ci-robot k8s-ci-robot changed the title 🌱 Refactor machineset controller Move MachineSet patching to a defer call Nov 11, 2020
@srm09 srm09 changed the title Move MachineSet patching to a defer call 🌱 Move MachineSet patching to a defer call Nov 11, 2020
@srm09
Copy link
Contributor Author

srm09 commented Nov 19, 2020

@ncdc @vincepri PTAL at this one at your convenience?

controllers/machineset_controller.go Outdated Show resolved Hide resolved
controllers/machineset_controller.go Outdated Show resolved Hide resolved
controllers/machineset_controller.go Outdated Show resolved Hide resolved
controllers/machineset_controller.go Outdated Show resolved Hide resolved
controllers/machineset_controller.go Outdated Show resolved Hide resolved
This is to align the machineset controller with the other controllers
which defer the patching of the object to the end of their reconcile loop.

Signed-off-by: Sagar Muchhal <[email protected]>
Co-authored-by: Vince Prignano <[email protected]>
@srm09 srm09 force-pushed the refactor/machineset-controller branch from 060fdfb to 2cd9823 Compare December 4, 2020 22:09
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/hold cancel
/lgtm
/assign @detiber @CecileRobertMichon

@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 Dec 7, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 7, 2020
@fabriziopandini
Copy link
Member

/approve

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini, vincepri

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:
  • OWNERS [fabriziopandini,vincepri]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 19, 2021
@k8s-ci-robot k8s-ci-robot merged commit aa86bbb into kubernetes-sigs:master Jan 19, 2021
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. 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.

Refactor MachineSet reconciler to be consistent with Cluster and Machine patterns
6 participants