Add DeletionHandlingObjectToName

Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>

Kubernetes-commit: d60a25b2db52d7e180b0962e23cc06e71f36fb29
This commit is contained in:
Mike Spreitzer
2024-01-26 13:28:06 -05:00
committed by Kubernetes Publisher
parent d1672351e4
commit 61be9f118e
2 changed files with 38 additions and 0 deletions

View File

@@ -336,6 +336,16 @@ func DeletionHandlingMetaNamespaceKeyFunc(obj interface{}) (string, error) {
return MetaNamespaceKeyFunc(obj)
}
// DeletionHandlingObjectToName checks for
// DeletedFinalStateUnknown objects before calling
// ObjectToName.
func DeletionHandlingObjectToName(obj interface{}) (ObjectName, error) {
if d, ok := obj.(DeletedFinalStateUnknown); ok {
return ParseObjectName(d.Key)
}
return ObjectToName(obj)
}
// NewInformer returns a Store and a controller for populating the store
// while also providing event notifications. You should only used the returned
// Store for Get/List operations; Add/Modify/Deletes will cause the event