Skip to content

Commit 4ad057b

Browse files
Sachin Manpathakcalind
authored andcommitted
Fix namespace command line arg behavior
1 parent 9f3b113 commit 4ad057b

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

cmd/mysql-operator/app/controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ mysql-operator is a Kubernetes addon to automate the deployment, scaling and
6868
management of multiple mysql clusters.`,
6969
// TODO: Refactor this function from this package
7070
Run: func(cmd *cobra.Command, args []string) {
71-
if err := o.Validate(); err != nil {
72-
glog.Fatalf("error validating options: %s", err.Error())
73-
}
7471
if err := gOpt.Validate(); err != nil {
7572
glog.Fatalf("error validating mysql controller options: %s", err.Error())
7673
}

cmd/mysql-operator/app/options/options.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ limitations under the License.
1717
package options
1818

1919
import (
20-
"fmt"
2120
"time"
2221

2322
"github.com/spf13/pflag"
24-
utilerrors "k8s.io/apimachinery/pkg/util/errors"
2523
)
2624

2725
type MysqlControllerOptions struct {
@@ -43,7 +41,7 @@ type MysqlControllerOptions struct {
4341

4442
const (
4543
defaultAPIServerHost = ""
46-
defaultNamespace = "default"
44+
defaultNamespace = ""
4745

4846
defaultLeaderElect = true
4947
defaultLeaderElectionNamespace = "kube-system"
@@ -74,8 +72,8 @@ func (s *MysqlControllerOptions) AddFlags(fs *pflag.FlagSet) {
7472
"Optional apiserver host address to connect to. If not specified, autoconfiguration "+
7573
"will be attempted.")
7674
fs.StringVar(&s.Namespace, "namespace", defaultNamespace, ""+
77-
"Namespace to monitor resources within. If not specified, default "+
78-
"namespace will be watched")
75+
"Namespace to monitor resources within. If not specified, all "+
76+
"namespaces will be watched")
7977

8078
fs.BoolVar(&s.LeaderElect, "leader-elect", true, ""+
8179
"If true, mysql-controller will perform leader election between instances "+
@@ -106,11 +104,3 @@ func (s *MysqlControllerOptions) AddFlags(fs *pflag.FlagSet) {
106104
fs.BoolVar(&s.InstallCRDs, "install-crds", defaultInstallCRDs, "Whether or not to install CRDs.")
107105

108106
}
109-
110-
func (o *MysqlControllerOptions) Validate() error {
111-
var errs []error
112-
if len(o.Namespace) == 0 {
113-
errs = append(errs, fmt.Errorf("no namespace specified"))
114-
}
115-
return utilerrors.NewAggregate(errs)
116-
}

0 commit comments

Comments
 (0)