feat: introduce deletion timestamp metric for multiple resources
What this PR does / why we need it:
Some resources can be blocked by deletion from finalizers. To catch this and expose it to metrics, we can use the deletion timestamp metadata field.
Introduce a deletion_timestamp metric for the next resources:
- deployment
kube_deployment_deletion_timestamp - statefulset
kube_statefulset_deletion_timestamp - daemonset
kube_daemonset_deletion_timestamp - service
kube_service_deletion_timestamp - poddisruptionbudget
kube_poddisruptionbudget_deletion_timestamp
Also formatting tables in docs
How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #
All commits were squashed into one.
Hi, could you share more insights on use cases after these metrics are added?
Is it used for monitoring Kubernetes resources that are stuck in a terminating state?
@CatherineF-dev Hi, yes, if the resource deletion process is stuck for some reason or blocked by the finalizer, deletiontimestamp metric can help to detect such a case and raise an alert for investigation.
/assign
@IgorIgnatevBolt How will we know which resource should be deleted?
@IgorIgnatevBolt How will we know which resource should be deleted?
Maybe I misunderstood the question, but this PR is exactly about detection for such resources that were nominated by the controller manager for deletion but not deleted for some reason, eq blocked by finalizers
The controller managing that finalizer notices the update to the object setting the metadata.deletionTimestamp, indicating deletion of the object has been requested.
Hi @CatherineF-dev, do you need any more information about PR or anything else that can help you move forward?
/assign @CatherineF-dev /triage accepted
rebased, conflicts solved
fixed typo in the depl test
/hold
for @CatherineF-dev to further comment. Renamed the title to include all additional resources in there.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: IgorIgnatevBolt, mrueg
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [mrueg]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/hold cancel