Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cli/alpha.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Alpha subcommands are for unstable features.

- Alpha subcommands are exploratory and may be removed without warning.
- No backwards compatibility is provided for any alpha subcommands.
`),
`),
}
for i := range alphaCommands {
alpha.AddCommand(alphaCommands[i])
Expand Down
72 changes: 36 additions & 36 deletions pkg/cli/alpha/config-gen/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ config-gen programatically generates configuration for a controller-runtime base
project using the project source code (golang) and a KubebuilderConfigGen resource file.

This is an alternative to expressing configuration as a static set of kustomize patches
in the "config" directory.
in the "config" directory.

config-gen may be used as a standalone command run against a file, as a kustomize
transformer plugin, or as a configuration function (e.g. kpt).
Expand Down Expand Up @@ -148,55 +148,55 @@ The KubebuilderConfigGen resource has the following fields:
crds:
# path to go module source directory provided to controller-gen libraries
# optional -- defaults to '.'
sourceDirectory: ./relative/path
sourceDirectory: ./relative/path

# configure how the controller-manager is generated
# configure how the controller-manager is generated
controllerManager:
# image to run
image: my-org/my-project:v0.1.0
# image to run
image: my-org/my-project:v0.1.0

# if set, use component config for the controller-manager
# optional
componentConfig:
# use component config
# if set, use component config for the controller-manager
# optional
componentConfig:
# use component config
enable: true

# path to component config to put into a ConfigMap
configFilepath: ./path/to/componentconfig.yaml
# path to component config to put into a ConfigMap
configFilepath: ./path/to/componentconfig.yaml

# configure how metrics are exposed
metrics:
# disable the auth proxy required for scraping metrics
# configure how metrics are exposed
metrics:
# disable the auth proxy required for scraping metrics
# disable: false

# generate prometheus ServiceMonitor resource
enableServiceMonitor: true
# generate prometheus ServiceMonitor resource
enableServiceMonitor: true

# configure how webhooks are generated
# optional -- defaults to not generating webhook configuration
# optional -- defaults to not generating webhook configuration
webhooks:
# enable will cause webhook config to be generated
enable: true
# enable will cause webhook config to be generated
enable: true

# configures crds which use conversion webhooks
# configures crds which use conversion webhooks
enableConversion:
# key is the name of the CRD
# key is the name of the CRD
"bars.example.my.domain": true

# configures where to get the certificate used for webhooks
# discriminated union
certificateSource:
# type of certificate source
# one of ["certManager", "dev", "manual"] -- defaults to "manual"
# certManager: certmanager is used to manage certificates -- requires CertManager to be installed
# dev: certificate is generated and wired into resources
# manual: no certificate is generated or wired into resources
# discriminated union
certificateSource:
# type of certificate source
# one of ["certManager", "dev", "manual"] -- defaults to "manual"
# certManager: certmanager is used to manage certificates -- requires CertManager to be installed
# dev: certificate is generated and wired into resources
# manual: no certificate is generated or wired into resources
type: "dev"

# options for a dev certificate -- requires "dev" as the type
devCertificate:
duration: 1h
`)
# options for a dev certificate -- requires "dev" as the type
devCertificate:
duration: 1h
`)
c.Example = strings.TrimSpace(`
#
# As command
Expand All @@ -209,7 +209,7 @@ apiVersion: kubebuilder.sigs.k8s.io/v1alpha1
name: project
spec:
controllerManager
image: org/project:v0.1.0
image: org/project:v0.1.0
EOF

# run the config generator
Expand Down Expand Up @@ -250,7 +250,7 @@ EOF

# generate configuration from kustomize
kustomize build --enable-alpha-plugins .
`)
`)

dir, dirErr := getPluginDir()
pluginFile := filepath.Join(dir, "KubebuilderConfigGen")
Expand All @@ -261,10 +261,10 @@ kustomize build --enable-alpha-plugins .
Short: "Install config-gen as a kustomize plugin",
Long: strings.TrimSpace(fmt.Sprintf(`
Write a script to %s for kustomize to locate as a plugin.
`, pluginFile)),
`, pluginFile)),
Example: strings.TrimSpace(`
kubebuilder alpha config-gen install-as-plugin
`),
`),
RunE: func(cmd *cobra.Command, args []string) error {
if dirErr != nil {
return dirErr
Expand Down
3 changes: 2 additions & 1 deletion pkg/cli/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func (c CLI) newFishCmd() *cobra.Command {
$ %[1]s completion fish | source

# To load completions for each session, execute once:
$ %[1]s completion fish > ~/.config/fish/completions/%[1]s.fish`, c.commandName),
$ %[1]s completion fish > ~/.config/fish/completions/%[1]s.fish
`, c.commandName),
RunE: func(cmd *cobra.Command, cmdArgs []string) error {
return cmd.Root().GenFishCompletion(os.Stdout, true)
},
Expand Down
3 changes: 1 addition & 2 deletions pkg/plugins/golang/v2/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ After the scaffold is written, api will run make on the project.

# Regenerate code and run against the Kubernetes cluster configured by ~/.kube/config
make run
`,
ctx.CommandName)
`, ctx.CommandName)
}

func (p *createAPISubcommand) BindFlags(fs *pflag.FlagSet) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/plugins/golang/v2/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ func (p *editSubcommand) UpdateContext(ctx *plugin.Context) {
ctx.Description = `This command will edit the project configuration. You can have single or multi group project.`

ctx.Examples = fmt.Sprintf(`# Enable the multigroup layout
%s edit --multigroup
%[1]s edit --multigroup

