You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
}).Debug("Kube Context is not set, using current context")
58
59
}
60
+
ifkubeNamespace=="" {
61
+
kubeNamespace="default"
62
+
}
59
63
s.KubernetesAPI.ContextName=kubeContextName
60
64
s.KubernetesAPI.Namespace=kubeNamespace
61
65
@@ -96,14 +100,18 @@ var installCmd = &cobra.Command{
96
100
97
101
funcinit() {
98
102
rootCmd.AddCommand(installCmd)
103
+
104
+
viper.BindEnv("kube-namespace", "KUBE_NAMESPACE")
105
+
viper.BindEnv("kube-context", "KUBE_CONTEXT")
106
+
99
107
installCmd.Flags().StringVar(&clusterName, "cluster-name", "", "cluster name (if not passed runtime-environment will be created cluster-less)")
100
108
installCmd.Flags().String("venona-version", "", "Version of venona to install (default is the latest)")
101
109
installCmd.Flags().BoolVar(&skipRuntimeInstallation, "skip-runtime-installation", false, "Set flag if you already have a configured runtime-environment, add --runtime-environment flag with name")
102
110
installCmd.Flags().String("runtime-environment", "", "if --skip-runtime-installation set, will try to configure venona on current runtime-environment")
103
111
installCmd.Flags().BoolVar(&installOnlyRuntimeEnvironment, "only-runtime-environment", false, "Set to true to onlky configure namespace as runtime-environment for Codefresh")
104
112
installCmd.Flags().BoolVar(&dryRun, "dry-run", false, "Set to true to simulate installation")
105
-
installCmd.Flags().String("kube-namespace", "default", "Name of the namespace on which venona should be installed")
106
-
installCmd.Flags().String("kube-context-name", "", "Name of the kubernetes context on which venona should be installed (default is current-context)")
113
+
installCmd.Flags().StringVar(&kubeNamespace, "kube-namespace", viper.GetString("kube-namespace"), "Name of the namespace on which venona should be installed [$KUBE_NAMESPACE]")
114
+
installCmd.Flags().StringVar(&kubeContextName, "kube-context-name", viper.GetString("kube-context"), "Name of the kubernetes context on which venona should be installed (default is current-context) [$KUBE_CONTEXT]")
107
115
installCmd.Flags().BoolVar(&setDefaultRuntime, "set-default", false, "Mark the install runtime-environment as default one after installation")
rootCmd.PersistentFlags().String("cfconfig", viper.GetString("cfconfig"), "Config file (default is $HOME/.cfconfig) [$CFCONFIG]")
161
-
rootCmd.PersistentFlags().String("context", "", "Name of the context from --cfconfig (default is current-context)")
162
-
rootCmd.PersistentFlags().String("kube-config-path", viper.GetString("kubeconfig"), "Path to kubeconfig file (default is $HOME/.kube/config) [$KUBECONFIG]")
172
+
viper.BindEnv("apihost", "API_HOST")
173
+
viper.BindEnv("apitoken", "API_TOKEN")
174
+
175
+
rootCmd.PersistentFlags().StringVar(&configPath, "cfconfig", viper.GetString("cfconfig"), "Config file (default is $HOME/.cfconfig) [$CFCONFIG]")
176
+
rootCmd.PersistentFlags().StringVar(&cfAPIHost, "api-host", viper.GetString("apihost"), "Host of codefresh [$API_HOST]")
177
+
rootCmd.PersistentFlags().StringVar(&cfAPIToken, "api-token", viper.GetString("apitoken"), "Codefresh API token [$API_TOKEN]")
178
+
rootCmd.PersistentFlags().StringVar(&cfContext, "context", "", "Name of the context from --cfconfig (default is current-context)")
179
+
180
+
rootCmd.PersistentFlags().StringVar(&kubeConfigPath, "kube-config-path", viper.GetString("kubeconfig"), "Path to kubeconfig file (default is $HOME/.kube/config) [$KUBECONFIG]")
0 commit comments