mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 14:11:14 +00:00
Use meta.Interface and meta.Accessor
This commit is contained in:
@@ -36,7 +36,7 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
|
||||
if obj == nil {
|
||||
return nil, ErrNilObject
|
||||
}
|
||||
accessor, err := meta.FindAccessor(obj)
|
||||
meta, err := meta.Accessor(obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -44,16 +44,16 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
version := versionFromSelfLink.FindStringSubmatch(accessor.SelfLink())
|
||||
version := versionFromSelfLink.FindStringSubmatch(meta.SelfLink())
|
||||
if len(version) < 2 {
|
||||
return nil, fmt.Errorf("unexpected self link format: %v", accessor.SelfLink())
|
||||
return nil, fmt.Errorf("unexpected self link format: %v", meta.SelfLink())
|
||||
}
|
||||
return &ObjectReference{
|
||||
Kind: kind,
|
||||
APIVersion: version[1],
|
||||
// TODO: correct Name and UID when TypeMeta makes a distinction
|
||||
Name: accessor.Name(),
|
||||
UID: accessor.UID(),
|
||||
ResourceVersion: accessor.ResourceVersion(),
|
||||
Name: meta.Name(),
|
||||
UID: meta.UID(),
|
||||
ResourceVersion: meta.ResourceVersion(),
|
||||
}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user