# Disable the multigroup layout
%s edit --multigroup=false
`, ctx.CommandName, ctx.CommandName)
%[1]s edit --multigroup=false
`, ctx.CommandName)
}

func (p *editSubcommand) BindFlags(fs *pflag.FlagSet) {
Expand Down
3 changes: 1 addition & 2 deletions pkg/plugins/golang/v2/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ Writes the following files:
`
ctx.Examples = fmt.Sprintf(` # Scaffold a project using the apache2 license with "The Kubernetes authors" as owners
%s init --project-version=2 --domain example.org --license apache2 --owner "The Kubernetes authors"
`,
ctx.CommandName)
`, ctx.CommandName)

p.commandName = ctx.CommandName
}
Expand Down
7 changes: 3 additions & 4 deletions pkg/plugins/golang/v2/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,11 @@ validating and (or) conversion webhooks.
`
ctx.Examples = fmt.Sprintf(` # Create defaulting and validating webhooks for CRD of group ship, version v1beta1
# and kind Frigate.
%s create webhook --group ship --version v1beta1 --kind Frigate --defaulting --programmatic-validation
%[1]s create webhook --group ship --version v1beta1 --kind Frigate --defaulting --programmatic-validation

# Create conversion webhook for CRD of group shio, version v1beta1 and kind Frigate.
%s create webhook --group ship --version v1beta1 --kind Frigate --conversion
`,
ctx.CommandName, ctx.CommandName)
%[1]s create webhook --group ship --version v1beta1 --kind Frigate --conversion
`, ctx.CommandName)

p.commandName = ctx.CommandName
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/plugins/golang/v3/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ After the scaffold is written, api will run make on the project.

# Regenerate code and run against the Kubernetes cluster configured by ~/.kube/config
make run
`,
ctx.CommandName)
`, ctx.CommandName)
}

func (p *createAPISubcommand) BindFlags(fs *pflag.FlagSet) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/plugins/golang/v3/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ func (p *editSubcommand) UpdateContext(ctx *plugin.Context) {
ctx.Description = `This command will edit the project configuration. You can have single or multi group project.`

ctx.Examples = fmt.Sprintf(`# Enable the multigroup layout
%s edit --multigroup
%[1]s edit --multigroup

# Disable the multigroup layout
%s edit --multigroup=false
`, ctx.CommandName, ctx.CommandName)
%[1]s edit --multigroup=false
`, ctx.CommandName)
}

func (p *editSubcommand) BindFlags(fs *pflag.FlagSet) {
Expand Down
3 changes: 1 addition & 2 deletions pkg/plugins/golang/v3/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ Writes the following files:
`
ctx.Examples = fmt.Sprintf(` # Scaffold a project using the apache2 license with "The Kubernetes authors" as owners
%s init --project-version=2 --domain example.org --license apache2 --owner "The Kubernetes authors"
`,
ctx.CommandName)
`, ctx.CommandName)

p.commandName = ctx.CommandName
}
Expand Down
7 changes: 3 additions & 4 deletions pkg/plugins/golang/v3/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ validating and (or) conversion webhooks.
`
ctx.Examples = fmt.Sprintf(` # Create defaulting and validating webhooks for CRD of group ship, version v1beta1
# and kind Frigate.
%s create webhook --group ship --version v1beta1 --kind Frigate --defaulting --programmatic-validation
%[1]s create webhook --group ship --version v1beta1 --kind Frigate --defaulting --programmatic-validation

# Create conversion webhook for CRD of group ship, version v1beta1 and kind Frigate.
%s create webhook --group ship --version v1beta1 --kind Frigate --conversion
`,
ctx.CommandName, ctx.CommandName)
%[1]s create webhook --group ship --version v1beta1 --kind Frigate --conversion
`, ctx.CommandName)

p.commandName = ctx.CommandName
}
Expand Down