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

Refactoring cluster manager to invoke provider's SpecChanged method #1808

Merged
merged 10 commits into from
Apr 13, 2022

Conversation

maxdrib
Copy link
Contributor

@maxdrib maxdrib commented Apr 11, 2022

Issue #, if available: #1669

Description of changes:
This PR removes the cloudstack-specific logic (in a backwards compatible way) from the cluster-manager and moves it to the provider for both CloudStack and VSphere

Testing (if applicable):
Unit tests pass

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot
Copy link
Collaborator

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

@maxdrib
Copy link
Contributor Author

maxdrib commented Apr 11, 2022

/cc @vivek-koppuru @chrisdoherty4

@eks-distro-bot eks-distro-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 11, 2022
@maxdrib maxdrib marked this pull request as ready for review April 11, 2022 17:43
@eks-distro-bot eks-distro-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 12, 2022
logger.V(3).Info(fmt.Sprintf("Old machine config spec %s not found in the existing spec", oldMcRef.Name))
return true, nil
}
if !reflect.DeepEqual(existingVmc.Spec, csmc.Spec) {
Copy link
Contributor Author

@maxdrib maxdrib Apr 12, 2022

Choose a reason for hiding this comment

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

I recognize that using reflect is non-ideal, but this is what the cluster manager was using previously and to keep the changes smaller and minimize blast radius, I'd like to continue using it for now. The vsphere machine config spec's Equal method is not implemented. Defining that Equal method may require some VSphere context which I don't feel fully equipped to do

@eks-distro-bot eks-distro-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 12, 2022
@g-gaston g-gaston self-requested a review April 12, 2022 18:17
@abhay-krishna
Copy link
Member

/override eks-anywhere-release-tooling-test-presubmit

@eks-distro-bot
Copy link
Collaborator

@abhay-krishna: Overrode contexts on behalf of abhay-krishna: eks-anywhere-release-tooling-test-presubmit

In response to this:

/override eks-anywhere-release-tooling-test-presubmit

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.

@eks-distro-bot
Copy link
Collaborator

@maxdrib: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
eks-anywhere-release-tooling-test-presubmit 5c36390 link /test eks-anywhere-release-tooling-test-presubmit

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Copy link
Member

@g-gaston g-gaston 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! just one suggestion that I think would make it a bit cleaner

pkg/clustermanager/cluster_manager.go Outdated Show resolved Hide resolved
@eks-distro-bot eks-distro-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 13, 2022
@maxdrib maxdrib requested a review from g-gaston April 13, 2022 14:43
pkg/providers/provider.go Outdated Show resolved Hide resolved
pkg/providers/cloudstack/cloudstack.go Outdated Show resolved Hide resolved
@maxdrib maxdrib requested a review from g-gaston April 13, 2022 15:25
Copy link
Member

@g-gaston g-gaston 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, just minor comments

pkg/providers/cloudstack/cloudstack.go Outdated Show resolved Hide resolved
pkg/providers/docker/docker.go Outdated Show resolved Hide resolved
pkg/providers/tinkerbell/tinkerbell.go Outdated Show resolved Hide resolved
pkg/providers/tinkerbell/tinkerbell.go Outdated Show resolved Hide resolved
@eks-distro-bot eks-distro-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 13, 2022
@eks-distro-bot eks-distro-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 13, 2022
@maxdrib maxdrib requested a review from g-gaston April 13, 2022 19:05
Copy link
Member

@vivek-koppuru vivek-koppuru left a comment

Choose a reason for hiding this comment

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

/lgtm

@@ -199,6 +200,32 @@ func (p *vsphereProvider) UpdateKubeConfig(_ *[]byte, _ string) error {
return nil
}

func (p *vsphereProvider) machineConfigsSpecChanged(ctx context.Context, cc *v1alpha1.Cluster, cluster *types.Cluster, newClusterSpec *cluster.Spec) (bool, error) {
machineConfigMap := make(map[string]*v1alpha1.VSphereMachineConfig)
for _, config := range p.MachineConfigs(nil) {
Copy link
Member

Choose a reason for hiding this comment

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

We need to clean this up, either remove the parameter from the function or actually use it instead of referencing the values from the struct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The parameter is currently being used in the snow provider, but nowhere else I believe. Is this the model all the providers should adopt? It may be worth creating an issue about it

Copy link
Member

Choose a reason for hiding this comment

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

Since this is not an exported method, we have control on what parameters to pass in based on the provider right?

@g-gaston
Copy link
Member

/approve

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: g-gaston

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm 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.

5 participants