| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
This PR updates owner-reference-based secondary-to-primary mapping so events still propagate when the owner reference points to an older version of the same API group (e.g., apps/v1beta1 vs apps/v1), by matching on group instead of full apiVersion.
Changes:
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/Mappers.java | Relaxes owner-reference matching from exact apiVersion to API group comparison. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/ReconcilerUtilsInternal.java | Introduces getGroup helper for parsing API group from apiVersion. |
| operator-framework-core/src/test/java/io/javaoperatorsdk/operator/ReconcilerUtilsInternalTest.java | Adds coverage for getGroup parsing behavior. |
Sorry, something went wrong.
| public static <T extends HasMetadata> SecondaryToPrimaryMapper<T> fromOwnerReferences( | ||
| String apiVersion, String kind, boolean clusterScope) { | ||
| String correctApiVersion = apiVersion.startsWith("/") ? apiVersion.substring(1) : apiVersion; | ||
| return resource -> | ||
| resource.getMetadata().getOwnerReferences().stream() | ||
| .filter(r -> r.getKind().equals(kind) && r.getApiVersion().equals(correctApiVersion)) | ||
| .filter( | ||
| r -> | ||
| r.getKind().equals(kind) | ||
| && getGroup(r.getApiVersion()).equals(getGroup(apiVersion))) | ||
| .map(or -> ResourceID.fromOwnerReference(resource, or, clusterScope)) | ||
| .collect(Collectors.toSet()); |
There was a problem hiding this comment.
This change intentionally relaxes ownerReference matching from full apiVersion to just group. Please add a focused unit test in the existing MappersTest that demonstrates the new behavior (same group + kind but different versions should still map), so future refactors don’t accidentally revert to strict apiVersion matching.
Sorry, something went wrong.
|
see also: keycloak/keycloak#48030 (comment) |
Sorry, something went wrong.
In case of a resource is has a new version, but owner reference still points to the old version we should still propapage the event. Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
| .filter( | ||
| r -> | ||
| r.getKind().equals(kind) | ||
| && getGroup(r.getApiVersion()).equals(getGroup(apiVersion))) |
There was a problem hiding this comment.
I'm not sure this is the correct behavior: shouldn't there be a conversion hook instead? It seems dangerous to potentially match resources with differing versions…
Sorry, something went wrong.
There was a problem hiding this comment.
Conversion hooks, does not update the owner references of the resource. Maybe we should have an integration test also this, to see how exactly and what happens. I will add one.
Sorry, something went wrong.
|
Maybe would be more pc to target next with this PR. |
Sorry, something went wrong.
There was a problem hiding this comment.
I don't have anything else to add to what was already mentioned.
Sorry, something went wrong.
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Chris Laprun <metacosm@gmail.com>
|
Thank you everyone. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
In case of a resource is has a new version, but owner reference
still points to the old version we should still propapage the event.
Signed-off-by: Attila Mészáros a_meszaros@apple.com