diff --git a/doc/developer/getting_started.md b/doc/developer/getting_started.md index a416f548..7d5886e1 100644 --- a/doc/developer/getting_started.md +++ b/doc/developer/getting_started.md @@ -105,7 +105,7 @@ Any change on the applied resource re-trigger the reconcile. Run the operator with the following command: ```sh -go run ./main.go standalone --cr playbooks/files/sf.yaml --namespace sf +go run ./main.go --namespace sf standalone --cr playbooks/files/sf.yaml ``` > The command returns when the expected state is applied. diff --git a/main.go b/main.go index 147f7a0f..89bd815b 100644 --- a/main.go +++ b/main.go @@ -104,10 +104,9 @@ func main() { rootCmd.Flags().BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.") - rootCmd.Flags().StringVar(&ns, "namespace", "", "The namespace to listen to.") + rootCmd.PersistentFlags().StringVarP(&ns, "namespace", "n", "sf", "The namespace to listen to.") // Flags for the standalone command - standaloneCmd.Flags().StringVar(&ns, "namespace", "sf", "The namespace where to reconcile the deployment.") standaloneCmd.Flags().StringVar(&sfResource, "cr", "", "The path to the CR to reconcile.") // Add sub commands diff --git a/roles/run-operator-standalone/tasks/main.yaml b/roles/run-operator-standalone/tasks/main.yaml index eba9cb7d..b1cbfbe8 100644 --- a/roles/run-operator-standalone/tasks/main.yaml +++ b/roles/run-operator-standalone/tasks/main.yaml @@ -17,7 +17,7 @@ - name: Run the operator in standalone mode ansible.builtin.shell: | set -o pipefail - go run ./main.go standalone --cr {{ cr_path }} --namespace sf 2>&1 | tee -a ~/zuul-output/logs/sf-operator.log + go run ./main.go --namespace sf standalone --cr {{ cr_path }} 2>&1 | tee -a ~/zuul-output/logs/sf-operator.log args: chdir: "{{ zuul.project.src_dir }}"