Skip to content

Commit e7e00cb

Browse files
committed
feat: add void secondary to primary
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 9a19dcb commit e7e00cb

File tree

1 file changed

+11
-0
lines changed
  • operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer

1 file changed

+11
-0
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/Mappers.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,15 @@ public Set<ResourceID> toPrimaryResourceIDs(HasMetadata resource) {
176176
return Mappers.fromDefaultAnnotations(primaryResourceType).toPrimaryResourceIDs(resource);
177177
}
178178
}
179+
180+
/**
181+
* The purpose of this mapper is to cover the cover case, when you don't want to be notified about
182+
* changes of a resource. For example, it is read-only, and not expected to be changed. Note that
183+
* having this you won't be able to access the resource through {@link
184+
* io.javaoperatorsdk.operator.api.reconciler.Context#getSecondaryResources(Class)} only directly
185+
* from event source like by {@link InformerEventSource#get(ResourceID)}.
186+
*/
187+
public static <T> SecondaryToPrimaryMapper<T> voidSecondaryToPrimaryMapper() {
188+
return resource -> Set.of();
189+
}
179190
}

0 commit comments

Comments
 (0)