-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
clusterctl as a kubectl plugin #3533
Comments
This issue may inform the considerations of clusterctl as a kubectl plugin: |
/cc @Arvinderpal |
/area clusterctl |
Just wanted to drop a note that we’d be happy to support the distribution of the plugin from Krew (https://krew.sigs.k8s.io) side. |
Biggest Pro in my mind is:
It does lead to a challenge if someone wants to install something other than the "latest", but that is already an issue that exists with the current model. The benefits of this only increase if, as @jackfrancis pointed out, we implement #3255, since kubectl plugins/krew already exist and we wouldn't need to re-invent that wheel to implement plugins. Using plugins would also allow for faster iteration of experimental commands/tooling for Cluster API, in that the barrier to entry for adding new command/tools would just be creating a kubectl plugin and getting it added to krew rather than having to meet the higher barriers to entry for adding functionality to Things will probably get a bit tricky if we start talking about interacting with different plugins as part of a workflow (for example automating provider-specific steps) as part of a 'clusterctl init` style workflow, but those are also challenges that we would have if building our own plugin system. |
One potential drawback to kubectl plugins is that every command we currently have with clusterctl will be longer as a kubectl plugin. For example, |
One potential solution that we could have for this is to require plugins that are expected to interact with the main |
Is it 100% true that kubectl plugins are not able to be used immutably? I can't refer to |
Based on kubernetes-sigs/krew#343, I think that is correct. There is a proposal for supporting custom index repositories, though. We could likely use to publish our own indices, which we could separate out by 👋 version 👋 for the purposes of compatibility. I'm hand waving around version, since it might not be as simple as using the api version and we might want to have further discussion around how we would want to try and solve that (especially related to breaking changes in providers that may happen within the scope of a given 👋 version 👋 of cluster-api itself) |
Krew only allows installing latest version of a plugin for simplification reasons. (It has worked well for us so far with >110 plugins). My recommendation: if you have an older version you want to keep around and rarely rev, call it Custom indexes can be helpful here, but it requires you to name the plugins separately per version, and users can't upgrade, so you lose some of the benefit of distributing via a package manager. |
Thanks folks. Because (in a perfect world) clusterctl is a front-end on top of a strongly versioned cluster-api backend, there is an implicit cluster-api version associated with every clusterctl gesture/outcome. And because cluster-api does the normal thing and revs versions when it has a good reason to introduce a breaking API change, that means the version of cluster-api you're using (and by association the version of clusterctl you're using) is significant. I think the user story here is: "As a Kubernetes cluster admin who operates lots of cluster-api-enabled clusters I need version-specific-cluster-api tooling in order to maintain that heterogeneous cluster fleet." I suspect that's a very common scenario cluster admins who rely upon cluster-api find themselves in. |
Perhaps, |
That's what I was thinking as well 🙂 |
If we are thinking about sharing state, I wonder if we could leverage ideas from #3427. That is, the state being stored as part of CRDs for management cluster operator API. That is, when we |
We might not even need to get Consider the scenario that we have a unified operator and high level provider CRD that can register and manage provider components. In this scenario, users should be able to install CAPI through a kubectl plugin, and use some other way (either the same plugin, or kubectl apply) to configure and install a cluster api infrastructure provider. In the scenario of setup jobs, to initialize an account we could use a one off job that a user can Some food for thought, I admit that haven't thought through all use cases here. |
From the above discussion it seems like we were thinking of allowing
Maybe we need more examples of other plugins that might fit the use case of Some quick thoughts on possible usage of plugins:
If there was a need for other provider plugins that may need information/state from the |
@wfernandes Here's a user scenario that's not currently covered by # `capz` is the plugin managed by the CAPZ provider authors
$ kubectl capz create A gesture like that could create an Azure-backed cluster-api-enabled Kubernetes cluster from scratch, using Azure-appropriate defaults (for example, let's say that workflow creates an ephemeral AKS cluster to instantiate a the cluster-api mgmt componentry, then creates a target cluster backed by Azure IaaS, then does the equivalent It's possible to do this via the introduction of a standard, generic Basically, what I'm suggesting is that "promoting" Hope that makes sense. Strictly speaking, I don't think there's any real distinction between implementing "clusterctl plugins" vs implementing "cluster-api-relevant kubectl plugins". Both solutions are composable enough to handle the various hypotheticals folks have thrown out in this thread. The primary advantage (IMO) to the
Hope that makes sense! |
@jackfrancis Thanks for the explanation. This makes sense. I think the important thing to note here would be:
Creating a separate kubectl plugin for well-established providers makes sense. But I'm assuming for newer providers we either need to:
Otherwise the usability of the provider ecosystem may suffer. |
@wfernandes +1
Basically, the existing functionality makes sense (IMO) as a functional minimal bar to clear.
So yes, I think the key point is that we definitely want this plugin model to be opt-in, and for providers to expose one or the other (obviously when the new, plugin thing is new for a provider they can prototype it in an alpha phase for a bit until it's stable). I can sort of imagine the plugin matriculation working in both directions:
|
This thread is getting a bit chatty at this point, so I'll draft out what we've discussed so far in a more formal doc, with some progress towards concrete goals/solutions. @wfernandes would you like to co-author? In any event, I'll bug you to clarify goals/non-goals before writing anything more substantial. |
/kind design |
@jackfrancis Sure. I'd be happy to help wherever I can 🙂 |
@jackfrancis please share a link to the doc when it's ready for some eyes. |
Here's a doc outlining the problem statements as I see them (and what I am motivated to solve): https://docs.google.com/document/d/1FCX_u2mnxPgLYBXEPaS8Eni7423AmpkcZfiTkEZJUao As a result of formulating those problem statements, and some time/thought, my conclusions are that we're not ready to do this work, and should instead focus on stabilizing the set of clusterctl functionality. Open to thoughts from others! |
@jackfrancis I requested access to view the doc so I wasn't able to review it yet. If it makes sense we can either close this issue and reopen/recreate it when the need arises. |
+1 on closing for now. Thanks all for your valuable contributions to the historical record! :) |
User Story
As a Kubernetes operator leveraging cluster-api to manage cluster lifecycle, I would like to be able to do cluster-api-specific operations (e.g., things that clusterctl does) using a tool I'm already familiar with (e.g., kubectl) for the purpose of simplifying my toolchain.
Detailed Description
Let's investigate the pros/cons of implemeting "clusterctl" as a kubectl plugin, rather than maintaining a discrete CLI project.
Anything else you would like to add:
This issue description will be a living document until we figure out the scope of work that a kubectl "clusterctl plugin" will entail.
/kind feature
The text was updated successfully, but these errors were encountered: