code: func NewNamespaceController(
  	kubeClient clientset.Interface,
  	dynamicClient dynamic.Interface,
  	discoverResourcesFn func() ([]*metav1.APIResourceList, error),
  	namespaceInformer coreinformers.NamespaceInformer,
  	resyncPeriod time.Duration,
  	finalizerToken v1.FinalizerName) *NamespaceController {
  
  	// create the controller so we can inject the enqueue function
  	namespaceController := &NamespaceController{
  		queue:                      workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "namespace"),
  		namespacedResourcesDeleter: deletion.NewNamespacedResourcesDeleter(kubeClient.CoreV1().Namespaces(), dynamicClient, kubeClient.CoreV1(), discoverResourcesFn, finalizerToken, true),
  	}
  
  	if kubeClient != nil && kubeClient.CoreV1().RESTClient().GetRateLimiter() != nil {
  		metrics.RegisterMetricAndTrackRateLimiterUsage("namespace_controller", kubeClient.CoreV1().RESTClient().GetRateLimiter())
  	}
  
  	// configure the namespace informer event handlers
  	namespaceInformer.Informer().AddEventHandlerWithResyncPeriod(
  		cache.ResourceEventHandlerFuncs{
  			AddFunc: func(obj interface{}) {
  				namespace := obj.(*v1.Namespace)
  				namespaceController.enqueueNamespace(namespace)
  			},
  			UpdateFunc: func(oldObj, newObj interface{}) {
  				namespace := newObj.(*v1.Namespace)
  				namespaceController.enqueueNamespace(namespace)
  			},
  		},
  		resyncPeriod,
  	)
  	namespaceController.lister = namespaceInformer.Lister()
  	namespaceController.listerSynced = namespaceInformer.Informer().HasSynced
  
  	return namespaceController
  }
docs: // NewNamespaceController creates a new NamespaceController