Skip to content

Commit 1812851

Browse files
committed
wip
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent 3b99f78 commit 1812851

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/support/PrimaryResourceCache.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ public PrimaryResourceCache(BiPredicate<Pair<P>, P> evictionPredicate) {
1515
this.evictionPredicate = evictionPredicate;
1616
}
1717

18+
public PrimaryResourceCache() {
19+
this(new ResourceVersionParsingEvictionPredicate<>());
20+
}
21+
1822
public void cacheResource(P afterUpdate) {
1923
var resourceId = ResourceID.fromResource(afterUpdate);
2024
cache.put(resourceId, new Pair<>(null, afterUpdate));
@@ -49,6 +53,7 @@ public void cleanup(P resource) {
4953

5054
public record Pair<T extends HasMetadata>(T beforeUpdate, T afterUpdate) {}
5155

56+
/** This works in general, but it does not strictly follow the contract with k8s API */
5257
public static class ResourceVersionParsingEvictionPredicate<T extends HasMetadata>
5358
implements BiPredicate<Pair<T>, T> {
5459
@Override

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuscache/PeriodicTriggerEventSource.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ public void start() throws OperatorException {
4343
public void run() {
4444
primaryCache
4545
.list()
46-
.forEach(
47-
r -> {
48-
getEventHandler().handleEvent(new Event(ResourceID.fromResource(r)));
49-
});
46+
.forEach(r -> getEventHandler().handleEvent(new Event(ResourceID.fromResource(r))));
5047
}
5148
},
5249
0,

0 commit comments

Comments
 (0)