Skip to content

Commit 42a4e17

Browse files
committed
evaulation fix
1 parent 3777892 commit 42a4e17

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.concurrent.Future;
1010
import java.util.stream.Collectors;
1111

12+
import io.javaoperatorsdk.operator.processing.dependent.BulkDependentResource;
1213
import org.slf4j.Logger;
1314

1415
import io.fabric8.kubernetes.api.model.HasMetadata;
@@ -101,9 +102,12 @@ protected synchronized void handleNodeExecutionFinish(
101102

102103
protected <R> boolean isConditionMet(Optional<Condition<R, P>> condition,
103104
DependentResource<R, P> dependentResource) {
105+
var resources = dependentResource instanceof BulkDependentResource ? ((BulkDependentResource)
106+
dependentResource).getSecondaryResources(primary,context) :
107+
dependentResource.getSecondaryResource(primary, context).orElse(null);
108+
104109
return condition.map(c -> c.isMet(primary,
105-
dependentResource.getSecondaryResource(primary, context).orElse(null),
106-
context))
110+
(R) resources, context))
107111
.orElse(true);
108112
}
109113
}

operator-framework/src/test/java/io/javaoperatorsdk/operator/sample/bulkdependent/SamplePrecondition.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
import io.javaoperatorsdk.operator.api.reconciler.Context;
55
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition;
66

7-
public class SamplePrecondition implements Condition<ConfigMap, BulkDependentTestCustomResource> {
7+
import java.util.Map;
8+
9+
public class SamplePrecondition implements Condition<Map<String,ConfigMap>, BulkDependentTestCustomResource> {
810

911
public static final String SKIP_RESOURCE_DATA = "skipThis";
1012

1113
@Override
12-
public boolean isMet(BulkDependentTestCustomResource primary, ConfigMap secondary,
13-
Context<BulkDependentTestCustomResource> context) {
14+
public boolean isMet(BulkDependentTestCustomResource primary, Map<String, ConfigMap> secondary,
15+
Context<BulkDependentTestCustomResource> context) {
1416
return !SKIP_RESOURCE_DATA.equals(primary.getSpec().getAdditionalData());
1517
}
1618
}

0 commit comments

Comments
 (0)