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.
Some documentation to explain what this does and why it's useful would be helpful for users.
|
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.
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.
makes sense, changed, pls check if this looks to you
shawkins
left a comment
There was a problem hiding this comment.
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 <csviri@gmail.com>
* 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 <csviri@gmail.com>
* 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 <csviri@gmail.com>
Signed-off-by: csviri <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com>
Signed-off-by: csviri <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com>
Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com> Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
* 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 <csviri@gmail.com> Signed-off-by: csviri <csviri@gmail.com> Signed-off-by: Attila Mészáros <csviri@gmail.com>
No description provided.