Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Use existing tools to parse APIVersion
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Andrews <[email protected]>
  • Loading branch information
scothis committed Jun 22, 2023
1 parent a3a7be2 commit 6b84876
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions tracker/enqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,10 @@ func (i *impl) TrackObject(ref client.Object, obj client.Object) error {
return err
}

apiGroup := ""
if l := strings.Index(or.APIVersion, "/"); l >= 0 { // is not a core resource
apiGroup = or.APIVersion[:l]
}

gvk := schema.FromAPIVersionAndKind(or.APIVersion, or.Kind)
return i.TrackReference(Reference{
APIGroup: apiGroup,
Kind: or.Kind,
APIGroup: gvk.Group,
Kind: gvk.Kind,
Namespace: or.Namespace,
Name: or.Name,
}, obj)
Expand Down

0 comments on commit 6b84876

Please sign in to comment.