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 MachineDeployment scale test #4647

Merged

Conversation

jackfrancis
Copy link
Contributor

What this PR does / why we need it:

This PR adds a new E2E test to validate MachineDeployment scale scenarios.

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 #

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 20, 2021
@jackfrancis jackfrancis changed the title test: add MachineDeployment scale test 🌱 add MachineDeployment scale test May 20, 2021
@jackfrancis
Copy link
Contributor Author

/test pull-cluster-api-e2e-full-main

@jackfrancis jackfrancis force-pushed the e2e-machinedeployment-scale branch from 624b212 to 021b34f Compare May 20, 2021 23:29
@jackfrancis
Copy link
Contributor Author

/test pull-cluster-api-e2e-full-main

@jackfrancis jackfrancis force-pushed the e2e-machinedeployment-scale branch from 021b34f to 91c44c1 Compare May 21, 2021 00:08
test/e2e/md_scale_test.go Outdated Show resolved Hide resolved
@enxebre
Copy link
Member

enxebre commented May 21, 2021

I'm not familiar with the e2e costs and duration, If there were concerns to keep those shrunk one could argue that this is implicitly tested by cluster upgrade and drain timeout. Otherwise this is good to have and lgtm.

@jackfrancis
Copy link
Contributor Author

/retest

@CecileRobertMichon
Copy link
Contributor

In general i'm +1 to this change since it will be better to have a clear signal on scale up and scale down than having to rely on the scale in the upgrade test.

lgtm besides nits above

@jackfrancis jackfrancis force-pushed the e2e-machinedeployment-scale branch 2 times, most recently from 1699757 to cc262b6 Compare May 24, 2021 19:31
WaitForMachineDeployments: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
}, clusterResources)

Expect(clusterResources.MachineDeployments[0].Spec.Replicas).ToNot(BeNil())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JoelSpeed @CecileRobertMichon I added these lines, I think this is the right place to deal with ensuring the hygiene of the replicas property. If that property is nil, we want to know about it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in fact after further investigation the strict nil checks against Replicas aren't required as long as we use the ginkgo Equal( method, as that method includes nil checks, and if nil returns a specific error about that.

@@ -70,6 +70,7 @@ func GetMachineDeploymentsByCluster(ctx context.Context, input GetMachineDeploym

deployments := make([]*clusterv1.MachineDeployment, len(deploymentList.Items))
for i := range deploymentList.Items {
Expect(deploymentList.Items[i].Spec.Replicas).ToNot(BeNil())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JoelSpeed @CecileRobertMichon more Replicas non-nil hygiene

@jackfrancis
Copy link
Contributor Author

/retest

@CecileRobertMichon
Copy link
Contributor

/lgtm
/assign @fabriziopandini

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 24, 2021
test/e2e/md_scale.go Outdated Show resolved Hide resolved
MachineDeployment: clusterResources.MachineDeployments[0],
Replicas: 3,
WaitForMachineDeployments: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Would adding an assertion for the new number of replicas make sense here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ScaleAndWaitMachineDeployment does that for us in this case. The earlier assertion is to get a validated baseline before going through the scaling flow(s).

Copy link
Contributor

@srm09 srm09 May 26, 2021

Choose a reason for hiding this comment

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

Gotcha, I saw the implicit assertion now. During my earlier pass, I was looking for an explicit assertion in the ScaleAndWaitMD and hence the comment. Make sense, feel free to resolve.

MachineDeployment: clusterResources.MachineDeployments[0],
Replicas: 1,
WaitForMachineDeployments: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

@jackfrancis jackfrancis force-pushed the e2e-machinedeployment-scale branch from cc262b6 to 35f72cd Compare May 26, 2021 17:59
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 26, 2021
@jackfrancis
Copy link
Contributor Author

/test pull-cluster-api-e2e-full-main

@jackfrancis
Copy link
Contributor Author

/retest

@jackfrancis jackfrancis force-pushed the e2e-machinedeployment-scale branch from 35f72cd to fb3e760 Compare May 27, 2021 16:22
@jackfrancis
Copy link
Contributor Author

/test pull-cluster-api-e2e-full-main

@jackfrancis jackfrancis force-pushed the e2e-machinedeployment-scale branch from fb3e760 to dac8d41 Compare May 27, 2021 17:32
@jackfrancis
Copy link
Contributor Author

/retest

@jackfrancis
Copy link
Contributor Author

/test pull-cluster-api-e2e-full-main

2 similar comments
@jackfrancis
Copy link
Contributor Author

/test pull-cluster-api-e2e-full-main

@jackfrancis
Copy link
Contributor Author

/test pull-cluster-api-e2e-full-main

@jackfrancis
Copy link
Contributor Author

@fabriziopandini this is ready for final review

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.

@jackfrancis Thanks for adding a new test to the CAPI E2E test suite!
/lgtm

)

// MachineDeploymentScaleSpecInput is the input for MachineDeploymentScaleSpec.
type MachineDeploymentScaleSpecInput struct {
Copy link
Member

Choose a reason for hiding this comment

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

future work: expose the number of worker nodes we scale up to, so people reusing things Spec on providers might decide to have more (or less) workers according to their needs. As soon as we have HollowMachines in CAPD I plan to increase this for CAPI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sgtm!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 28, 2021
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 May 28, 2021
@k8s-ci-robot k8s-ci-robot merged commit 8a62f7e into kubernetes-sigs:master May 28, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone May 28, 2021
@jackfrancis jackfrancis deleted the e2e-machinedeployment-scale branch May 28, 2021 17:05
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.

7 participants