mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-05 00:51:02 +00:00
Add DeletionHandlingObjectToName
Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com> Kubernetes-commit: d60a25b2db52d7e180b0962e23cc06e71f36fb29
This commit is contained in:
committed by
Kubernetes Publisher
parent
d1672351e4
commit
61be9f118e
10
tools/cache/controller.go
vendored
10
tools/cache/controller.go
vendored
@@ -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
|
||||
|
Reference in New Issue
Block a user