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

✨ Adds kubeadm control plane scale up/down #2335

Merged
merged 1 commit into from
Feb 14, 2020

Conversation

dlipovetsky
Copy link
Contributor

What this PR does / why we need it:
Kubeadm control plane scale up and down, as described in #2241

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 #2241, #2016

I'm replacing the scale up unit tests because with the health checks introduced for scale up, they would become integration tests. For the new scale up/down unit tests, I'm going to fake the management cluster.

I'm also replacing the delete unit tests, because the existing ones rely on scaling up the cluster. I'll replace them with a test that works against a static set of machines.

/assign @chuckha @detiber @randomvariable

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 14, 2020
Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

The changes to go.mod and go.sum should be reverted. We want client-go 0.17.2 and the framework should not be importing CAPD


for i := 0; i < 3; i++ {
m, _ := createMachineNodePair(fmt.Sprintf("test-%d", i), cluster, kcp, true)
g.Expect(fakeClient.Create(context.Background(), m)).To(Succeed())
Copy link
Member

Choose a reason for hiding this comment

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

It might be a bit cleaner if we create these resources prior to creating the fake client and feed them into the function for creating the fake client.

Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

The only other change I had to make was in the test, increasing a timeout:

-                               framework.WaitForKubeadmControlPlaneMachinesToExist(ctx, assertKubeadmControlPlaneNodesExistInput)
+                               framework.WaitForKubeadmControlPlaneMachinesToExist(ctx, assertKubeadmControlPlaneNodesExistInput, "5m", "10s")

capd-e2es passed!

@dlipovetsky
Copy link
Contributor Author

The changes to go.mod and go.sum should be reverted. We want client-go 0.17.2 and the framework should not be importing CAPD

I'll revert that. What do I do about it locally, though? That's the diff after running make modules (go 1.13.8) 😕

$ git status --untracked-files=no
On branch controlplane-scale
nothing to commit (use -u to show untracked files)

$ make modules --debug
GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating makefiles....
Updating goal targets....
 File 'modules' does not exist.
Must remake target 'modules'.
go mod tidy
cd hack/tools; go mod tidy
cd test/framework; go mod tidy
go: finding sigs.k8s.io/cluster-api/test/infrastructure/docker latest
cd test/infrastructure/docker; make modules
GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
make[1]: Entering directory '/home/dlipovetsky/projects/cluster-api/test/infrastructure/docker'
Updating makefiles....
Updating goal targets....
 File 'modules' does not exist.
Must remake target 'modules'.
go mod tidy
cd hack/tools; go mod tidy
Successfully remade target file 'modules'.
make[1]: Leaving directory '/home/dlipovetsky/projects/cluster-api/test/infrastructure/docker'
Successfully remade target file 'modules'.

$ git status --untracked-files=no
On branch controlplane-scale
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   test/framework/go.mod
        modified:   test/framework/go.sum
        modified:   test/infrastructure/docker/go.mod
        modified:   test/infrastructure/docker/go.sum

no changes added to commit (use "git add" and/or "git commit -a")

$ go version
go version go1.13.8 linux/amd64

@vincepri
Copy link
Member

Ping when you're ready for another set of 👀

@chuckha
Copy link
Contributor

chuckha commented Feb 14, 2020

The changes to go.mod and go.sum should be reverted. We want client-go 0.17.2 and the framework should not be importing CAPD

I'll revert that. What do I do about it locally, though? That's the diff after running make modules (go 1.13.8) 😕

That's very weird. On my system, that is not the case. Once I revert those changes and run make modules, go.sum cleans up and my changes persist 🤔

Let's see if prow complains after you revert them. It will complain about outdated files if go modules is not up to date.

@chuckha
Copy link
Contributor

chuckha commented Feb 14, 2020

/approve

/assign @vincepri @detiber
for lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chuckha, dlipovetsky

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 Feb 14, 2020
@vincepri
Copy link
Member

Reviewing

func (o MachinesByCreationTimestamp) Less(i, j int) bool {
if o[i].CreationTimestamp.Equal(&o[j].CreationTimestamp) {
return o[i].Name < o[j].Name
}
Copy link
Member

Choose a reason for hiding this comment

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

I'd use sort.Slice instead of creating yet a new type here

Signed-off-by: Daniel Lipovetsky <dlipovetsky@d2iq.com>
Copy link
Member

@vincepri vincepri 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 Feb 14, 2020
@k8s-ci-robot k8s-ci-robot merged commit d09f59e into kubernetes-sigs:master Feb 14, 2020
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/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.

[kubeadm control plane] Scale up / Scale down
6 participants