diff --git a/channels/pkg/cmd/apply_channel.go b/channels/pkg/cmd/apply_channel.go index 13f246fda7..106f547b81 100644 --- a/channels/pkg/cmd/apply_channel.go +++ b/channels/pkg/cmd/apply_channel.go @@ -46,8 +46,8 @@ func NewCmdApplyChannel(f Factory, out io.Writer) *cobra.Command { var options ApplyChannelOptions cmd := &cobra.Command{ - Use: "channel", - Short: "Apply channel", + Use: "channel CHANNEL", + Short: "Applies updates from the given channel", RunE: func(cmd *cobra.Command, args []string) error { ctx := context.TODO() return RunApplyChannel(ctx, f, out, &options, args) diff --git a/channels/pkg/cmd/get.go b/channels/pkg/cmd/get.go index d9697abe58..1e0e018d96 100644 --- a/channels/pkg/cmd/get.go +++ b/channels/pkg/cmd/get.go @@ -26,7 +26,7 @@ func NewCmdGet(f Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "get", SuggestFor: []string{"list"}, - Short: "list or get objects", + Short: "list or get addons", } // create subcommands diff --git a/cmd/kops/toolbox.go b/cmd/kops/toolbox.go index 8434f75c05..8778d4f068 100644 --- a/cmd/kops/toolbox.go +++ b/cmd/kops/toolbox.go @@ -35,6 +35,7 @@ func NewCmdToolbox(f commandutils.Factory, out io.Writer) *cobra.Command { cmd.AddCommand(NewCmdToolboxDump(f, out)) cmd.AddCommand(NewCmdToolboxTemplate(f, out)) cmd.AddCommand(NewCmdToolboxInstanceSelector(f, out)) + cmd.AddCommand(NewCmdToolboxAddons(out)) return cmd } diff --git a/cmd/kops/toolbox_addons.go b/cmd/kops/toolbox_addons.go new file mode 100644 index 0000000000..e06ac7c0a8 --- /dev/null +++ b/cmd/kops/toolbox_addons.go @@ -0,0 +1,58 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "io" + + channelscmd "k8s.io/kops/channels/pkg/cmd" + "k8s.io/kops/cmd/kops/util" + + "github.com/spf13/cobra" +) + +func NewCmdToolboxAddons(out io.Writer) *cobra.Command { + cmd := &cobra.Command{ + Use: "addons", + Short: "Manage addons", + SilenceErrors: true, + SilenceUsage: true, + } + + f := util.NewFactory(nil) + ctx := context.Background() + + // create subcommands + cmd.AddCommand(&cobra.Command{ + Use: "apply CHANNEL", + Short: "Applies updates from the given channel", + Example: "kops toolbox addons apply s3:////addons/bootstrap-channel.yaml", + RunE: func(cmd *cobra.Command, args []string) error { + return channelscmd.RunApplyChannel(ctx, f, out, &channelscmd.ApplyChannelOptions{}, args) + }, + }) + cmd.AddCommand(&cobra.Command{ + Use: "list", + Short: "Lists installed addons", + RunE: func(cmd *cobra.Command, args []string) error { + return channelscmd.RunGetAddons(ctx, f, out, &channelscmd.GetAddonsOptions{}) + }, + }) + + return cmd +} diff --git a/docs/cli/kops_toolbox.md b/docs/cli/kops_toolbox.md index c1fb3b40b7..1161143b11 100644 --- a/docs/cli/kops_toolbox.md +++ b/docs/cli/kops_toolbox.md @@ -23,6 +23,7 @@ Miscellaneous, infrequently used commands. ### SEE ALSO * [kops](kops.md) - kOps is Kubernetes Operations. +* [kops toolbox addons](kops_toolbox_addons.md) - Manage addons * [kops toolbox dump](kops_toolbox_dump.md) - Dump cluster information * [kops toolbox instance-selector](kops_toolbox_instance-selector.md) - Generate instance-group specs by providing resource specs such as vcpus and memory. * [kops toolbox template](kops_toolbox_template.md) - Generate cluster.yaml from template diff --git a/docs/cli/kops_toolbox_addons.md b/docs/cli/kops_toolbox_addons.md new file mode 100644 index 0000000000..033026bbd0 --- /dev/null +++ b/docs/cli/kops_toolbox_addons.md @@ -0,0 +1,28 @@ + + + +## kops toolbox addons + +Manage addons + +### Options + +``` + -h, --help help for addons +``` + +### Options inherited from parent commands + +``` + --config string yaml config file (default is $HOME/.kops.yaml) + --name string Name of cluster. Overrides KOPS_CLUSTER_NAME environment variable + --state string Location of state storage (kops 'config' file). Overrides KOPS_STATE_STORE environment variable + -v, --v Level number for the log level verbosity +``` + +### SEE ALSO + +* [kops toolbox](kops_toolbox.md) - Miscellaneous, infrequently used commands. +* [kops toolbox addons apply](kops_toolbox_addons_apply.md) - Applies updates from the given channel +* [kops toolbox addons list](kops_toolbox_addons_list.md) - Lists installed addons + diff --git a/docs/cli/kops_toolbox_addons_apply.md b/docs/cli/kops_toolbox_addons_apply.md new file mode 100644 index 0000000000..183bcaad02 --- /dev/null +++ b/docs/cli/kops_toolbox_addons_apply.md @@ -0,0 +1,36 @@ + + + +## kops toolbox addons apply + +Applies updates from the given channel + +``` +kops toolbox addons apply CHANNEL [flags] +``` + +### Examples + +``` +kops toolbox addons apply s3:////addons/bootstrap-channel.yaml +``` + +### Options + +``` + -h, --help help for apply +``` + +### Options inherited from parent commands + +``` + --config string yaml config file (default is $HOME/.kops.yaml) + --name string Name of cluster. Overrides KOPS_CLUSTER_NAME environment variable + --state string Location of state storage (kops 'config' file). Overrides KOPS_STATE_STORE environment variable + -v, --v Level number for the log level verbosity +``` + +### SEE ALSO + +* [kops toolbox addons](kops_toolbox_addons.md) - Manage addons + diff --git a/docs/cli/kops_toolbox_addons_list.md b/docs/cli/kops_toolbox_addons_list.md new file mode 100644 index 0000000000..7984da07c1 --- /dev/null +++ b/docs/cli/kops_toolbox_addons_list.md @@ -0,0 +1,30 @@ + + + +## kops toolbox addons list + +Lists installed addons + +``` +kops toolbox addons list [flags] +``` + +### Options + +``` + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --config string yaml config file (default is $HOME/.kops.yaml) + --name string Name of cluster. Overrides KOPS_CLUSTER_NAME environment variable + --state string Location of state storage (kops 'config' file). Overrides KOPS_STATE_STORE environment variable + -v, --v Level number for the log level verbosity +``` + +### SEE ALSO + +* [kops toolbox addons](kops_toolbox_addons.md) - Manage addons + diff --git a/docs/releases/1.26-NOTES.md b/docs/releases/1.26-NOTES.md index 9eed105981..0a7e28da2c 100644 --- a/docs/releases/1.26-NOTES.md +++ b/docs/releases/1.26-NOTES.md @@ -11,6 +11,8 @@ This is a document to gather the release notes prior to the release. * Control-plane instance groups in new clusters are now created with names starting with "control-plane-". The names of groups for existing clusters are unchanged. +* The channels CLI that kOps use to manage addons is now bundled with the kOps binary. These commands are useful for addon diagnostics and troubleshooting. For example, to list installed addons, run `kops toolbox addons get addons`. + ## AWS only * Bastions are now fronted by a Network Load Balancer.