Skip to content

Commit 0443140

Browse files
metacosmcsviri
authored andcommitted
docs: add implementation details
1 parent 638709c commit 0443140

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/Matcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public Optional<T> computedDesired() {
9292
* @return a {@link Result} encapsulating whether the resource matched its desired state and this
9393
* associated state if it was computed as part of the matching process. Use the static
9494
* convenience methods ({@link Result#nonComputed(boolean)} and
95-
* {@link Result#computed(boolean, Object)})
95+
* {@link Result#computed(boolean, Object)}) to create your return {@link Result}.
9696
*/
9797
Result<R> match(R actualResource, P primary, Context<P> context);
9898
}

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/GenericKubernetesResourceMatcher.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ static <R extends HasMetadata, P extends HasMetadata> Matcher<R, P> matcherFor(
3232
return new GenericKubernetesResourceMatcher(dependentResource);
3333
}
3434

35+
/**
36+
* {@inheritDoc}
37+
* <p/>
38+
* This implementation attempts to cover most common cases out of the box by considering
39+
* non-additive changes to metadata and to the resource's spec (if the resource in question has a
40+
* {@code spec} field), making special provisions for {@link ConfigMap} and {@link Secret}
41+
* resources. Additive changes (i.e. a field is added that previously didn't exist) are not
42+
* considered as triggering a mismatch by default to account for validating webhooks that might
43+
* add default values automatically when not present or some other controller adding labels and/or
44+
* annotations.
45+
* <p/>
46+
* It should be noted that this implementation is potentially intensive because it generically
47+
* attempts to cover common use cases by performing diffs on the JSON representation of objects.
48+
* If performance is a concern, it might be easier / simpler to provide a {@link Matcher}
49+
* implementation optimized for your use case.
50+
*/
3551
@Override
3652
public Result<R> match(R actualResource, P primary, Context<P> context) {
3753
var desired = dependentResource.desired(primary, context);

0 commit comments

Comments
 (0)