Make the Outdated phase revision-aware (#4644)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Nikola Jokic
2026-09-14 14:20:33 +02:00
committed by GitHub
co-authored by Copilot App
parent 03328aa14f
commit 6e4d85f28f
15 changed files with 1248 additions and 37 deletions
+14
View File
@@ -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
}