Skip to content

Commit

Permalink
make apiv1.NamespaceAll the default namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
scotthew1 authored and liyinan926 committed Jun 1, 2018
1 parent e941c18 commit b7351ea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/golang/glog"

apiv1 "k8s.io/api/core/v1"
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -60,7 +61,7 @@ var (
submissionRunnerThreads = flag.Int("submission-threads", 3, "Number of worker threads "+
"used by the SparkApplication submission runner.")
resyncInterval = flag.Int("resync-interval", 30, "Informer resync interval in seconds")
namespace = flag.String("namespace", "", "The Kubernetes namespace to manage. "+
namespace = flag.String("namespace", apiv1.NamespaceAll, "The Kubernetes namespace to manage. "+
"Will manage custom resource objects of the managed CRD types for the whole cluster if unset.")
)

Expand Down Expand Up @@ -108,7 +109,10 @@ func main() {
}

var factoryOpts []crdinformers.SharedInformerOption
if namespace != nil && *namespace != "" {
if namespace == nil {
ns := apiv1.NamespaceAll
namespace = &ns
} else if *namespace != apiv1.NamespaceAll {
factoryOpts = append(factoryOpts, crdinformers.WithNamespace(*namespace))
}
factory := crdinformers.NewSharedInformerFactoryWithOptions(
Expand Down
3 changes: 0 additions & 3 deletions pkg/controller/sparkapplication/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ func NewController(
informerFactory crdinformers.SharedInformerFactory,
submissionRunnerWorkers int,
namespace string) *Controller {
if namespace == "" {
namespace = apiv1.NamespaceAll
}
crdscheme.AddToScheme(scheme.Scheme)

eventBroadcaster := record.NewBroadcaster()
Expand Down
4 changes: 0 additions & 4 deletions pkg/initializer/initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ type SparkPodInitializer struct {

// New creates a new instance of Initializer.
func New(kubeClient clientset.Interface, namespace string) *SparkPodInitializer {
if namespace == "" {
namespace = apiv1.NamespaceAll
}

initializer := &SparkPodInitializer{
kubeClient: kubeClient,
queue: workqueue.NewNamedRateLimitingQueue(
Expand Down

0 comments on commit b7351ea

Please sign in to comment.