-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Allow every command to overwrite project-configured plugins #1941
Comments
in the EP you added the following example:
So, I understand that it allow executing the create api of 1 - Why we need to re-inform |
Yes, the example considers plugin chaining which is not available in plugin phase 1. So there are two different topics, first plugin chaining and second replacing the plugins for a specific command call. This Issue talks about the second point. The first point is proposed in plugin phase 1.5.
What you are doing is replacing the plugins just for that specific call. It would also be useful for removing a plugin if you dont want it for that command.
I understand that by A and B you mean both plugins.
The idea of this issue is to allow to use a certain set of plugins just for one call. Imagine we have a plugin that creates tests for the controllers, for example. But we don't want to set it for all of out controllers, so we don't set that plugin in
As a operator/controller developer I have 5 different APIs with their corresponding controllers. One of them uses the declarative pattern, the other 2 don't. I want to be able to set the declarative pattern plugin ONLY for the corresponding |
As we discussed in the kb meeting shows that it would require changes in the PROJECT file (config) to track what info was scaffold with each plugin. And then, because of this, it might only be addressed for v4.0.0. |
I'd like to only summarize here the full discussion and the common ground that we reach about this issue to address all concerns raised. This issue would be implemented as a follow to #1991. Where it will allow us to call a superset of plugins for a specific command. It will allow a user to decide what execution should or not receive the additional plugins scaffolds. By using the Example Config: layout: layout: go.kubebuilder.io/v3 Then when we call: It will execute the create api command implemented for the default layout In order to allow us to troubleshoot and still able to re-create the project from the config data then; the plugin info will be stored in the PROJECT file in the preexistent attribute plugins in the same way that the emulation of plugins phase 2 ( custom scaffolds) has been done in SDK (see here): plugins:
declarative.kubebuilder.io/v1: {} Also, if the plugin informed has additional args/flags then this data will be tracked in the specific plugin map such as: plugins:
declarative.kubebuilder.io/v1:
domain: example.io
group: crew
kind: Captain
version: v1
flag1: value // specific flags for the plugin informed in the --plugins
flag2: value // specific flags for the plugin informed in the --plugins Note that the definition for it would store the GVK + the additional plugin flags since the GVK is a unique identifier for the resources scaffold for the project. Also, to ensure this scenario with the addon/declarative plugin we can call it for only one of the many API's scaffolds in the generate_testdata of the project-v3. |
Just adding onto Camila's comment: |
To clarify: Example (Adirio suggestion with both flags)
It would execute the create api implement The default behaviour described in #1941 (comment) would be done via IMO It shows problematic since we would allow the scaffold to create api using the I cannot see a current requirement that justifies we bring these complexities and add both flags. Also, it shows brings confusion and makes its usage less intuitive for the users and us. |
IMO: As described above, we make ask for the users inform again the default global plugins defined in the layout might not to be the best user experience and can bring confusion. Also, I still think that it might bring some technical complexities such as to track the plugin info or allow more compatible possibilities which we could avoid. In this way, I would prefer/vote in the overwrite means run layout plugins + the plugins informed in the chain. Then, we would track in attr plugins only what was informed in the chain. However, since you are working on it and if you think that still easier for us to achieve the goal requires at least in this first moment inform all plugins instead. Then, I have no big objections to it. However, to close this one we will need to address the points discussed in #2060 (comment) a follow-up. After 1.5 it will still be missing:
|
The main advantage from overiding plugins instead of adding plugins is the following: Overriding plugins:
is equivalent to incrementing plugins:
but overriding plugins:
cannot be achieved with incrementing plugins. P.S.: the three points listed and their fulfillment is being tracked in the linked comment. |
When resolivng which plugins will handle each command, we currently have 3 sources for the project version and plugin keys: project configuration file, flags or default values.
Init commands will not have a project configuration file, so the precedence is clear, flags override default values. However, the rest of the commands require a project configuration so they have 2 sources that are at the same level, flags and project configuration, both overriding the default values. If both flags and project configuration are present, the current approach is to fail in case they are different. This makes total sense for the project version, as you can't run a create command for project version 3 on a project version , obviously. But in the case of plugins, we may want to allow them to be different.
Let's say that we create a plugin that modifies the
controller.go
file to insert inside the reconcile function some scaffold code and/or that creates acontroller_test.go
scaffold. We may want to use this plugin for some of the controllers generated in this project but not for all of them.I would allow command calls'
--plugin
flag to temporaly override thelayout
field set in the project configuration file. And by temporaly override I mean that this command call will be called with the values of the flag but the project configurationlayout
field will not be modified, and therefore, succesive command calls will still use the plugins configured during project initialization.The text was updated successfully, but these errors were encountered: