-
Notifications
You must be signed in to change notification settings - Fork 218
discriminator improvements #2013
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
Conversation
cf11b91
to
04ef9d7
Compare
import io.fabric8.kubernetes.api.model.HasMetadata; | ||
import io.javaoperatorsdk.operator.processing.event.source.informer.InformerEventSource; | ||
|
||
public class IndexDiscriminator<R extends HasMetadata, P extends HasMetadata> |
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.
Some documentation to explain what this does and why it's useful would be helpful for users.
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
LGTM otherwise. |
cc @shawkins |
With simple usage we'll have something like:
Then
Creating a constant for the event source name will help, but it looks like we've spread some knowledge in two places. Can we instead do:
Or are methods like useEventSourceWithName not to be tampered with? |
Wasn't really tested that way. TBH I don't like that much this annotation style definitions, basically because of these inflexibilities. But it is how it is, we can think to change appraoches for v5. |
return context.getSecondaryResourcesAsStream(resource) | ||
.filter(resourceID::isSameResource) | ||
.findFirst(); | ||
if (eventSourceName != null) { |
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 keycloak case there is only a single Service event source, so eventSourceName doesn't seem required in all cases. Could it test for, or catch the exception, if there are multiple sources for the given type before resorting to the list?
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.
makes sense, changed, pls check if this looks to you
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.
LGTM, this latest change helps side step the issue of passing around the eventSourceName.
Originally tbh was thinking that since discriminators are just used with DR with "same type", that means not with bulk resources for example, there will be always a very small amount of them, but it's still true that it's better not loop though of those. |
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]>
Signed-off-by: csviri <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]>
Signed-off-by: csviri <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]>
Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (operator-framework#2001) * feat: leader election callbacks (operator-framework#2015) * discriminator improvements (operator-framework#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]> Signed-off-by: Steve Hawkins <[email protected]>
Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
* feat: create resource only if not exists (#2001) * feat: leader election callbacks (#2015) * discriminator improvements (#2013) * generalization of the update matcher * consolidating the diffs also adding a test that removes a field not present in the desired --------- Co-authored-by: Attila Mészáros <[email protected]> Signed-off-by: csviri <[email protected]> Signed-off-by: Attila Mészáros <[email protected]>
No description provided.