diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/Mappers.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/Mappers.java index 7ed46a97f3..140d501e09 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/Mappers.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/Mappers.java @@ -176,4 +176,16 @@ public Set toPrimaryResourceIDs(HasMetadata resource) { return Mappers.fromDefaultAnnotations(primaryResourceType).toPrimaryResourceIDs(resource); } } + + /** + * The purpose of this mapper is to cover the cover case, when you don't want to be notified about + * changes of a resource. For example, it is read-only, and not expected to be changed. Note that + * having this you won't be able to access the resource through {@link + * io.javaoperatorsdk.operator.api.reconciler.Context#getSecondaryResources(Class)} only directly + * from event source like by {@link InformerEventSource#get(ResourceID)}. Use this with caution + * since usually this is not something that you require from an event source. + */ + public static SecondaryToPrimaryMapper voidSecondaryToPrimaryMapper() { + return resource -> Set.of(); + } }