Skip to content

Commit

Permalink
commands/operator-sdk/cmd/local: add namespace flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jhernandezb committed May 22, 2018
1 parent 8a1704d commit eac3646
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion commands/operator-sdk/cmd/up/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ kubernetes cluster using a kubeconfig file.

upLocalCmd.Flags().StringVar(&kubeConfig, "kubeconfig", "", "The file path to kubernetes configuration file; defaults to $HOME/.kube/config")
upLocalCmd.Flags().StringVar(&operatorFlags, "operator-flags", "", "The flags that the operator needs. Example: \"--flag1 value1 --flag2=value2\"")
upLocalCmd.Flags().StringVarP(&namespace, "namespace", "n", "default", "The namespace where the operator will watch.")

return upLocalCmd
}

var (
kubeConfig string
operatorFlags string
namespace string
)

const (
Expand Down Expand Up @@ -78,7 +80,7 @@ func upLocal(projectName string) {
dc := exec.Command(gocmd, args...)
dc.Stdout = os.Stdout
dc.Stderr = os.Stderr
dc.Env = append(os.Environ(), fmt.Sprintf("%v=%v", k8sutil.KubeConfigEnvVar, kubeConfig))
dc.Env = append(os.Environ(), fmt.Sprintf("%v=%v", k8sutil.KubeConfigEnvVar, kubeConfig), fmt.Sprintf("%v=%v", k8sutil.WatchNamespaceEnvVar, namespace))
err := dc.Run()
if err != nil {
cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to run operator locally: %v", err))
Expand Down

0 comments on commit eac3646

Please sign in to comment.