-
Notifications
You must be signed in to change notification settings - Fork 235
feat: provide de-duplicated secondary resources stream on Context #3141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
...-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java
Show resolved
Hide resolved
...-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java
Outdated
Show resolved
Hide resolved
...mework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ResourceOperations.java
Outdated
Show resolved
Hide resolved
csviri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some minor comments, pls add unit tests! Otherwise looks great, thank you!!
|
|
||
| default <R> Stream<R> getSecondaryResourcesAsStream(Class<R> expectedType) { | ||
| return getSecondaryResources(expectedType).stream(); | ||
| return getSecondaryResourcesAsStream(expectedType, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we could use the former implementation and call this in case in the new method the deduplication is false.
...-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java
Show resolved
Hide resolved
...-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java
Show resolved
Hide resolved
fdfaa63 to
3c9de5c
Compare
| } | ||
| return stream | ||
| .collect( | ||
| Collectors.toUnmodifiableMap( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end, I couldn't make the implementation work without collecting to Map, I iterated over the code and ended collecting manually…
28328fb to
afa2dc8
Compare
Signed-off-by: Chris Laprun <[email protected]>
afa2dc8 to
7158917
Compare
csviri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some nits, pls make the CI happy, otherwise LGTM!
|
|
||
| /** | ||
| * Whether this ResourceID points to the same resource as the one identified by the specified name | ||
| * and namespace. Note that this doesn't take API version or Kind into account so this should only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: does not take Group either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, didn't want to get into all the details 😅
Actually planning on adding this to HasMetadata in the client.
| var updatedResource = | ||
| extension.get(LatestDistinctTestResource.class, TEST_RESOURCE_NAME); | ||
| assertThat(updatedResource.getStatus()).isNotNull(); | ||
| // Should see 3 distinct ConfigMaps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment needs ro be adjusted
Alternative to #3130, to discuss