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

✨ Implement getClusterState for topology controller #5045

Merged

Conversation

killianmuldoon
Copy link
Contributor

Implementation for reading the current state of a cluster managed
by a ClusterClass to the cluster topology controller. This will
allow the controller to see the observed state of a managed
cluster and use the information during reconcilliation.

Signed-off-by: killianmuldoon [email protected]

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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 2, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @killianmuldoon. 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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 2, 2021
@fabriziopandini
Copy link
Member

/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 Aug 2, 2021
@fabriziopandini
Copy link
Member

/retest

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.

@killianmuldoon looks great!
I have a couple of nits, most of them on comments and error variables.
The only suggestion is to use getTemplate recently introduced by #5007 (in its current form or after renaming it to getReference) instead of repeating convertreference + get in every place.

I still have to take a deeper look on tests, I will do ASAP

controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute_test.go Outdated Show resolved Hide resolved
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.

Overall lgtm, waiting for the required const to merge or to be copied in this PR
@sbueringer PTAL

controllers/clustertopology_controller_compute_test.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute_test.go Outdated Show resolved Hide resolved
@killianmuldoon
Copy link
Contributor Author

/retest

controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute_test.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute_test.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute_test.go Outdated Show resolved Hide resolved
@killianmuldoon
Copy link
Contributor Author

@sbueringer I think I've met most of your requested changes here - let me know if there's red lines on the couple I decided not to take on.

@killianmuldoon
Copy link
Contributor Author

/retest

1 similar comment
@killianmuldoon
Copy link
Contributor Author

/retest

controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
nil,
}, nil
}
cpInfraRef, err := getNestedRef(cp, "spec", "machineTemplate", "infrastructureRef")
Copy link
Member

Choose a reason for hiding this comment

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

@killianmuldoon Would be really good to have a new line here. Imho it just reads a lot easier with a ibt more structuring

controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
Comment on lines 222 to 223
// whether they are managed by a ClusterClass using labels. A cluster may have zero or more MachineDeployments. Zero is
// expected on first reconcile. If MachineDeployments are found for the cluster Infrastructure and Bootstrap references
Copy link
Member

Choose a reason for hiding this comment

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

@killianmuldoon fyi still open (I think you might have missed a few nits :))

controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 10, 2021
@killianmuldoon
Copy link
Contributor Author

@sbueringer I've pushed a new version with these issues addressed (or at least I think so 😄 - PTAL

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.

I think you got all, just found a new one (so feel free to resolve the open conversations above). But apart from that lgtm (+/- rebase after Farizios package move PR is merged)

controllers/clustertopology_controller_compute.go Outdated Show resolved Hide resolved
@killianmuldoon
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 11, 2021
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 11, 2021
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 11, 2021
@sbueringer
Copy link
Member

sbueringer commented Aug 11, 2021

/lgtm 🎉

@killianmuldoon
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 11, 2021
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 12, 2021
@sbueringer
Copy link
Member

/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 12, 2021
Implementation for reading the current state of a cluster managed
by a ClusterClass to the cluster topology controller. This will
allow the controller to see the observed state of a managed
cluster and use the information during reconcilliation.

Signed-off-by: killianmuldoon [email protected]
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 12, 2021
@fabriziopandini
Copy link
Member

/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 Aug 12, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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 Aug 12, 2021
@k8s-ci-robot k8s-ci-robot merged commit 99def25 into kubernetes-sigs:master Aug 12, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone Aug 12, 2021
}

// A Cluster may have zero or more MachineDeployments and a Cluster is expected to have zero MachineDeployments on
// first reconcile.
Copy link

@geetikabatra geetikabatra Aug 12, 2021

Choose a reason for hiding this comment

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

@killianmuldoon What exactly do we mean by first reconcile? Why would the number of MachineDeployments change on nth reconcile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the first reconcile the Machine Deployments won't have been spun up as this happens when the objects are initially created. The first reconcile - if things are working right - should be able to add the correct number of machine deployments in the spec and then the current state will come into line with the desired state as these objects are created and come online.

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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement read current state of a managed topology
6 participants