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

✨ Introduce possibility to create clusterctl plugins #8957

Merged
merged 2 commits into from
Jul 10, 2023
Merged

✨ Introduce possibility to create clusterctl plugins #8957

merged 2 commits into from
Jul 10, 2023

Conversation

alexander-demicev
Copy link
Contributor

@alexander-demicev alexander-demicev commented Jul 4, 2023

What this PR does / why we need it:

We would like clusterctl to support bootstrapping a management cluster using the CAPI Operator, but at the same time, we'd like to avoid introducing new code to clusterctl for maintenance reasons (dependencies, etc.). One possible option for us is to enable the creation of clusterctl plugins in a similar way to kubectl.

This PR introduces a change that enables the creation of such plugins. The code relies on the kubectl package and borrows some code from it, specifically https://github.com/kubernetes/kubectl/blob/master/pkg/cmd/cmd.go#L115. In the current implementation, it will only be possible to create plugins for the clusterctl commands and not for subcommands.

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 the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 4, 2023
@k8s-ci-robot k8s-ci-robot added area/clusterctl Issues or PRs related to clusterctl size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 4, 2023
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.

I need some time to look at additional transitive dependencies + test; in the meantime, it will be great if you can document plugins in https://cluster-api.sigs.k8s.io/clusterctl/provider-contract.html (might be there is a better place)

@fabriziopandini
Copy link
Member

@ykakarap @Jont828 PTAL

@sbueringer
Copy link
Member

I need some time to look at additional transitive dependencies + test; in the meantime, it will be great if you can document plugins in https://cluster-api.sigs.k8s.io/clusterctl/provider-contract.html (might be there is a better place)

sigs.k8s.io/kustomize/kustomize/v5 v5.0.1 seems to be a big one

@Fedosin
Copy link
Contributor

Fedosin commented Jul 10, 2023

Tested this PR locally and it seems working right.
@alexander-demicev let me know if you need any help with documentation or tests for this patch.

@fabriziopandini
Copy link
Member

Dependency seems ok (they are all already k8s deps)

The only tricky one is sigs.k8s.io/kustomize/kustomize/v5 v5.0.1, which is big one, so I will ask other maintainers for an opinion on it (I'm +1)

Also, the PR is lacking the necessary doc + test, so we should consider if to get this merged before code-freeze if @alexander-demicev can follow up in the next two weeks at least for docs (I'm +1)

cc @CecileRobertMichon @sbueringer @killianmuldoon @enxebre @vincepri

@vincepri
Copy link
Member

I'm +1 as well

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.

no objections on dependencies from my end

cc @dtzar @mboersma

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 10, 2023
@alexander-demicev
Copy link
Contributor Author

I added some documentation, most of what is described in kubectl docs also applies here.

Copy link
Contributor

@Fedosin Fedosin 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 Jul 10, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 3088c09ace205b3ce91afaee4810f7f1fd06d9db

@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 Jul 10, 2023
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.

Thank you for doing this!

@k8s-ci-robot k8s-ci-robot merged commit bdcf67b into kubernetes-sigs:main Jul 10, 2023
12 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.5 milestone Jul 10, 2023
@alexander-demicev alexander-demicev deleted the clusterctlplugin branch July 11, 2023 08:33
@sbueringer
Copy link
Member

/lgtm

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. area/clusterctl Issues or PRs related to clusterctl 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.

None yet

8 participants