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 command and client for clusterctl alpha rollout restart #3838

Merged

Conversation

Arvinderpal
Copy link
Contributor

@Arvinderpal Arvinderpal commented Oct 21, 2020

What this PR does / why we need it:
Adds command and client for the clusterctl alpha rollout restart.
Also implements restart sub-command for MachineDeployments.

Fixes:
#3401

Related Issue:
#3439

@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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 21, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @Arvinderpal. 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 the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 21, 2020
@Arvinderpal
Copy link
Contributor Author

Arvinderpal commented Oct 21, 2020

@fabriziopandini @wfernandes @vincepri
Can I get an early review of this; in particular, how I have structured the code for alpha features?

I still need to do other things like unit tests and clean up, but you should be able to execute the restart command:
clusterctl alpha rollout restart --namespace default machinedeployment/test-md-0

@Arvinderpal Arvinderpal mentioned this pull request Oct 21, 2020
9 tasks
@Arvinderpal Arvinderpal changed the title WIP: ✨ Add command and client for clusterctl alpha rollout restart ✨ WIP: Add command and client for clusterctl alpha rollout restart Oct 22, 2020
@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 Oct 22, 2020
@k8s-ci-robot k8s-ci-robot 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 Oct 22, 2020
@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 Oct 23, 2020
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 23, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 23, 2020
@Arvinderpal Arvinderpal force-pushed the clusterctl-alpha-rollout branch 2 times, most recently from 027e433 to 3b54548 Compare October 23, 2020 16:02
@@ -65,6 +65,15 @@ type Client interface {
// ProcessYAML provides a direct way to process a yaml and inspect its
// variables.
ProcessYAML(options ProcessYAMLOptions) (YamlPrinter, error)

// Interface for alpha features in clusterctl
AlphaClient
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joelanford @alexeldeib Can you help me make sense of why this is flagged as an "incompatible change" with go-apidiff? I also tried removing the embedded interface and just putting the func directly in Client interface, but similar issue.

*** Running go-apidiff ***

sigs.k8s.io/cluster-api/cmd/clusterctl/client
  Incompatible changes:
  - AlphaClient.RolloutRestart: added
  Compatible changes:
  - (*clusterctlClient).RolloutRestart: added
  - AlphaClient: added
  - RolloutRestartOptions: added

sigs.k8s.io/cluster-api/cmd/clusterctl/client/rollout
  Compatible changes:
  - ObjectRestarter: added

sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/rollout
  Compatible changes:
  - NewCmdRolloutRestart: added
+ EXIT_VALUE=1
+ set +o xtrace

https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_cluster-api/3838/pull-cluster-api-apidiff-main/1319649725397340160/build-log.txt

Copy link
Contributor

Choose a reason for hiding this comment

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

The test is more advisory than required -- it's okay that it fails for PRs to be merged some times. The PR does make all of the changes mentioned, but they all seem reasonable to me (actually a bit surprised the first one is incompatible and the second one is compatible, would have expected those to be flipped since adding to an existing interface would require implementers to update their code).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah okay. Unless others see any problems with what I'm doing, I'll just ignore this for now.

@Arvinderpal Arvinderpal force-pushed the clusterctl-alpha-rollout branch 4 times, most recently from 8d3157a to a6e0851 Compare October 24, 2020 21:35
@Arvinderpal Arvinderpal changed the title ✨ WIP: Add command and client for clusterctl alpha rollout restart ✨ Add command and client for clusterctl alpha rollout restart Oct 26, 2020
@Arvinderpal
Copy link
Contributor Author

/assign @vincepri

@wfernandes
Copy link
Contributor

I can take another look at this sometime today.
/assign @wfernandes

@vincepri
Copy link
Member

vincepri commented Dec 8, 2020

LGTM
@wfernandes @fabriziopandini over to you

Copy link
Contributor

@wfernandes wfernandes left a comment

Choose a reason for hiding this comment

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

cmd/clusterctl/cmd/rollout.go Outdated Show resolved Hide resolved
@Arvinderpal
Copy link
Contributor Author

Just one nit. We should also add some documentation for this command in the CAPI book. See https://github.com/kubernetes-sigs/cluster-api/blob/master/docs/book/src/clusterctl/overview.md and
https://github.com/kubernetes-sigs/cluster-api/blob/master/docs/book/src/clusterctl/commands/commands.md

If you don't mind, can I update the docs in a followup PR?
I have created a task for this in the tracking issue: #3439

Also, I spoke with @fabriziopandini on slack. He didn't feel the need to review as long as you and @vincepri had done so.

If the tests pass, I think we should go ahead and merge.

@wfernandes
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 8, 2020
@wfernandes
Copy link
Contributor

/test pull-cluster-api-test-main

md1 := &clusterv1.MachineDeployment{
TypeMeta: metav1.TypeMeta{
Kind: "MachineDeployment",
APIVersion: "cluster.x-k8s.io/v1alpha3",
Copy link
Contributor

Choose a reason for hiding this comment

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

From the test failures, you may need to update these to v1alpha4. However, I didn't think we needed the APIVersion specified, so I think you can remove this.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 8, 2020
@wfernandes
Copy link
Contributor

wfernandes commented Dec 8, 2020

@Arvinderpal Ok..I was able to reproduce this failure by rebasing this branch with the main branch. I think the import in the rollout_test should be sigs.k8s.io/cluster-api/api/v1alpha4 but I haven't confirmed that fix yet.

@wfernandes
Copy link
Contributor

@Arvinderpal Yeah..I think that's it. We recently bumped to using v1alpha4 types everywhere instead of v1alpha3. Please change all the sigs.k8s.io/cluster-api/api/v1alpha3 imports to sigs.k8s.io/cluster-api/api/v1alpha4.
Sorry missed this in the review 😄

@Arvinderpal
Copy link
Contributor Author

@Arvinderpal Yeah..I think that's it. We recently bumped to using v1alpha4 types everywhere instead of v1alpha3. Please change all the sigs.k8s.io/cluster-api/api/v1alpha3 imports to sigs.k8s.io/cluster-api/api/v1alpha4.

Thanks for pointing that out. Just made the change. 🤞

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Dec 9, 2020

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

Test name Commit Details Rerun command
pull-cluster-api-apidiff-main 970212f link /test pull-cluster-api-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@wfernandes
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 9, 2020
@Arvinderpal
Copy link
Contributor Author

@vincepri should we merge this?

@vincepri
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

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 Dec 15, 2020
@k8s-ci-robot k8s-ci-robot merged commit e6c20f7 into kubernetes-sigs:master Dec 15, 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. 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.

6 participants