Remove controller --namespace option

This commit is contained in:
Louis Taylor 2018-04-05 14:32:29 +01:00
parent acfc2f78d1
commit f43b926570
No known key found for this signature in database
GPG Key ID: 8E81A6DAE13E7098
2 changed files with 9 additions and 12 deletions

View File

@ -28,7 +28,11 @@ import (
kubeinformers "k8s.io/client-go/informers"
)
const controllerAgentName = "cert-manager-controller"
const (
controllerAgentName = "cert-manager-controller"
defaultNamespace = ""
)
func Run(opts *options.ControllerOptions, stopCh <-chan struct{}) {
ctx, kubeCfg, err := buildControllerContext(opts)
@ -120,8 +124,8 @@ func buildControllerContext(opts *options.ControllerOptions) (*controller.Contex
// If it is specified, all operations relating to ClusterIssuer resources
// should be disabled and thus we don't need to also create factories for
// the --cluster-resource-namespace.
sharedInformerFactory := informers.NewFilteredSharedInformerFactory(intcl, time.Second*30, opts.Namespace, nil)
kubeSharedInformerFactory := kubeinformers.NewFilteredSharedInformerFactory(cl, time.Second*30, opts.Namespace, nil)
sharedInformerFactory := informers.NewFilteredSharedInformerFactory(intcl, time.Second*30, defaultNamespace, nil)
kubeSharedInformerFactory := kubeinformers.NewFilteredSharedInformerFactory(cl, time.Second*30, defaultNamespace, nil)
return &controller.Context{
Client: cl,
CMClient: intcl,
@ -134,13 +138,13 @@ func buildControllerContext(opts *options.ControllerOptions) (*controller.Contex
Recorder: recorder,
KubeSharedInformerFactory: kubeSharedInformerFactory,
SharedInformerFactory: sharedInformerFactory,
Namespace: opts.Namespace,
Namespace: defaultNamespace,
ClusterResourceNamespace: opts.ClusterResourceNamespace,
ACMEHTTP01SolverImage: opts.ACMEHTTP01SolverImage,
ClusterIssuerAmbientCredentials: opts.ClusterIssuerAmbientCredentials,
IssuerAmbientCredentials: opts.IssuerAmbientCredentials,
}),
Namespace: opts.Namespace,
Namespace: defaultNamespace,
ClusterResourceNamespace: opts.ClusterResourceNamespace,
}, kubeCfg, nil
}

View File

@ -11,7 +11,6 @@ import (
type ControllerOptions struct {
APIServerHost string
Namespace string
ClusterResourceNamespace string
LeaderElect bool
@ -28,7 +27,6 @@ type ControllerOptions struct {
const (
defaultAPIServerHost = ""
defaultNamespace = ""
defaultClusterResourceNamespace = "kube-system"
defaultLeaderElect = true
@ -48,7 +46,6 @@ var (
func NewControllerOptions() *ControllerOptions {
return &ControllerOptions{
APIServerHost: defaultAPIServerHost,
Namespace: defaultNamespace,
ClusterResourceNamespace: defaultClusterResourceNamespace,
LeaderElect: defaultLeaderElect,
LeaderElectionNamespace: defaultLeaderElectionNamespace,
@ -64,13 +61,9 @@ func (s *ControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.APIServerHost, "master", defaultAPIServerHost, ""+
"Optional apiserver host address to connect to. If not specified, autoconfiguration "+
"will be attempted.")
fs.StringVar(&s.Namespace, "namespace", defaultNamespace, ""+
"Optional namespace to monitor resources within. This can be used to limit the scope "+
"of cert-manager to a single namespace. If not specified, all namespaces will be watched")
fs.StringVar(&s.ClusterResourceNamespace, "cluster-resource-namespace", defaultClusterResourceNamespace, ""+
"Namespace to store resources owned by cluster scoped resources such as ClusterIssuer in. "+
"This must be specified if ClusterIssuers are enabled.")
fs.BoolVar(&s.LeaderElect, "leader-elect", true, ""+
"If true, cert-manager will perform leader election between instances to ensure no more "+
"than one instance of cert-manager operates at a time")