use of org.bf2.systemtest.framework.resource.ManagedKafkaResourceType in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class ManagedKafkaResourceType method readiness.
@Override
public Predicate<ManagedKafka> readiness(KubeClient client) {
AtomicInteger count = new AtomicInteger();
Set<String> messages = Collections.synchronizedSet(new LinkedHashSet<>());
return mk -> {
if (mk == null) {
throw new IllegalStateException("ManagedKafka is null");
}
ManagedKafkaCondition mkc = getCondition(mk.getStatus(), ManagedKafkaCondition.Type.Ready).orElse(null);
if (mkc == null) {
return false;
}
if (ManagedKafkaCondition.Status.True.name().equals(mkc.getStatus())) {
return true;
}
if (ManagedKafkaCondition.Reason.Error.name().equals(mkc.getReason())) {
if (messages.add(mkc.getMessage())) {
LOGGER.warn("ManagedKafka {} in error state {}", mk.getMetadata().getName(), mkc.getMessage());
}
// throw new IllegalStateException(String.format("ManagedKafka %s in error state %s", mk.getMetadata().getName(), mkc.getMessage()));
}
if (count.getAndIncrement() % 15 == 0) {
ListOptions opts = new ListOptionsBuilder().withFieldSelector("status.phase=Pending").build();
client.client().pods().inNamespace(mk.getMetadata().getNamespace()).withLabel("strimzi.io/cluster").list(opts).getItems().forEach(ManagedKafkaResourceType::checkUnschedulablePod);
}
return false;
};
}
use of org.bf2.systemtest.framework.resource.ManagedKafkaResourceType in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class ManagedKafkaDeployment method start.
public void start() {
ManagedKafkaResourceType type = new ManagedKafkaResourceType();
Resource<ManagedKafka> resource = type.resource(cluster.kubeClient(), managedKafka);
Predicate<ManagedKafka> readyCheck = type.readiness(cluster.kubeClient());
readyFuture = TestUtils.asyncWaitFor("cluster ready", 1000, 600_000, () -> readyCheck.test(resource.get()));
}
Aggregations