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

🌱 Add util function to get MachinePool by label #9219

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

Jont828
Copy link
Contributor

@Jont828 Jont828 commented Aug 16, 2023

What this PR does / why we need it: Add util function to get MachinePool by label. This will simplify the mapper in the MachinePool controller as well as make it easier for InfraProviders to fetch the MachinePool for a InfraMachinePoolMachine.

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 #

/area machinepools

@k8s-ci-robot
Copy link
Contributor

@Jont828: The label(s) area/machinepools cannot be applied, because the repository doesn't have them.

In response to this:

What this PR does / why we need it: Add util function to get MachinePool by label. This will simplify the mapper in the MachinePool controller as well as make it easier for InfraProviders to fetch the MachinePool for a InfraMachinePoolMachine.

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 #

/area machinepools

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-area PR is missing an area label size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 16, 2023
@Jont828
Copy link
Contributor Author

Jont828 commented Aug 16, 2023

/area machinepool

@k8s-ci-robot k8s-ci-robot added area/machinepool Issues or PRs related to machinepools and removed do-not-merge/needs-area PR is missing an area label labels Aug 16, 2023
@Jont828
Copy link
Contributor Author

Jont828 commented Aug 17, 2023

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 23, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 48c878148d527006ad224a58b84433b97bfd37b6

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

Looks good - but it I think we should add a unit test.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 5, 2023
@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 Sep 5, 2023
@Jont828
Copy link
Contributor Author

Jont828 commented Sep 5, 2023

@killianmuldoon @fabriziopandini Done, added test cases!

@sbueringer
Copy link
Member

Looks like the linter has findings

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 7, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 13f9f5260a539a140e27a07aad0eb6bfb213fe85

@Jont828
Copy link
Contributor Author

Jont828 commented Sep 11, 2023

Are we good to merge this?

exp/util/util.go Show resolved Hide resolved
exp/util/util.go Show resolved Hide resolved
@CecileRobertMichon
Copy link
Contributor

@mdbooth are all your comments addressed/resolved?

@Jont828
Copy link
Contributor Author

Jont828 commented Oct 18, 2023

@mdbooth Any updates?

@Jont828
Copy link
Contributor Author

Jont828 commented Oct 23, 2023

@fabriziopandini @CecileRobertMichon I think we should be good to move forward with this. Are there any other comments/concerns?

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
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon

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 /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 Oct 23, 2023
@k8s-ci-robot k8s-ci-robot merged commit ce23626 into kubernetes-sigs:main Oct 23, 2023
21 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.6 milestone Oct 23, 2023
@Jont828
Copy link
Contributor Author

Jont828 commented Oct 24, 2023

Thanks everyone!

if machinePoolOwned {
machinePool, err := utilexp.GetMachinePoolByLabels(ctx, r.Client, o.GetNamespace(), labels)
if err != nil {
log.Error(err, "failed to get MachinePool for InfraMachine", "infraMachine", klog.KObj(o), "labels", labels)
Copy link
Member

Choose a reason for hiding this comment

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

@Jont828 Logging all labels can be very very verbose. I wouldn't do it

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. area/machinepool Issues or PRs related to machinepools 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.

None yet

7 participants