@@ -43,57 +43,75 @@ type editSubcommand struct {
4343func (p * editSubcommand ) UpdateMetadata (cliMeta plugin.CLIMetadata , subcmdMeta * plugin.SubcommandMetadata ) {
4444 subcmdMeta .Description = `Edit project configuration to enable or disable layout settings.
4545
46- Multigroup (--multigroup):
47- Enable or disable multi-group layout.
48- Changes API structure: api/<version>/ becomes api/<group>/<version>/
49- Automatic: Updates PROJECT file, future APIs use new structure
50- Manual: Move existing API files, update import paths in controllers
51- More info: https://book.kubebuilder.io/migration/multi-group.html
52-
53- Namespaced (--namespaced):
54- Enable or disable namespace-scoped deployment.
55- Manager watches one or more specific namespaces vs all namespaces.
56- Namespaces to watch are configured via WATCH_NAMESPACE environment variable.
57- Automatic: Updates PROJECT file, scaffolds Role/RoleBinding, uses --force to regenerate manager.yaml
58- Manual: Add namespace= to RBAC markers in existing controllers, update cmd/main.go, run 'make manifests'
59- More info: https://book.kubebuilder.io/migration/namespace-scoped.html
60-
61- WARNING - Webhooks and Namespace-Scoped Mode:
62- Webhooks remain cluster-scoped even in namespace-scoped mode.
63- The manager cache is restricted to WATCH_NAMESPACE, but webhooks receive requests
64- from ALL namespaces. You must configure namespaceSelector or objectSelector to align
65- webhook scope with the cache.
66-
67- Force (--force):
68- Overwrite existing scaffolded files to apply configuration changes.
69- Example: With --namespaced, regenerates config/manager/manager.yaml to add WATCH_NAMESPACE env var.
70- Warning: This overwrites default scaffold files; manual changes in those files may be lost.
46+ This command modifies the PROJECT file and optionally regenerates scaffolded files.
47+ Use this to change layout settings or add optional plugins after project initialization.
48+
49+
50+ Plugin flags:
51+ --plugins: Comma-separated list of plugins to add to the project
52+ Plugins are saved to the PROJECT file and used in future operations
53+ Run 'kubebuilder edit --plugins --help' to see available plugins
54+
55+ Layout flags:
56+ --multigroup: Enable/Disable multigroup layout to organize APIs by group
57+ Scaffolds APIs in api/<group>/<version>/ instead of api/<version>/
58+ Useful when managing multiple API groups (e.g., batch, apps, crew)
59+ Automatic: Updates PROJECT file; future APIs use new structure
60+ Manual: Move existing API files, update import paths in controllers
61+ More info: https://book.kubebuilder.io/migration/multi-group.html
62+
63+ --namespaced: Enable/Disable namespace-scoped deployment instead of cluster-scoped
64+ Manager watches one or more specific namespaces instead of all namespaces
65+ Namespaces to watch are configured via WATCH_NAMESPACE environment variable
66+ Uses Role/RoleBinding instead of ClusterRole/ClusterRoleBinding
67+ Automatic: Updates PROJECT file, scaffolds Role/RoleBinding
68+ Manual: Add namespace= to RBAC markers in controllers, update cmd/main.go, run 'make manifests'
69+ More info: https://book.kubebuilder.io/migration/namespace-scoped.html
70+
71+ WARNING - Webhooks and Namespace-Scoped Mode:
72+ Webhooks remain cluster-scoped even in namespace-scoped mode.
73+ The manager cache is restricted to WATCH_NAMESPACE, but webhooks receive requests
74+ from ALL namespaces. Configure namespaceSelector or objectSelector to align
75+ webhook scope with the cache.
76+
77+ --force: Overwrite existing scaffolded files to apply configuration changes
78+ Example: With --namespaced, regenerates config/manager/manager.yaml to add WATCH_NAMESPACE
79+ Warning: Overwrites default scaffold files; manual changes may be lost
7180
7281Note: To add optional plugins after initialization, use 'kubebuilder edit --plugins <plugin-name>'.
7382 Run 'kubebuilder edit --plugins --help' to see available plugins.
7483`
7584 subcmdMeta .Examples = fmt .Sprintf (` # Enable multigroup layout
7685 %[1]s edit --multigroup
7786
78- # Enable namespace-scoped permissions
87+ # Enable namespace-scoped deployment
7988 %[1]s edit --namespaced
8089
81- # Enable with automatic file regeneration
90+ # Enable namespace-scoped with automatic file regeneration
8291 %[1]s edit --namespaced --force
8392
8493 # Disable multigroup layout
8594 %[1]s edit --multigroup=false
8695
87- # Enable/disable multiple settings
96+ # Enable/Disable multiple settings at once
8897 %[1]s edit --multigroup --namespaced --force
98+
99+ # Add Helm plugin to existing project
100+ %[1]s edit --plugins helm/v2-alpha
101+
102+ # Add multiple plugins
103+ %[1]s edit --plugins grafana/v1-alpha,autoupdate/v1-alpha
89104` , cliMeta .CommandName )
90105}
91106
92107func (p * editSubcommand ) BindFlags (fs * pflag.FlagSet ) {
93108 p .fs = fs
94- fs .BoolVar (& p .multigroup , "multigroup" , false , "enable or disable multigroup layout" )
95- fs .BoolVar (& p .namespaced , "namespaced" , false , "enable or disable namespace-scoped deployment" )
96- fs .BoolVar (& p .force , "force" , false , "overwrite scaffolded files to apply changes (manual edits may be lost)" )
109+ fs .BoolVar (& p .multigroup , "multigroup" , false ,
110+ "enable or disable multigroup layout (api/<group>/<version>/)" )
111+ fs .BoolVar (& p .namespaced , "namespaced" , false ,
112+ "enable or disable namespace-scoped deployment (default: cluster-scoped)" )
113+ fs .BoolVar (& p .force , "force" , false ,
114+ "overwrite scaffolded files to apply configuration changes (manual edits may be lost)" )
97115}
98116
99117func (p * editSubcommand ) InjectConfig (c config.Config ) error {
0 commit comments