Skip to content

Commit fd32421

Browse files
authored
improve: make sure there is no infinite recursion by default for external service (#2130)
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 94e68d1 commit fd32421

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ protected ReconcileResult<R> reconcile(P primary, R actualResource, Context<P> c
8585
return ReconcileResult.noOperation(actualResource);
8686
}
8787

88-
public Result<R> match(R resource, P primary, Context<P> context) {
89-
return updater.match(resource, primary, context);
90-
}
88+
public abstract Result<R> match(R resource, P primary, Context<P> context);
9189

9290
@Override
9391
public Optional<R> getSecondaryResource(P primary, Context<P> context) {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ protected void handleExplicitStateCreation(P primary, R created, Context<P> cont
7676
}
7777
}
7878

79+
@Override
80+
public Matcher.Result<R> match(R resource, P primary, Context<P> context) {
81+
var desired = desired(primary, context);
82+
return Matcher.Result.computed(resource.equals(desired), desired);
83+
}
7984

8085
@SuppressWarnings("unchecked")
8186
public void deleteTargetResource(P primary, R resource, String key,

0 commit comments

Comments
 (0)