Skip to content

Commit

Permalink
fix v2
Browse files Browse the repository at this point in the history
Signed-off-by: David Kornel <[email protected]>
  • Loading branch information
kornys committed May 3, 2024
1 parent 6acc0ad commit cad585d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ public static void deployOperator() {
.endSpec()
.build();

KubeResourceManager.getInstance().createResourceWithWait(subscription);
if (KubeResourceManager.getKubeClient().getOpenShiftClient().operatorHub().subscriptions().inNamespace(TestConstants.OPENSHIFT_OPERATORS_NS).withName(SUBSCRIPTION_NAME).get() == null) {
KubeResourceManager.getInstance().createResourceWithWait(subscription);
} else {
KubeResourceManager.getInstance().updateResource(subscription);
}
KubeResourceManager.getInstance().pushToStack(new ResourceItem<>(() -> deleteOperator(subscription), null));
isOperatorReady();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ public static void deployOperator() {
.endSpec()
.build();

KubeResourceManager.getInstance().createResourceWithWait(subscription);
if (KubeResourceManager.getKubeClient().getOpenShiftClient().operatorHub().subscriptions().inNamespace(TestConstants.OPENSHIFT_OPERATORS_NS).withName(SUBSCRIPTION_NAME).get() == null) {
KubeResourceManager.getInstance().createResourceWithWait(subscription);
} else {
KubeResourceManager.getInstance().updateResource(subscription);
}
KubeResourceManager.getInstance().pushToStack(new ResourceItem<>(() -> deleteOperator(subscription), null));
isOperatorReady();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public static void deployOperator() {
.withLabels(Collections.singletonMap(OdhAnnotationsLabels.APP_LABEL_KEY, OdhAnnotationsLabels.APP_LABEL_VALUE))
.endMetadata()
.build();
KubeResourceManager.getInstance().createResourceWithoutWait(ns);
if (!KubeResourceManager.getKubeClient().namespaceExists(OPERATOR_NAMESPACE)) {
KubeResourceManager.getInstance().createResourceWithoutWait(ns);
}
//Create operator group for the operator
if (KubeResourceManager.getKubeClient().getOpenShiftClient().operatorHub().operatorGroups()
.inNamespace(OPERATOR_NAMESPACE).list().getItems().isEmpty()) {
Expand Down Expand Up @@ -67,7 +69,11 @@ public static void deployOperator() {
.endSpec()
.build();

KubeResourceManager.getInstance().createResourceWithWait(subscription);
if (KubeResourceManager.getKubeClient().getOpenShiftClient().operatorHub().subscriptions().inNamespace(OPERATOR_NAMESPACE).withName(SUBSCRIPTION_NAME).get() == null) {
KubeResourceManager.getInstance().createResourceWithWait(subscription);
} else {
KubeResourceManager.getInstance().updateResource(subscription);
}
KubeResourceManager.getInstance().pushToStack(new ResourceItem<>(() -> deleteOperator(ns), null));
isOperatorReady();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public static void deployOperator() {
.endSpec()
.build();

KubeResourceManager.getInstance().createResourceWithWait(subscription);
if (KubeResourceManager.getKubeClient().getOpenShiftClient().operatorHub().subscriptions().inNamespace(TestConstants.OPENSHIFT_OPERATORS_NS).withName(SUBSCRIPTION_NAME).get() == null) {
KubeResourceManager.getInstance().createResourceWithWait(subscription);
} else {
KubeResourceManager.getInstance().updateResource(subscription);
}
KubeResourceManager.getInstance().pushToStack(new ResourceItem<>(() -> deleteOperator(subscription), null));
isOperatorReady();
}
Expand Down

0 comments on commit cad585d

Please sign in to comment.