mirror of
https://github.com/actions-runner-controller/actions-runner-controller.git
synced 2026-10-04 19:29:08 +02:00
Make the Outdated phase revision-aware (#4644)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot App
parent
03328aa14f
commit
6e4d85f28f
@@ -69,3 +69,17 @@ func newGroupVersionOwnerKindIndexer(ownerKind string, otherOwnerKinds ...string
|
||||
return []string{owner.Name}
|
||||
}
|
||||
}
|
||||
|
||||
// isControlledBy applies the same ownership test as the resourceOwnerKey index,
|
||||
// for callers that cannot use that index. It is registered on the manager's
|
||||
// cache, so a read that deliberately bypasses the cache has to filter here
|
||||
// instead: the API server rejects .metadata.controller as an unsupported field
|
||||
// label. Keeping the predicate alongside the indexer is what stops the two
|
||||
// drifting apart.
|
||||
func isControlledBy(o client.Object, ownerKind, ownerName string) bool {
|
||||
owner := metav1.GetControllerOfNoCopy(o)
|
||||
return owner != nil &&
|
||||
owner.APIVersion == v1alpha1.GroupVersion.String() &&
|
||||
owner.Kind == ownerKind &&
|
||||
owner.Name == ownerName
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user