improbable-eng / etcd-cluster-operator

A controller to deploy and manage etcd clusters inside of Kubernetes
MIT License
129 stars 35 forks source link

Use pflag #156

Closed JamesLaverack closed 4 years ago

wallrj commented 4 years ago

Looks good to me.

richard   pflag  ~  projects  improbable-eng  156-pflag  1  ./bin/manager -h
Usage of ./bin/manager:
      --backup-tmp-dir string    The directory to temporarily place backups before they are uploaded to their destination. (default "/tmp")
      --enable-leader-election   Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.
      --metrics-addr string      The address the metric endpoint binds to. (default ":8080")
      --version                  Print version to stdout and exit
pflag: help requested

vs

 richard   master  ~  projects  improbable-eng  etcd-cluster-operator  2  ./bin/manager -h
Usage of ./bin/manager:
  -backup-tmp-dir string
        The directory to temporarily place backups before they are uploaded to their destination. (default "/tmp")
  -enable-leader-election
        Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.
  -kubeconfig string
        Paths to a kubeconfig. Only required if out-of-cluster.
  -master --kubeconfig
        (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
  -metrics-addr string
        The address the metric endpoint binds to. (default ":8080")
  -version
        Print version to stdout and exit

This makes it so that only the --option is supported, which I like.

The original version silently accepted both the -option and the --option variants...which I find confusing.

richard   master  ~  projects  improbable-eng  etcd-cluster-operator  1  ./bin/manager --help
Usage of ./bin/manager:
  -backup-tmp-dir string
        The directory to temporarily place backups before they are uploaded to their destination. (default "/tmp")
  -enable-leader-election
        Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.
  -kubeconfig string
        Paths to a kubeconfig. Only required if out-of-cluster.
  -master --kubeconfig
        (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
  -metrics-addr string
        The address the metric endpoint binds to. (default ":8080")
  -version
        Print version to stdout and exit
 richard   master  ~  projects  improbable-eng  etcd-cluster-operator  2  ./bin/manager --enable-leader-election
2020-02-12T17:35:36.132Z    INFO    setup   Starting manager    {"version": "v0.1.0-39-gb6cbfaa"}
2020-02-12T17:35:36.540Z    ERROR   setup   unable to start manager {"error": "unable to find leader election namespace: not running in-cluster, please specify LeaderElectionNamespace"}
github.com/go-logr/zapr.(*zapLogger).Error
    /home/richard/go/pkg/mod/github.com/go-logr/zapr@v0.1.1/zapr.go:128
main.main
    /home/richard/projects/improbable-eng/etcd-cluster-operator/main.go:64
runtime.main
    /home/richard/sdk/go1.13/src/runtime/proc.go:203