-
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
Phase 2 Plugins should be able to parse flags passed in by a user #2689
Comments
/cc @rashmigottipati |
I would like to work on this if this a feature that is agreed to. |
The same scenario is faced for the plugins shipped on the CLI, i.e: #2563. The flag does not exist for the specific plugin. I think if we could in the Kubebuilder CLI do something like it could help out users to understand that the plugin N/version does not support the flag (for external or internal plugins).
|
Hi @camilamacedo86,
The problem that is faced here with Phase 2 Plugins is that even if the flag is defined by the external plugin, this error will occur. Just to show that the def parse_init_args(args_list):
p = argparse.ArgumentParser(description='Parse "init" plugin flags', conflict_handler="resolve")
p.add_argument('--domain', type=str, required=False, default='my.domain', help='Project domain')
p.add_argument('--license', type=str, required=False, default='apache2', help='Project license')
p.add_argument('--boolean', type=bool, required=False, default=False, help='Boolean flag', action=argparse.BooleanOptionalAction)
p.add_argument('--help', type=bool, required=False, default=False, help='Display help message', action=argparse.BooleanOptionalAction)
return p.parse_args(args_list), p We can see that the This can be seen here: https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/plugins/external/init.go Without implementing that |
@rashmigottipati I was speaking with @everettraven to understand it better and it shows a bug.
+1 for me here. @everettraven if you wish to push a PR with a suggestion to fix it your help is more than welcome. We need to add the samples + e2e tests asap as well. |
What do you want to happen?
Problem
The current implementation of Phase 2 Plugins does not provide logic to parse flags that a user passes to Kubebuilder to use with an external plugin.
For example, running
kubebuilder init --plugins myexternalplugin/v1 --domain example.com
you will get an output similar to:This output occurs even if the external plugin defines this flag because the external plugin does not do any logic to bind flags. We can see in this file that a
BindFlags
function is missing: https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/plugins/external/init.goProposed Solution
I propose that a solution is implemented similar to this:
This would allow for external plugin authors to define a command that could be used to get the flags that are allowed, making it so that Kubebuilder can provide an experience to its users that is similar to using the built in plugins. If an external plugin author does not implement this command Kubebuilder can default to allowing all flags to be parsed when using an external plugin and provide a general message to consult the external plugin documentation for more information regarding the flags.
Extra Labels
No response
The text was updated successfully, but these errors were encountered: