use of io.fabric8.openshift.api.model.operatorhub.v1alpha1.SubscriptionCatalogHealth in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class OlmBasedStrimziOperatorManager method isSubscriptionInstalled.
private boolean isSubscriptionInstalled() {
OpenShiftClient client = kubeClient.client().adapt(OpenShiftClient.class);
Subscription s = client.operatorHub().subscriptions().inNamespace(namespace).withName(OLM_SUBSCRIPTION_NAME).get();
if (s != null && s.getStatus() != null && !s.getStatus().getCatalogHealth().isEmpty()) {
List<SubscriptionCatalogHealth> healths = s.getStatus().getCatalogHealth();
boolean result = !healths.stream().filter(h -> h.getHealthy()).map(ref -> ref.getCatalogSourceRef()).filter(h -> h.getName().equals(CATALOG_SOURCE_NAME)).collect(Collectors.toList()).isEmpty();
if (result) {
String currentCsv = s.getStatus().getCurrentCSV();
if (currentCsv == null) {
return false;
}
ClusterServiceVersion csv = client.operatorHub().clusterServiceVersions().inNamespace(namespace).withName(currentCsv).get();
if (csv == null) {
return false;
}
versions = csv.getSpec().getInstall().getSpec().getDeployments().stream().map(sds -> sds.getName()).filter(version -> version.startsWith("strimzi-cluster-operator.")).collect(Collectors.toList());
}
return result;
}
return false;
}
Aggregations