Skip to content

Instantly share code, notes, and snippets.

@sumanthkumarc
Last active February 3, 2022 18:34
Show Gist options
  • Save sumanthkumarc/e6e832e2f1a9ec0c484ccce6890191be to your computer and use it in GitHub Desktop.
Save sumanthkumarc/e6e832e2f1a9ec0c484ccce6890191be to your computer and use it in GitHub Desktop.
namespace-deletion-controller rough call stack
go wait.Until(nm.worker, time.Second, stopCh) - namespace_controller.go #209
err := nm.syncNamespaceFromKey(key.(string)) - namespace_controller.go #148
nm.namespacedResourcesDeleter.Delete(namespace.Name) - namespace_controller.go #192
estimate, err := d.deleteAllContent(namespace) - namespaced_resources_deleter.go #133
# 1. Resource discovery phase
resources, err := d.discoverResourcesFn() #502
conditionUpdater.ProcessDiscoverResourcesErr(err) #506 Sets v1.NamespaceDeletionDiscoveryFailure
# 2. Try deleting resources, if not collect errors and resources
discovery.GroupVersionResources(deletableResources) #510
conditionUpdater.ProcessGroupVersionErr(err) #514 Sets v1.NamespaceDeletionGVParsingFailure
# 3. Set remaining finalizers on ns and set resources remaining condition
conditionUpdater.ProcessContentTotals(numRemainingTotals) #542
# Sets v1.NamespaceContentRemaining on basis on remaining GroupVersionResources
# Sets v1.NamespaceFinalizersRemaining on basis of finalizers remaining on ns objecct
numRemainingTotals := allGVRDeletionMetadata{
gvrToNumRemaining: map[schema.GroupVersionResource]int{},
finalizersToNumRemaining: map[string]int{},
}
# 4. Finally set the content deletion failure error overall on namespace
conditionUpdater.Update(ns) #547 Finally if any errors occurred while deleting GroupVersionResources
They are collected and v1.NamespaceDeletionContentFailure is set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment