From 824eb9cabb04ca81990dd96330e3d85e7d76650b Mon Sep 17 00:00:00 2001 From: Ole Markus With Date: Sun, 31 Jul 2022 09:12:14 +0200 Subject: [PATCH] Remove passing cluster name as positional argument Apply suggestions from code review Co-authored-by: Ciprian Hacman --- cmd/kops/create_cluster.go | 2 +- cmd/kops/create_secret_ciliumpassword.go | 2 +- cmd/kops/create_secret_dockerconfig.go | 2 +- cmd/kops/create_secret_encryptionconfig.go | 2 +- cmd/kops/create_secret_weavepassword.go | 2 +- cmd/kops/create_sshpublickey.go | 2 +- cmd/kops/delete_cluster.go | 2 +- cmd/kops/delete_sshpublickey.go | 2 +- cmd/kops/edit_cluster.go | 2 +- cmd/kops/get_assets.go | 2 +- cmd/kops/get_instances.go | 2 +- cmd/kops/get_sshpublickeys.go | 2 +- cmd/kops/rolling-update_cluster.go | 2 +- cmd/kops/root.go | 10 ++++++++++ cmd/kops/toolbox_dump.go | 2 +- cmd/kops/toolbox_template.go | 2 +- cmd/kops/update_cluster.go | 2 +- cmd/kops/upgrade_cluster.go | 2 +- cmd/kops/validate_cluster.go | 2 +- docs/cli/kops_create_cluster.md | 2 +- docs/cli/kops_create_secret_ciliumpassword.md | 2 +- docs/cli/kops_create_secret_dockerconfig.md | 2 +- docs/cli/kops_create_secret_encryptionconfig.md | 2 +- docs/cli/kops_create_secret_weavepassword.md | 2 +- docs/cli/kops_create_sshpublickey.md | 2 +- docs/cli/kops_delete_cluster.md | 2 +- docs/cli/kops_delete_sshpublickey.md | 2 +- docs/cli/kops_edit_cluster.md | 2 +- docs/cli/kops_get_assets.md | 2 +- docs/cli/kops_get_instances.md | 2 +- docs/cli/kops_get_sshpublickeys.md | 2 +- docs/cli/kops_rolling-update_cluster.md | 2 +- docs/cli/kops_toolbox_dump.md | 2 +- docs/cli/kops_toolbox_template.md | 2 +- docs/cli/kops_update_cluster.md | 2 +- docs/cli/kops_upgrade_cluster.md | 2 +- docs/cli/kops_validate_cluster.md | 2 +- docs/releases/1.25-NOTES.md | 6 ++++++ pkg/featureflag/featureflag.go | 2 ++ 39 files changed, 54 insertions(+), 36 deletions(-) diff --git a/cmd/kops/create_cluster.go b/cmd/kops/create_cluster.go index e2aced3a36..d5f63cbabc 100644 --- a/cmd/kops/create_cluster.go +++ b/cmd/kops/create_cluster.go @@ -180,7 +180,7 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command { encryptEtcdStorage := false cmd := &cobra.Command{ - Use: "cluster [CLUSTER]", + Use: "cluster", Short: createClusterShort, Long: createClusterLong, Example: createClusterExample, diff --git a/cmd/kops/create_secret_ciliumpassword.go b/cmd/kops/create_secret_ciliumpassword.go index 33f30d0508..be1d19debf 100644 --- a/cmd/kops/create_secret_ciliumpassword.go +++ b/cmd/kops/create_secret_ciliumpassword.go @@ -64,7 +64,7 @@ func NewCmdCreateSecretCiliumPassword(f *util.Factory, out io.Writer) *cobra.Com options := &CreateSecretCiliumPasswordOptions{} cmd := &cobra.Command{ - Use: "ciliumpassword [CLUSTER] -f FILENAME", + Use: "ciliumpassword -f FILENAME", Short: createSecretCiliumPasswordShort, Long: createSecretCiliumPasswordLong, Example: createSecretCiliumPasswordExample, diff --git a/cmd/kops/create_secret_dockerconfig.go b/cmd/kops/create_secret_dockerconfig.go index faab77610a..4e8034a660 100644 --- a/cmd/kops/create_secret_dockerconfig.go +++ b/cmd/kops/create_secret_dockerconfig.go @@ -69,7 +69,7 @@ func NewCmdCreateSecretDockerConfig(f *util.Factory, out io.Writer) *cobra.Comma options := &CreateSecretDockerConfigOptions{} cmd := &cobra.Command{ - Use: "dockerconfig [CLUSTER] -f FILENAME", + Use: "dockerconfig -f FILENAME", Short: createSecretDockerConfigShort, Long: createSecretDockerConfigLong, Example: createSecretDockerConfigExample, diff --git a/cmd/kops/create_secret_encryptionconfig.go b/cmd/kops/create_secret_encryptionconfig.go index 6b3d86b0a2..85c2350637 100644 --- a/cmd/kops/create_secret_encryptionconfig.go +++ b/cmd/kops/create_secret_encryptionconfig.go @@ -63,7 +63,7 @@ func NewCmdCreateSecretEncryptionConfig(f *util.Factory, out io.Writer) *cobra.C options := &CreateSecretEncryptionConfigOptions{} cmd := &cobra.Command{ - Use: "encryptionconfig [CLUSTER] -f FILENAME", + Use: "encryptionconfig -f FILENAME", Short: createSecretEncryptionConfigShort, Long: createSecretEncryptionConfigLong, Example: createSecretEncryptionConfigExample, diff --git a/cmd/kops/create_secret_weavepassword.go b/cmd/kops/create_secret_weavepassword.go index d2c18dc979..e68d395f9f 100644 --- a/cmd/kops/create_secret_weavepassword.go +++ b/cmd/kops/create_secret_weavepassword.go @@ -71,7 +71,7 @@ func NewCmdCreateSecretWeavePassword(f *util.Factory, out io.Writer) *cobra.Comm options := &CreateSecretWeavePasswordOptions{} cmd := &cobra.Command{ - Use: "weavepassword [CLUSTER]", + Use: "weavepassword", Short: createSecretWeavePasswordShort, Long: createSecretWeavePasswordLong, Example: createSecretWeavePasswordExample, diff --git a/cmd/kops/create_sshpublickey.go b/cmd/kops/create_sshpublickey.go index c919534866..34c6e2c153 100644 --- a/cmd/kops/create_sshpublickey.go +++ b/cmd/kops/create_sshpublickey.go @@ -52,7 +52,7 @@ func NewCmdCreateSSHPublicKey(f *util.Factory, out io.Writer) *cobra.Command { options := &CreateSSHPublicKeyOptions{} cmd := &cobra.Command{ - Use: "sshpublickey [CLUSTER]", + Use: "sshpublickey", Short: createSSHPublicKeyShort, Long: createSSHPublicKeyLong, Example: createSSHPublicKeyExample, diff --git a/cmd/kops/delete_cluster.go b/cmd/kops/delete_cluster.go index c71a6ab3c0..29baa909a8 100644 --- a/cmd/kops/delete_cluster.go +++ b/cmd/kops/delete_cluster.go @@ -66,7 +66,7 @@ func NewCmdDeleteCluster(f *util.Factory, out io.Writer) *cobra.Command { options := &DeleteClusterOptions{} cmd := &cobra.Command{ - Use: "cluster [CLUSTER]", + Use: "cluster", Short: deleteClusterShort, Long: deleteClusterLong, Example: deleteClusterExample, diff --git a/cmd/kops/delete_sshpublickey.go b/cmd/kops/delete_sshpublickey.go index 03e4a0766d..b82af0c1a2 100644 --- a/cmd/kops/delete_sshpublickey.go +++ b/cmd/kops/delete_sshpublickey.go @@ -46,7 +46,7 @@ func NewCmdDeleteSSHPublicKey(f *util.Factory, out io.Writer) *cobra.Command { options := &DeleteSSHPublicKeyOptions{} cmd := &cobra.Command{ - Use: "sshpublickey [CLUSTER]", + Use: "sshpublickey", Short: deleteSSHPublicKeyShort, Example: deleteSSHPublicKeyExample, Args: rootCommand.clusterNameArgs(&options.ClusterName), diff --git a/cmd/kops/edit_cluster.go b/cmd/kops/edit_cluster.go index c44b686899..59c9319166 100644 --- a/cmd/kops/edit_cluster.go +++ b/cmd/kops/edit_cluster.go @@ -74,7 +74,7 @@ func NewCmdEditCluster(f *util.Factory, out io.Writer) *cobra.Command { options := &EditClusterOptions{} cmd := &cobra.Command{ - Use: "cluster [CLUSTER]", + Use: "cluster", Short: i18n.T("Edit cluster."), Long: editClusterLong, Example: editClusterExample, diff --git a/cmd/kops/get_assets.go b/cmd/kops/get_assets.go index bb0757b947..61daa86cb4 100644 --- a/cmd/kops/get_assets.go +++ b/cmd/kops/get_assets.go @@ -84,7 +84,7 @@ func NewCmdGetAssets(f *util.Factory, out io.Writer, getOptions *GetOptions) *co } cmd := &cobra.Command{ - Use: "assets [CLUSTER]", + Use: "assets", Short: getAssetsShort, Long: getAssetsLong, Example: getAssetsExample, diff --git a/cmd/kops/get_instances.go b/cmd/kops/get_instances.go index df305a2c87..af75a8d80d 100644 --- a/cmd/kops/get_instances.go +++ b/cmd/kops/get_instances.go @@ -67,7 +67,7 @@ type renderableCloudInstance struct { func NewCmdGetInstances(f *util.Factory, out io.Writer, options *GetOptions) *cobra.Command { cmd := &cobra.Command{ - Use: "instances [CLUSTER]", + Use: "instances", Short: getInstancesShort, Example: getInstancesExample, Args: rootCommand.clusterNameArgs(&options.ClusterName), diff --git a/cmd/kops/get_sshpublickeys.go b/cmd/kops/get_sshpublickeys.go index bdd4fc0553..df088d0ca1 100644 --- a/cmd/kops/get_sshpublickeys.go +++ b/cmd/kops/get_sshpublickeys.go @@ -50,7 +50,7 @@ func NewCmdGetSSHPublicKeys(f *util.Factory, out io.Writer, getOptions *GetOptio GetOptions: getOptions, } cmd := &cobra.Command{ - Use: "sshpublickeys [CLUSTER]", + Use: "sshpublickeys", Aliases: []string{"sshpublickey", "ssh"}, Short: getSSHPublicKeysShort, Example: getSSHPublicKeysExample, diff --git a/cmd/kops/rolling-update_cluster.go b/cmd/kops/rolling-update_cluster.go index d53b0476da..64a0e756cd 100644 --- a/cmd/kops/rolling-update_cluster.go +++ b/cmd/kops/rolling-update_cluster.go @@ -166,7 +166,7 @@ func NewCmdRollingUpdateCluster(f *util.Factory, out io.Writer) *cobra.Command { options.InitDefaults() cmd := &cobra.Command{ - Use: "cluster [CLUSTER]", + Use: "cluster", Short: rollingupdateShort, Long: rollingupdateLong, Example: rollingupdateExample, diff --git a/cmd/kops/root.go b/cmd/kops/root.go index b8945d8b30..de475fc1c0 100644 --- a/cmd/kops/root.go +++ b/cmd/kops/root.go @@ -37,6 +37,7 @@ import ( "k8s.io/kops/pkg/client/simple" "k8s.io/kops/pkg/commands" "k8s.io/kops/pkg/commands/commandutils" + "k8s.io/kops/pkg/featureflag" "k8s.io/kubectl/pkg/util/i18n" "k8s.io/kubectl/pkg/util/templates" ) @@ -247,6 +248,15 @@ func (c *RootCmd) clusterNameArgsAllowNoCluster(clusterName *string) func(cmd *c // * (and --name not specified) // Everything else is an error. func (c *RootCmd) ProcessArgs(args []string) error { + if len(args) > 0 { + fmt.Printf("\n") + fmt.Printf("\nClusterName as positional argument is deprecated and will be removed\n") + fmt.Printf("Use `KOPS_FEATURE_FLAGS=PositionalClusterArg` to revert to the old behavior.") + fmt.Printf("\n") + } + if !featureflag.PositionalClusterArg.Enabled() { + return nil + } if len(args) == 0 { return nil } diff --git a/cmd/kops/toolbox_dump.go b/cmd/kops/toolbox_dump.go index 2c426da2bf..9b0be4a733 100644 --- a/cmd/kops/toolbox_dump.go +++ b/cmd/kops/toolbox_dump.go @@ -75,7 +75,7 @@ func NewCmdToolboxDump(f commandutils.Factory, out io.Writer) *cobra.Command { options.InitDefaults() cmd := &cobra.Command{ - Use: "dump [CLUSTER]", + Use: "dump", Short: toolboxDumpShort, Long: toolboxDumpLong, Example: toolboxDumpExample, diff --git a/cmd/kops/toolbox_template.go b/cmd/kops/toolbox_template.go index 98fbb6c3ce..e63aaebada 100644 --- a/cmd/kops/toolbox_template.go +++ b/cmd/kops/toolbox_template.go @@ -79,7 +79,7 @@ func NewCmdToolboxTemplate(f commandutils.Factory, out io.Writer) *cobra.Command } cmd := &cobra.Command{ - Use: "template [CLUSTER]", + Use: "template", Short: toolboxTemplatingShort, Long: toolboxTemplatingLong, Example: toolboxTemplatingExample, diff --git a/cmd/kops/update_cluster.go b/cmd/kops/update_cluster.go index da3ec15113..9e74973d3a 100644 --- a/cmd/kops/update_cluster.go +++ b/cmd/kops/update_cluster.go @@ -101,7 +101,7 @@ func NewCmdUpdateCluster(f *util.Factory, out io.Writer) *cobra.Command { options.InitDefaults() cmd := &cobra.Command{ - Use: "cluster [CLUSTER]", + Use: "cluster", Short: updateClusterShort, Long: updateClusterLong, Example: updateClusterExample, diff --git a/cmd/kops/upgrade_cluster.go b/cmd/kops/upgrade_cluster.go index 504cdc4ee5..ade8a77274 100644 --- a/cmd/kops/upgrade_cluster.go +++ b/cmd/kops/upgrade_cluster.go @@ -66,7 +66,7 @@ func NewCmdUpgradeCluster(f *util.Factory, out io.Writer) *cobra.Command { options := &UpgradeClusterOptions{} cmd := &cobra.Command{ - Use: "cluster [CLUSTER]", + Use: "cluster", Short: upgradeClusterShort, Long: upgradeClusterLong, Example: upgradeClusterExample, diff --git a/cmd/kops/validate_cluster.go b/cmd/kops/validate_cluster.go index 662aceb0b8..be45e7346f 100644 --- a/cmd/kops/validate_cluster.go +++ b/cmd/kops/validate_cluster.go @@ -78,7 +78,7 @@ func NewCmdValidateCluster(f *util.Factory, out io.Writer) *cobra.Command { options.InitDefaults() cmd := &cobra.Command{ - Use: "cluster [CLUSTER]", + Use: "cluster", Short: validateClusterShort, Long: validateClusterLong, Example: validateClusterExample, diff --git a/docs/cli/kops_create_cluster.md b/docs/cli/kops_create_cluster.md index 0b5d682560..9acc86a987 100644 --- a/docs/cli/kops_create_cluster.md +++ b/docs/cli/kops_create_cluster.md @@ -12,7 +12,7 @@ Create a Kubernetes cluster using command line flags. This command creates cloud These operations are done in parallel and rely on eventual consistency. ``` -kops create cluster [CLUSTER] [flags] +kops create cluster [flags] ``` ### Examples diff --git a/docs/cli/kops_create_secret_ciliumpassword.md b/docs/cli/kops_create_secret_ciliumpassword.md index 42fdd44518..6e6328d7e2 100644 --- a/docs/cli/kops_create_secret_ciliumpassword.md +++ b/docs/cli/kops_create_secret_ciliumpassword.md @@ -10,7 +10,7 @@ Create a Cilium IPsec configuration. Create a new Cilium IPsec configuration and store it in the state store. This is used by Cilium to encrypt communication between pods/nodes. ``` -kops create secret ciliumpassword [CLUSTER] -f FILENAME [flags] +kops create secret ciliumpassword -f FILENAME [flags] ``` ### Examples diff --git a/docs/cli/kops_create_secret_dockerconfig.md b/docs/cli/kops_create_secret_dockerconfig.md index ed59b993cb..d2ec6ffec1 100644 --- a/docs/cli/kops_create_secret_dockerconfig.md +++ b/docs/cli/kops_create_secret_dockerconfig.md @@ -14,7 +14,7 @@ Create a new Docker config and store it in the state store. Used to configure Do This will also work when using containerd as the container runtime. ``` -kops create secret dockerconfig [CLUSTER] -f FILENAME [flags] +kops create secret dockerconfig -f FILENAME [flags] ``` ### Examples diff --git a/docs/cli/kops_create_secret_encryptionconfig.md b/docs/cli/kops_create_secret_encryptionconfig.md index 162a01fa6e..22d39f0465 100644 --- a/docs/cli/kops_create_secret_encryptionconfig.md +++ b/docs/cli/kops_create_secret_encryptionconfig.md @@ -10,7 +10,7 @@ Create an encryption config. Create a new encryption config and store it in the state store. Used to configure encryption-at-rest by the kube-apiserver process. ``` -kops create secret encryptionconfig [CLUSTER] -f FILENAME [flags] +kops create secret encryptionconfig -f FILENAME [flags] ``` ### Examples diff --git a/docs/cli/kops_create_secret_weavepassword.md b/docs/cli/kops_create_secret_weavepassword.md index 0241ab8855..c450a670bb 100644 --- a/docs/cli/kops_create_secret_weavepassword.md +++ b/docs/cli/kops_create_secret_weavepassword.md @@ -14,7 +14,7 @@ Create a new weave encryption secret and store it in the state store. Used by We WARNING: cannot be enabled or changed on a running cluster without downtime. ``` -kops create secret weavepassword [CLUSTER] [flags] +kops create secret weavepassword [flags] ``` ### Examples diff --git a/docs/cli/kops_create_sshpublickey.md b/docs/cli/kops_create_sshpublickey.md index 97e90dad2c..a9be0e2585 100644 --- a/docs/cli/kops_create_sshpublickey.md +++ b/docs/cli/kops_create_sshpublickey.md @@ -10,7 +10,7 @@ Create an SSH public key. Create a new SSH public key, and store the key in the state store. The key is not updated by this command. ``` -kops create sshpublickey [CLUSTER] [flags] +kops create sshpublickey [flags] ``` ### Examples diff --git a/docs/cli/kops_delete_cluster.md b/docs/cli/kops_delete_cluster.md index 4afa7d9b6e..d207baaadd 100644 --- a/docs/cli/kops_delete_cluster.md +++ b/docs/cli/kops_delete_cluster.md @@ -10,7 +10,7 @@ Delete a cluster. Deletes a Kubernetes cluster and all associated resources. Resources include instancegroups, secrets, and the state store. There is no "UNDO" for this command. ``` -kops delete cluster [CLUSTER] [flags] +kops delete cluster [flags] ``` ### Examples diff --git a/docs/cli/kops_delete_sshpublickey.md b/docs/cli/kops_delete_sshpublickey.md index 2dcb09b1fe..3d1d67a618 100644 --- a/docs/cli/kops_delete_sshpublickey.md +++ b/docs/cli/kops_delete_sshpublickey.md @@ -6,7 +6,7 @@ Delete an SSH public key. ``` -kops delete sshpublickey [CLUSTER] [flags] +kops delete sshpublickey [flags] ``` ### Examples diff --git a/docs/cli/kops_edit_cluster.md b/docs/cli/kops_edit_cluster.md index 88a3b06a58..f8f41b3a09 100644 --- a/docs/cli/kops_edit_cluster.md +++ b/docs/cli/kops_edit_cluster.md @@ -17,7 +17,7 @@ This command changes the desired cluster configuration in the registry. kops edit does not update the cloud resources; to apply the changes use `kops update cluster`. ``` -kops edit cluster [CLUSTER] [flags] +kops edit cluster [flags] ``` ### Examples diff --git a/docs/cli/kops_get_assets.md b/docs/cli/kops_get_assets.md index 5c0a345886..3f9240f891 100644 --- a/docs/cli/kops_get_assets.md +++ b/docs/cli/kops_get_assets.md @@ -14,7 +14,7 @@ When invoked with the `--copy` flag, will copy each asset from the canonical to the download location. ``` -kops get assets [CLUSTER] [flags] +kops get assets [flags] ``` ### Examples diff --git a/docs/cli/kops_get_instances.md b/docs/cli/kops_get_instances.md index 0c99caba12..8490c1a52e 100644 --- a/docs/cli/kops_get_instances.md +++ b/docs/cli/kops_get_instances.md @@ -6,7 +6,7 @@ Display cluster instances. ``` -kops get instances [CLUSTER] [flags] +kops get instances [flags] ``` ### Examples diff --git a/docs/cli/kops_get_sshpublickeys.md b/docs/cli/kops_get_sshpublickeys.md index 029d694e31..530960d324 100644 --- a/docs/cli/kops_get_sshpublickeys.md +++ b/docs/cli/kops_get_sshpublickeys.md @@ -6,7 +6,7 @@ Get one or many secrets. ``` -kops get sshpublickeys [CLUSTER] [flags] +kops get sshpublickeys [flags] ``` ### Examples diff --git a/docs/cli/kops_rolling-update_cluster.md b/docs/cli/kops_rolling-update_cluster.md index 1f5012193e..ebbfeb912e 100644 --- a/docs/cli/kops_rolling-update_cluster.md +++ b/docs/cli/kops_rolling-update_cluster.md @@ -22,7 +22,7 @@ Note: terraform users will need to run all of the following commands from the sa `terraform apply` prior to running `kops rolling-update cluster`. ``` -kops rolling-update cluster [CLUSTER] [flags] +kops rolling-update cluster [flags] ``` ### Examples diff --git a/docs/cli/kops_toolbox_dump.md b/docs/cli/kops_toolbox_dump.md index 2870fd53bd..870345eb06 100644 --- a/docs/cli/kops_toolbox_dump.md +++ b/docs/cli/kops_toolbox_dump.md @@ -10,7 +10,7 @@ Dump cluster information Displays cluster information. Includes information about cloud and Kubernetes resources. ``` -kops toolbox dump [CLUSTER] [flags] +kops toolbox dump [flags] ``` ### Examples diff --git a/docs/cli/kops_toolbox_template.md b/docs/cli/kops_toolbox_template.md index 282a0a2b2c..dfad0de8c4 100644 --- a/docs/cli/kops_toolbox_template.md +++ b/docs/cli/kops_toolbox_template.md @@ -10,7 +10,7 @@ Generate cluster.yaml from template Generate cluster.yaml from values input yaml file and apply template. ``` -kops toolbox template [CLUSTER] [flags] +kops toolbox template [flags] ``` ### Examples diff --git a/docs/cli/kops_update_cluster.md b/docs/cli/kops_update_cluster.md index 6dbed5b237..84b901c9c8 100644 --- a/docs/cli/kops_update_cluster.md +++ b/docs/cli/kops_update_cluster.md @@ -12,7 +12,7 @@ Create or update cloud or cluster resources to match the current cluster and ins If, such as during a Kubernetes upgrade, nodes need updating, a rolling-update may be subsequently required. ``` -kops update cluster [CLUSTER] [flags] +kops update cluster [flags] ``` ### Examples diff --git a/docs/cli/kops_upgrade_cluster.md b/docs/cli/kops_upgrade_cluster.md index ecb489e219..5c7afe5632 100644 --- a/docs/cli/kops_upgrade_cluster.md +++ b/docs/cli/kops_upgrade_cluster.md @@ -12,7 +12,7 @@ production ready Kubernetes version. After this command is run, use `kops update to finish a cluster upgrade. ``` -kops upgrade cluster [CLUSTER] [flags] +kops upgrade cluster [flags] ``` ### Examples diff --git a/docs/cli/kops_validate_cluster.md b/docs/cli/kops_validate_cluster.md index 7a5956177f..9b7115eac6 100644 --- a/docs/cli/kops_validate_cluster.md +++ b/docs/cli/kops_validate_cluster.md @@ -15,7 +15,7 @@ This commands validates the following components: 4. All pods with a critical priority are running and have "Ready" status. ``` -kops validate cluster [CLUSTER] [flags] +kops validate cluster [flags] ``` ### Examples diff --git a/docs/releases/1.25-NOTES.md b/docs/releases/1.25-NOTES.md index 92e46d093f..c5e73635fa 100644 --- a/docs/releases/1.25-NOTES.md +++ b/docs/releases/1.25-NOTES.md @@ -20,6 +20,12 @@ This changes the default behavior where the CSI snaphotter container was always So in case of manually deployed CRDs to make the snapshotter work it is now necessary to [enable the snapshot controller](https://kops.sigs.k8s.io/addons/#snapshot-controller). +## kOps CLI no longer accepts cluster name as positional argument + +Prior to kOps 1.25, one could pass cluser name as a CLI argument to most functions. E.g `kOps get `. As of kOps 1.25, kOps commands only accepts the cluster name through the `--name` flag or the `KOPS_CLUSTER_NAME` environment variable. The one exception to this change is the `kops get cluster` command, which still accepts one or more cluster names as positional arguments. + +This change is behind a feature flag. For now, one can revert to the old behavior by setting `KOPS_FEATURE_FLAGS=PositionalClusterArg`. + ## Other breaking changes * Support for Kubernetes version 1.19 has been removed. diff --git a/pkg/featureflag/featureflag.go b/pkg/featureflag/featureflag.go index b93100959d..e2857f2544 100644 --- a/pkg/featureflag/featureflag.go +++ b/pkg/featureflag/featureflag.go @@ -92,6 +92,8 @@ var ( ImageDigest = new("ImageDigest", Bool(true)) // Hetzner toggles the Hetzner Cloud support. Hetzner = new("Hetzner", Bool(false)) + // PositionalClusterArg enables passing cluster name as positional argument to various kOps commands + PositionalClusterArg = new("PositionalClusterArg", Bool(false)) ) // FeatureFlag defines a feature flag