AddFunc: func(obj interface{}) { namespace := obj.(*v1.Namespace) namespaceController.enqueueNamespace(namespace) } Run(workers int, stopCh <-chan struct{})--> for i := 0; i < workers; i++ { go wait"> AddFunc: func(obj interface{}) { namespace := obj.(*v1.Namespace) namespaceController.enqueueNamespace(namespace) } Run(workers int, stopCh <-chan struct{})--> for i := 0; i < workers; i++ { go wait"> AddFunc: func(obj interface{}) { namespace := obj.(*v1.Namespace) namespaceController.enqueueNamespace(namespace) } Run(workers int, stopCh <-chan struct{})--> for i := 0; i < workers; i++ { go wait">
discoverResourcesFn := namespaceKubeClient.Discovery().ServerPreferredNamespacedResources--> // fetch all api resources
all, err := ServerPreferredResources(d)-->
serverGroupList, err := d.ServerGroups()
groupVersionResources, failedGroups := fetchGroupVersionResources(d, serverGroupList)
apiResourceList, ok := groupVersionResources[groupVersion]
NewNamespaceController()-->
namespaceController := &NamespaceController{
queue: workqueue.NewNamedRateLimitingQueue(nsControllerRateLimiter(), "namespace"),
namespacedResourcesDeleter: deletion.NewNamespacedResourcesDeleter(kubeClient.CoreV1().Namespaces(), metadataClient, kubeClient.CoreV1(), discoverResourcesFn, finalizerToken),
}
namespaceInformer.Informer().AddEventHandlerWithResyncPeriod()-->
AddFunc: func(obj interface{}) {
namespace := obj.(*v1.Namespace)
namespaceController.enqueueNamespace(namespace)
}
Run(workers int, stopCh <-chan struct{})-->
for i := 0; i < workers; i++ {
go wait.Until(nm.worker, time.Second, stopCh)-->
key, quit := nm.queue.Get()
err := nm.syncNamespaceFromKey(key.(string))
namespace, err := nm.lister.Get(key)
nm.namespacedResourcesDeleter.Delete(namespace.Name)-->
//func (d *namespacedResourcesDeleter) Delete(nsName string) error
namespace, err := d.nsClient.Get(context.TODO(), nsName, metav1.GetOptions{})
if namespace.DeletionTimestamp == nil {
return nil
}
d.deleteAllContent(namespace)-->
resources, err := d.discoverResourcesFn()
gvrDeletionMetadata, err := d.deleteAllContentForGroupVersionResource(gvr, namespace, namespaceDeletedAt)
deletableResources := discovery.FilteredBy(discovery.SupportsAllVerbs{Verbs: []string{"delete"}}, resources)
}