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

✨ Set Kubernetes version in machinepool machine Status.Version #10849

Merged

Conversation

cahillsf
Copy link
Member

@cahillsf cahillsf commented Jul 8, 2024

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

/area machinepool

@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. area/machinepool Issues or PRs related to machinepools cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 8, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 8, 2024
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Just a few minor findings

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 11, 2024
@cahillsf cahillsf force-pushed the populate-mpm-status-version branch 2 times, most recently from 39a1377 to 857318a Compare July 14, 2024 23:24
@cahillsf cahillsf marked this pull request as ready for review July 14, 2024 23:39
@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 Jul 14, 2024
@cahillsf
Copy link
Member Author

/test pull-cluster-api-e2e-main

// Get the nodeRefsMap from the cluster.
s.nodeRefMap, err = r.getNodeRefMap(ctx, clusterClient)
if err != nil {
r.recorder.Event(mp, corev1.EventTypeWarning, "FailedGetNodeRefMap", err.Error())
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to return an error here and not send an event. Usually we're bubbling up errors and not emitting events when we hit them.

I think this could produce a lot of events when a workload cluster is not reachable

Copy link
Member Author

Choose a reason for hiding this comment

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

gotcha -- right right i think i took this approach because if we return an error at this point, then we stop short of reconcileMachines which would a be change in behavior (previously reconcileMachines was called without any node references as we didn't set the status).

can make the update to return at this point if you think that's best? or maybe emit a Warn log indicating status won't be set on the machines and let execution continue?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe let's store this error here e.g. in getNodeRefsErr and then check in l.300+ if either this error is !=nil or the one returned from reconcileMachines and then return if at least one of the errors is != nil + aggregate them.

Copy link
Member Author

Choose a reason for hiding this comment

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

nice yes sounds good -- just pushed up this change

exp/internal/controllers/machinepool_controller_phases.go Outdated Show resolved Hide resolved
@sbueringer
Copy link
Member

Reviewed everything apart from "machinepool_controller_phases_test.go" (will do that on the next review)

@cahillsf cahillsf force-pushed the populate-mpm-status-version branch from 857318a to 7fc92cf Compare July 18, 2024 22:26
@cahillsf cahillsf force-pushed the populate-mpm-status-version branch from 7fc92cf to 12d8855 Compare July 19, 2024 13:01
@cahillsf cahillsf changed the title ✨ Set Kubernetes version in machinepool machine Status.version ✨ Set Kubernetes version in machinepool machine Status.Version Jul 21, 2024
@cahillsf
Copy link
Member Author

i also found this open issue: #8856

since this PR is already touching this code i could also tie in this improvement if it would make sense?

i think since the providerIDList is available in the mp.Spec in scope it would just be a change in the implementation of the new
func (r *MachinePoolReconciler) getNodeRefMap(ctx context.Context, c client.Client) (map[string]*corev1.Node, error)
function

@sbueringer
Copy link
Member

Let's do this in a separate PR. Mostly because this PR is ready for merge

/lgtm
/approve

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

LGTM label has been added.

Git tree hash: c2e459acde1c02a617fc24543e6dd61655ec7859

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 Jul 22, 2024
@sbueringer
Copy link
Member

/test pull-cluster-api-e2e-main

@k8s-ci-robot k8s-ci-robot merged commit 5a04c4d into kubernetes-sigs:main Jul 22, 2024
26 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.8 milestone Jul 22, 2024
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.

Set Kubernetes version in machinepool machine
3 participants