Skip to content

Commit 828c245

Browse files
committed
sample fix
1 parent 9b6259b commit 828c245

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
package io.javaoperatorsdk.operator.sample.bulkdependent;
22

3-
import java.util.Map;
4-
53
import io.fabric8.kubernetes.api.model.ConfigMap;
64
import io.javaoperatorsdk.operator.api.reconciler.Context;
5+
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
76
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition;
87

98
public class SampleBulkCondition
10-
implements Condition<Map<String, ConfigMap>, BulkDependentTestCustomResource> {
9+
implements Condition<ConfigMap, BulkDependentTestCustomResource> {
1110

1211
// We use ConfigMaps here just to show how to check some properties of resources managed by a
1312
// BulkDependentResource. In real life example this would be rather based on some status of those
1413
// resources, like Pods.
1514

1615
@Override
17-
public boolean isMet(BulkDependentTestCustomResource primary, Map<String, ConfigMap> secondary,
16+
public boolean isMet(
17+
DependentResource<ConfigMap, BulkDependentTestCustomResource> dependentResource,
18+
BulkDependentTestCustomResource primary,
1819
Context<BulkDependentTestCustomResource> context) {
1920

20-
return secondary.values().stream().allMatch(cm -> !cm.getData().isEmpty());
21-
21+
var resources = ((CRUDConfigMapBulkDependentResource) dependentResource)
22+
.getSecondaryResources(primary, context);
23+
return resources.values().stream().noneMatch(cm -> cm.getData().isEmpty());
2224
}
2325
}

0 commit comments

Comments
 (0)