mirror of https://github.com/kubernetes/kops.git
Rename "kops delete keypair" to "kops distrust keypair"
This commit is contained in:
parent
584aa56b6b
commit
cd48f10de5
|
@ -18,10 +18,11 @@ go_library(
|
|||
"delete_cluster.go",
|
||||
"delete_instance.go",
|
||||
"delete_instancegroup.go",
|
||||
"delete_keypair.go",
|
||||
"delete_secret.go",
|
||||
"describe.go",
|
||||
"describe_keypairs.go",
|
||||
"distrust.go",
|
||||
"distrust_keypair.go",
|
||||
"edit.go",
|
||||
"edit_cluster.go",
|
||||
"edit_instancegroup.go",
|
||||
|
|
|
@ -42,7 +42,7 @@ type DeleteOptions struct {
|
|||
|
||||
var (
|
||||
deleteLong = templates.LongDesc(i18n.T(`
|
||||
Delete Kubernetes clusters, instancegroups, instances, keypairs, and secrets, or a combination of the before mentioned.
|
||||
Delete Kubernetes clusters, instancegroups, instances, and secrets, or a combination of the before mentioned.
|
||||
`))
|
||||
|
||||
deleteExample = templates.Examples(i18n.T(`
|
||||
|
@ -63,7 +63,7 @@ var (
|
|||
kops delete ig --name=k8s-cluster.example.com node-example --yes
|
||||
`))
|
||||
|
||||
deleteShort = i18n.T("Delete clusters, instancegroups, instances, keypairs, or secrets.")
|
||||
deleteShort = i18n.T("Delete clusters, instancegroups, instances, or secrets.")
|
||||
)
|
||||
|
||||
func NewCmdDelete(f *util.Factory, out io.Writer) *cobra.Command {
|
||||
|
@ -92,7 +92,6 @@ func NewCmdDelete(f *util.Factory, out io.Writer) *cobra.Command {
|
|||
// create subcommands
|
||||
cmd.AddCommand(NewCmdDeleteCluster(f, out))
|
||||
cmd.AddCommand(NewCmdDeleteInstanceGroup(f, out))
|
||||
cmd.AddCommand(NewCmdDeleteKeypair(f, out))
|
||||
cmd.AddCommand(NewCmdDeleteSecret(f, out))
|
||||
cmd.AddCommand(NewCmdDeleteInstance(f, out))
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
Copyright 2019 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 (
|
||||
"io"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/kops/cmd/kops/util"
|
||||
"k8s.io/kubectl/pkg/util/i18n"
|
||||
"k8s.io/kubectl/pkg/util/templates"
|
||||
)
|
||||
|
||||
var (
|
||||
distrustLong = templates.LongDesc(i18n.T(`
|
||||
Distrust keypairs.
|
||||
`))
|
||||
|
||||
distrustExample = templates.Examples(i18n.T(`
|
||||
# Distrust a keypair
|
||||
kops distrust keypair ca 6977545226837259959403993899
|
||||
|
||||
`))
|
||||
|
||||
distrustShort = i18n.T("Distrust keypairs.")
|
||||
)
|
||||
|
||||
func NewCmdDistrust(f *util.Factory, out io.Writer) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "distrust",
|
||||
Short: distrustShort,
|
||||
Long: distrustLong,
|
||||
Example: distrustExample,
|
||||
}
|
||||
|
||||
// create subcommands
|
||||
cmd.AddCommand(NewCmdDistrustKeypair(f, out))
|
||||
|
||||
return cmd
|
||||
}
|
|
@ -29,32 +29,32 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
deleteKeypairLong = templates.LongDesc(i18n.T(`
|
||||
Delete a keypair.`))
|
||||
distrustKeypairLong = templates.LongDesc(i18n.T(`
|
||||
Distrust a keypair.`))
|
||||
|
||||
deleteKeypairExample = templates.Examples(i18n.T(`
|
||||
# Syntax: kops delete keypair KEYSET ID
|
||||
kops delete keypair ca 5938372002934847
|
||||
distrustKeypairExample = templates.Examples(i18n.T(`
|
||||
# Syntax: kops distrust keypair KEYSET ID
|
||||
kops distrust keypair ca 6977545226837259959403993899
|
||||
|
||||
`))
|
||||
|
||||
deleteKeypairShort = i18n.T(`Delete a keypair.`)
|
||||
distrustKeypairShort = i18n.T(`Distrust a keypair.`)
|
||||
)
|
||||
|
||||
type DeleteKeypairOptions struct {
|
||||
type DistrustKeypairOptions struct {
|
||||
ClusterName string
|
||||
Keyset string
|
||||
KeypairID string
|
||||
}
|
||||
|
||||
func NewCmdDeleteKeypair(f *util.Factory, out io.Writer) *cobra.Command {
|
||||
options := &DeleteKeypairOptions{}
|
||||
func NewCmdDistrustKeypair(f *util.Factory, out io.Writer) *cobra.Command {
|
||||
options := &DistrustKeypairOptions{}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "keypair KEYSET ID",
|
||||
Short: deleteKeypairShort,
|
||||
Long: deleteKeypairLong,
|
||||
Example: deleteKeypairExample,
|
||||
Short: distrustKeypairShort,
|
||||
Long: distrustKeypairLong,
|
||||
Example: distrustKeypairExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
ctx := context.TODO()
|
||||
|
||||
|
@ -65,12 +65,12 @@ func NewCmdDeleteKeypair(f *util.Factory, out io.Writer) *cobra.Command {
|
|||
}
|
||||
|
||||
if len(args) != 2 {
|
||||
exitWithError(fmt.Errorf("usage: kops delete keypair KEYSET ID"))
|
||||
exitWithError(fmt.Errorf("usage: kops distrust keypair KEYSET ID"))
|
||||
}
|
||||
options.Keyset = args[0]
|
||||
options.KeypairID = args[1]
|
||||
|
||||
err := RunDeleteKeypair(ctx, f, out, options)
|
||||
err := RunDistrustKeypair(ctx, f, out, options)
|
||||
if err != nil {
|
||||
exitWithError(err)
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ func NewCmdDeleteKeypair(f *util.Factory, out io.Writer) *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
func RunDeleteKeypair(ctx context.Context, f *util.Factory, out io.Writer, options *DeleteKeypairOptions) error {
|
||||
func RunDistrustKeypair(ctx context.Context, f *util.Factory, out io.Writer, options *DistrustKeypairOptions) error {
|
||||
if options.ClusterName == "" {
|
||||
return fmt.Errorf("ClusterName is required")
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ func RunDeleteKeypair(ctx context.Context, f *util.Factory, out io.Writer, optio
|
|||
}
|
||||
|
||||
if options.KeypairID == keyset.Primary.Id {
|
||||
return fmt.Errorf("cannot delete the primary keypair")
|
||||
return fmt.Errorf("cannot distrust the primary keypair")
|
||||
}
|
||||
item := keyset.Items[options.KeypairID]
|
||||
if item == nil {
|
|
@ -141,6 +141,7 @@ func NewCmdRoot(f *util.Factory, out io.Writer) *cobra.Command {
|
|||
cmd.AddCommand(NewCmdCompletion(f, out))
|
||||
cmd.AddCommand(NewCmdCreate(f, out))
|
||||
cmd.AddCommand(NewCmdDelete(f, out))
|
||||
cmd.AddCommand(NewCmdDistrust(f, out))
|
||||
cmd.AddCommand(NewCmdEdit(f, out))
|
||||
cmd.AddCommand(NewCmdExport(f, out))
|
||||
cmd.AddCommand(NewCmdGet(f, out))
|
||||
|
|
|
@ -39,8 +39,9 @@ kOps is Kubernetes Operations.
|
|||
|
||||
* [kops completion](kops_completion.md) - Output shell completion code for the given shell (bash or zsh).
|
||||
* [kops create](kops_create.md) - Create a resource by command line, filename or stdin.
|
||||
* [kops delete](kops_delete.md) - Delete clusters, instancegroups, instances, keypairs, or secrets.
|
||||
* [kops delete](kops_delete.md) - Delete clusters, instancegroups, instances, or secrets.
|
||||
* [kops describe](kops_describe.md) - Describe a resource.
|
||||
* [kops distrust](kops_distrust.md) - Distrust keypairs.
|
||||
* [kops edit](kops_edit.md) - Edit clusters and other resources.
|
||||
* [kops export](kops_export.md) - Export configuration.
|
||||
* [kops get](kops_get.md) - Get one or many resources.
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
## kops delete
|
||||
|
||||
Delete clusters, instancegroups, instances, keypairs, or secrets.
|
||||
Delete clusters, instancegroups, instances, or secrets.
|
||||
|
||||
### Synopsis
|
||||
|
||||
Delete Kubernetes clusters, instancegroups, instances, keypairs, and secrets, or a combination of the before mentioned.
|
||||
Delete Kubernetes clusters, instancegroups, instances, and secrets, or a combination of the before mentioned.
|
||||
|
||||
```
|
||||
kops delete -f FILENAME [--yes] [flags]
|
||||
|
@ -68,6 +68,5 @@ kops delete -f FILENAME [--yes] [flags]
|
|||
* [kops delete cluster](kops_delete_cluster.md) - Delete a cluster.
|
||||
* [kops delete instance](kops_delete_instance.md) - Delete an instance
|
||||
* [kops delete instancegroup](kops_delete_instancegroup.md) - Delete instancegroup
|
||||
* [kops delete keypair](kops_delete_keypair.md) - Delete a keypair.
|
||||
* [kops delete secret](kops_delete_secret.md) - Delete a secret
|
||||
|
||||
|
|
|
@ -54,5 +54,5 @@ kops delete cluster CLUSTERNAME [--yes] [flags]
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [kops delete](kops_delete.md) - Delete clusters, instancegroups, instances, keypairs, or secrets.
|
||||
* [kops delete](kops_delete.md) - Delete clusters, instancegroups, instances, or secrets.
|
||||
|
||||
|
|
|
@ -64,5 +64,5 @@ kops delete instance [flags]
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [kops delete](kops_delete.md) - Delete clusters, instancegroups, instances, keypairs, or secrets.
|
||||
* [kops delete](kops_delete.md) - Delete clusters, instancegroups, instances, or secrets.
|
||||
|
||||
|
|
|
@ -52,5 +52,5 @@ kops delete instancegroup [flags]
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [kops delete](kops_delete.md) - Delete clusters, instancegroups, instances, keypairs, or secrets.
|
||||
* [kops delete](kops_delete.md) - Delete clusters, instancegroups, instances, or secrets.
|
||||
|
||||
|
|
|
@ -50,5 +50,5 @@ kops delete secret [flags]
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [kops delete](kops_delete.md) - Delete clusters, instancegroups, instances, keypairs, or secrets.
|
||||
* [kops delete](kops_delete.md) - Delete clusters, instancegroups, instances, or secrets.
|
||||
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
|
||||
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
|
||||
|
||||
## kops distrust
|
||||
|
||||
Distrust keypairs.
|
||||
|
||||
### Synopsis
|
||||
|
||||
Distrust keypairs.
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
# Distrust a keypair
|
||||
kops distrust keypair ca 6977545226837259959403993899
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for distrust
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--add_dir_header If true, adds the file directory to the header of the log messages
|
||||
--alsologtostderr log to standard error as well as files
|
||||
--config string yaml config file (default is $HOME/.kops.yaml)
|
||||
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
|
||||
--log_dir string If non-empty, write log files in this directory
|
||||
--log_file string If non-empty, use this log file
|
||||
--log_file_max_size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
|
||||
--logtostderr log to standard error instead of files (default true)
|
||||
--name string Name of cluster. Overrides KOPS_CLUSTER_NAME environment variable
|
||||
--one_output If true, only write logs to their native severity level (vs also writing to each lower severity level)
|
||||
--skip_headers If true, avoid header prefixes in the log messages
|
||||
--skip_log_headers If true, avoid headers when opening log files
|
||||
--state string Location of state storage (kops 'config' file). Overrides KOPS_STATE_STORE environment variable
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level number for the log level verbosity
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [kops](kops.md) - kOps is Kubernetes Operations.
|
||||
* [kops distrust keypair](kops_distrust_keypair.md) - Distrust a keypair.
|
||||
|
|
@ -1,23 +1,23 @@
|
|||
|
||||
<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
|
||||
|
||||
## kops delete keypair
|
||||
## kops distrust keypair
|
||||
|
||||
Delete a keypair.
|
||||
Distrust a keypair.
|
||||
|
||||
### Synopsis
|
||||
|
||||
Delete a keypair.
|
||||
Distrust a keypair.
|
||||
|
||||
```
|
||||
kops delete keypair KEYSET ID [flags]
|
||||
kops distrust keypair KEYSET ID [flags]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
# Syntax: kops delete keypair KEYSET ID
|
||||
kops delete keypair ca 5938372002934847
|
||||
# Syntax: kops distrust keypair KEYSET ID
|
||||
kops distrust keypair ca 6977545226837259959403993899
|
||||
```
|
||||
|
||||
### Options
|
||||
|
@ -49,5 +49,5 @@ kops delete keypair KEYSET ID [flags]
|
|||
|
||||
### SEE ALSO
|
||||
|
||||
* [kops delete](kops_delete.md) - Delete clusters, instancegroups, instances, keypairs, or secrets.
|
||||
* [kops distrust](kops_distrust.md) - Distrust keypairs.
|
||||
|
Loading…
Reference in New Issue