You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2021/06/03 09:17:38 UTC

[camel-k] 07/09: refactor(cmd): changing global --config for --kube-config

This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 407c1951c2ba52742e00930147c13b9bcf1a6924
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu May 27 10:37:52 2021 +0200

    refactor(cmd): changing global --config for --kube-config
    
    The old config flag is clashing with the new one that we want to introduce for run subcommand. It makes sense to rename it as --kube-config as it makes reference to kube configuration file.
    
    Ref #2003
---
 e2e/common/cli/offline_commands_test.go | 8 ++++----
 pkg/cmd/modeline.go                     | 1 +
 pkg/cmd/root.go                         | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/e2e/common/cli/offline_commands_test.go b/e2e/common/cli/offline_commands_test.go
index 25028bf..834fc41 100644
--- a/e2e/common/cli/offline_commands_test.go
+++ b/e2e/common/cli/offline_commands_test.go
@@ -31,11 +31,11 @@ import (
 )
 
 func TestKamelVersionWorksOffline(t *testing.T) {
-	assert.Nil(t, Kamel("version", "--config", "non-existent-kubeconfig-file").Execute())
+	assert.Nil(t, Kamel("version", "--kube-config", "non-existent-kubeconfig-file").Execute())
 }
 
 func TestKamelHelpTraitWorksOffline(t *testing.T) {
-	traitCmd := Kamel("help", "trait", "--all", "--config", "non-existent-kubeconfig-file")
+	traitCmd := Kamel("help", "trait", "--all", "--kube-config", "non-existent-kubeconfig-file")
 	traitCmd.SetOut(ioutil.Discard)
 	assert.Nil(t, traitCmd.Execute())
 }
@@ -47,9 +47,9 @@ func TestKamelHelpOptionWorksOffline(t *testing.T) {
 }
 
 func TestKamelCompletionWorksOffline(t *testing.T) {
-	bashCmd := Kamel("completion", "bash", "--config", "non-existent-kubeconfig-file")
+	bashCmd := Kamel("completion", "bash", "--kube-config", "non-existent-kubeconfig-file")
 	bashCmd.SetOut(ioutil.Discard)
-	zshCmd := Kamel("completion", "zsh", "--config", "non-existent-kubeconfig-file")
+	zshCmd := Kamel("completion", "zsh", "--kube-config", "non-existent-kubeconfig-file")
 	zshCmd.SetOut(ioutil.Discard)
 	assert.Nil(t, bashCmd.Execute())
 	assert.Nil(t, zshCmd.Execute())
diff --git a/pkg/cmd/modeline.go b/pkg/cmd/modeline.go
index 2a06910..f04a741 100644
--- a/pkg/cmd/modeline.go
+++ b/pkg/cmd/modeline.go
@@ -53,6 +53,7 @@ var (
 	// file options must be considered relative to the source files they belong to
 	fileOptions = map[string]bool{
 		"resource":      true,
+		"kube-client":   true,
 		"open-api":      true,
 		"property-file": true,
 	}
diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go
index 06a775b..0e2ff77 100644
--- a/pkg/cmd/root.go
+++ b/pkg/cmd/root.go
@@ -84,7 +84,7 @@ func kamelPreAddCommandInit(options *RootCmdOptions) *cobra.Command {
 		SilenceUsage:           true,
 	}
 
-	cmd.PersistentFlags().StringVar(&options.KubeConfig, "config", os.Getenv("KUBECONFIG"), "Path to the config file to use for CLI requests")
+	cmd.PersistentFlags().StringVar(&options.KubeConfig, "kube-config", os.Getenv("KUBECONFIG"), "Path to the kube config file to use for CLI requests")
 	cmd.PersistentFlags().StringVarP(&options.Namespace, "namespace", "n", "", "Namespace to use for all operations")
 
 	return &cmd