Skip to content

Commit 71700e1

Browse files
committed
⚠️ client.ObjectKeyFromObject now uses client.Client
This change removes the need to get an accessor from the runtime object, because the object interface already has all the information needed. It also removes the need to return an error, which makes it a little easier to use. Signed-off-by: Vince Prignano <[email protected]>
1 parent 32e94b6 commit 71700e1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pkg/client/interfaces.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@ import (
3030
type ObjectKey = types.NamespacedName
3131

3232
// ObjectKeyFromObject returns the ObjectKey given a runtime.Object
33-
func ObjectKeyFromObject(obj runtime.Object) (ObjectKey, error) {
34-
accessor, err := meta.Accessor(obj)
35-
if err != nil {
36-
return ObjectKey{}, err
37-
}
38-
return ObjectKey{Namespace: accessor.GetNamespace(), Name: accessor.GetName()}, nil
33+
func ObjectKeyFromObject(obj Object) ObjectKey {
34+
return ObjectKey{Namespace: obj.GetNamespace(), Name: obj.GetName()}
3935
}
4036

4137
// Patch is a patch that can be applied to a Kubernetes object.

0 commit comments

Comments
 (0)