Expose channels through kops toolbox cli

Make the channels apply commmand a bit more clear

Update cmd/kops/toolbox_addons.go

Co-authored-by: Ciprian Hacman <ciprian@hakman.dev>

Update cmd/kops/toolbox_addons.go

Co-authored-by: Ciprian Hacman <ciprian@hakman.dev>

fix docs
This commit is contained in:
Ole Markus With 2022-07-28 17:42:18 +02:00 committed by Ole Markus With
parent 27113fd204
commit 27e206a264
9 changed files with 159 additions and 3 deletions

View File

@ -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)

View File

@ -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

View File

@ -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
}

View File

@ -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://<state_store>/<cluster_name>/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
}

View File

@ -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

28
docs/cli/kops_toolbox_addons.md generated Normal file
View File

@ -0,0 +1,28 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## 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

36
docs/cli/kops_toolbox_addons_apply.md generated Normal file
View File

@ -0,0 +1,36 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## kops toolbox addons apply
Applies updates from the given channel
```
kops toolbox addons apply CHANNEL [flags]
```
### Examples
```
kops toolbox addons apply s3://<state_store>/<cluster_name>/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

30
docs/cli/kops_toolbox_addons_list.md generated Normal file
View File

@ -0,0 +1,30 @@
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
## 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

View File

@ -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.