8000 [RFC][GarbageCollector] expose the progress of garbage collection · Issue #29891 · kubernetes/kubernetes · GitHub
[go: up one dir, main page]

Skip to content

[RFC][GarbageCollector] expose the progress of garbage collection #29891

@caesarxuchao

Description

@caesarxuchao

Problem:
Currently, if a user deletes an owner object, the object will be deleted from the apiserver right away. The garbage collector (GC) will delete the dependent objects in the background. User has no way to observe the progress of the garbage collection.

The progress of gc is useful information in some scenarios. For example, currently kubectl delete will block until all dependent resources are reaped, to maintain the same behavior when we turn on the GC, kubectl needs to know when the gc is done.

Tentative solutions

  1. Utilize the finalizer framework. When a deletion request is sent for the owner object, instead of deleting it from the storage, api-server adds string "gc" to the object's ObjectMeta.Finalizers list, GC will observe the change and recursively deletes its dependents. After all dependents are deleted, GC will finally delete the owner from the apiserver. So a client can infer if the gc is done by polling the existence of the owner object.
    The downside is that the gc can be recursive (e.g., gc of a Deployment) and can take long time, so the owner object's name will be hold for a long time.
  2. Let GC support queries for dependent objects. So a user can send the UID of the owner object to the GC and GC will respond with a list of dependent objects (GC already keeps a dependency graph in the memory). A client can infer the garbage collection is done when the returned list is empty. This information will be valuable for debugging as well.
    The **downside" is that the api will be informal. Such an API is meant to be consumed by human rather than to be programmed against.

I think we need to understand the use cases to decide which solution is better. Please comment.

@bgrant0607 @lavalamp @smarterclayton @pwittrock @kubernetes/sig-api-machinery

Metadata

Metadata

Assignees

Labels

sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0