From b5c88e4ca7cccf5f3f1f10345418d50a212024f9 Mon Sep 17 00:00:00 2001 From: jhernandezb Date: Tue, 22 May 2018 15:09:14 -0600 Subject: [PATCH 1/2] commands/operator-sdk/cmd/local: add namespace flag --- CHANGELOG.md | 2 +- commands/operator-sdk/cmd/up/local.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de0023dc66..8a2680fbf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### Added -- Added `operator-sdk up` command to help deploy an operator. Currently supports running an operator locally against an existing cluster e.g `operator-sdk up local --kubeconfig=`. See `operator-sdk up -h` for help. [#219](https://github.com/operator-framework/operator-sdk/pull/219) +- Added `operator-sdk up` command to help deploy an operator. Currently supports running an operator locally against an existing cluster e.g `operator-sdk up local --kubeconfig= --namespace=`. See `operator-sdk up -h` for help. [#219](https://github.com/operator-framework/operator-sdk/pull/219) ### Changed diff --git a/commands/operator-sdk/cmd/up/local.go b/commands/operator-sdk/cmd/up/local.go index 0763373008..29b3959b81 100644 --- a/commands/operator-sdk/cmd/up/local.go +++ b/commands/operator-sdk/cmd/up/local.go @@ -28,6 +28,7 @@ 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().StringVar(&namespace, "namespace", "default", "The namespace where the operator watches for changes.") return upLocalCmd } @@ -35,6 +36,7 @@ kubernetes cluster using a kubeconfig file. var ( kubeConfig string operatorFlags string + namespace string ) const ( @@ -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)) From baf0f0207e09c41b1193e304b7ebed5b59260fc5 Mon Sep 17 00:00:00 2001 From: jhernandezb Date: Tue, 22 May 2018 18:10:04 -0600 Subject: [PATCH 2/2] commands/operator-sdk/cmd/local: update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a2680fbf3..3362617f0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### Added -- Added `operator-sdk up` command to help deploy an operator. Currently supports running an operator locally against an existing cluster e.g `operator-sdk up local --kubeconfig= --namespace=`. See `operator-sdk up -h` for help. [#219](https://github.com/operator-framework/operator-sdk/pull/219) +- Added `operator-sdk up` command to help deploy an operator. Currently supports running an operator locally against an existing cluster e.g `operator-sdk up local --kubeconfig= --namespace=`. See `operator-sdk up -h` for help. [#219](https://github.com/operator-framework/operator-sdk/pull/219) [#274](https://github.com/operator-framework/operator-sdk/pull/274) ### Changed