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 pivot phase to clusterctl and unify pivoting approach #731

Merged
merged 1 commit into from
Mar 11, 2019

Conversation

detiber
Copy link
Member

@detiber detiber commented Feb 5, 2019

What this PR does / why we need it:

  • Adds a new phase for pivoting Cluster API resources
  • Unifies pivoting approach:
    • Pivot ClusterAPI objects for all namespaces
    • Adds MachineClass support to pivoting
    • Scale down StatefulSets on pivot to avoid dueling controllers
    • Remove ownerRefs prior to pivoting objects
    • Change order of pivoting of Machine* objects to avoid race conditions
    • Recursively copy objects based on ownerRefs
  • clusterctl delete cluster now pivots and deletes Cluster API
    resources from all namespaces.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Related to #554
Fixes: #448

Release note:

`clusterctl` now has an alpha phase for pivoting Cluster API resources: `clusterctl alpha phases pivot`
`clusterctl delete cluster` will now pivot Cluster API resources in all namespaces

@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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 5, 2019
@detiber detiber mentioned this pull request Feb 5, 2019
11 tasks
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.

first pass review

cmd/clusterctl/cmd/alpha_phase_pivot.go Outdated Show resolved Hide resolved
cmd/clusterctl/phases/pivot.go Outdated Show resolved Hide resolved
cmd/clusterctl/phases/pivot.go Outdated Show resolved Hide resolved
cmd/clusterctl/phases/pivot.go Outdated Show resolved Hide resolved
cmd/clusterctl/phases/pivot.go Outdated Show resolved Hide resolved
return nil, err
}

if out.TypeMeta.Kind == "StatefulSet" {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we log a warning if this case is not matched saying we're ignoring something?

@vincepri vincepri added this to the v1alpha1 milestone Feb 10, 2019
@detiber detiber force-pushed the pivotPhase branch 2 times, most recently from b1fede7 to 049b558 Compare February 12, 2019 19:26
@k8s-ci-robot k8s-ci-robot added 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 Feb 12, 2019
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.

Lots of great work in this PR. Left some comments.

cmd/clusterctl/phases/pivot.go Outdated Show resolved Hide resolved
@vincepri
Copy link
Member

One clarification: the PR adds a new way to pivot resources, but doesn't change the current way when not using phases, is that correct?

@detiber
Copy link
Member Author

detiber commented Feb 13, 2019

One clarification: the PR adds a new way to pivot resources, but doesn't change the current way when not using phases, is that correct?

No, this both adds the phase and updates the pivot logic for both the clusterctl create and clusterctl delete workflows. Previously each of the existing workflows pivoted objects slightly differently and there were periods during each that would have two controllers managing the same set of objects.

@vincepri
Copy link
Member

Got it, we should update title and description then.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 14, 2019
@k8s-ci-robot k8s-ci-robot added 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 Feb 22, 2019
@roberthbailey roberthbailey removed this from the v1alpha1 milestone Feb 27, 2019
@detiber detiber force-pushed the pivotPhase branch 2 times, most recently from 611552e to a50ae6d Compare March 1, 2019 22:07
@detiber detiber changed the title [WIP] Add pivot phase to clusterctl Add pivot phase to clusterctl Mar 6, 2019
@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 Mar 6, 2019
@detiber detiber changed the title Add pivot phase to clusterctl Add pivot phase to clusterctl and unify pivoting approach Mar 6, 2019
@detiber detiber force-pushed the pivotPhase branch 2 times, most recently from 1ec078c to c5fcf48 Compare March 6, 2019 21:39
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.

Minor comments, otherwise LGTM! 🎉

cmd/clusterctl/clusterdeployer/clusterdeployer.go Outdated Show resolved Hide resolved
cmd/clusterctl/cmd/delete_cluster.go Show resolved Hide resolved
- Add `clusterctl alpha phases pivot` subcommand
- Pivot ClusterAPI objects for all namespaces
- Adds MachineClass support to pivoting
- Unify pivoting approach
- Scale down StatefulSets on pivot to avoid dueling controllers
- Remove ownerRefs prior to pivoting objects
- Change order of pivoting of Machine* objects to avoid race conditions
- Recursively copy objects based on ownerRefs
- `clusterctl delete cluster` now pivots and deletes Cluster API
  resources from all namespaces.

Co-authored-by: Chuck Ha <[email protected]>
Signed-off-by: Jason DeTiberus <[email protected]>
@detiber
Copy link
Member Author

detiber commented Mar 7, 2019

/test pull-cluster-api-test

@detiber
Copy link
Member Author

detiber commented Mar 7, 2019

arrgh, pull-cluster-api-test is failing on extracting kubebuilder-tools archive.
/test pull-cluster-api-test

@detiber
Copy link
Member Author

detiber commented Mar 7, 2019

/test pull-cluster-api-test

@detiber detiber force-pushed the pivotPhase branch 2 times, most recently from 46b405e to 71d559a Compare March 7, 2019 17:06
@detiber
Copy link
Member Author

detiber commented Mar 7, 2019

/test pull-cluster-api-test

@vincepri
Copy link
Member

vincepri commented Mar 7, 2019

I think this might need a rebase now that fetch-tools has been removed in the other PR.

@detiber
Copy link
Member Author

detiber commented Mar 7, 2019

I think this might need a rebase now that fetch-tools has been removed in the other PR.

@vincepri that was only for cluster-api-provider-aws, it proved to still be in use for this repo

@vincepri
Copy link
Member

vincepri commented Mar 7, 2019

Argh, I see. Hopefully it'll be fixes soon by kubebuilder folks.

@detiber
Copy link
Member Author

detiber commented Mar 7, 2019

@vincepri I triggered the last test to verify that it was working after hearing back from the kubebuilder team :)

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.

/approve

We should wait to merge it until early next week in case other folks have any more comments, wdyt?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: detiber, 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 Mar 7, 2019
@vincepri
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 Mar 11, 2019
@k8s-ci-robot k8s-ci-robot merged commit fbb9787 into kubernetes-sigs:master Mar 11, 2019
@detiber detiber deleted the pivotPhase branch April 2, 2019 17:44
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

External Bootstrap Cluster CleanUp
6 participants