This is an automated email from the ASF dual-hosted git repository.

marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git

commit f868037222f45149a4f786c56ca76a030a1f3e59
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Tue May 21 18:13:41 2024 -0400

    Fix #1288
---
 karavan-app/pom.xml                                |  4 ---
 .../camel/karavan/api/InfrastructureResource.java  |  7 -----
 .../karavan/kubernetes/KubernetesService.java      | 32 +++-------------------
 karavan-app/src/main/webui/package-lock.json       |  2 +-
 4 files changed, 5 insertions(+), 40 deletions(-)

diff --git a/karavan-app/pom.xml b/karavan-app/pom.xml
index e7b62741..c99407d3 100644
--- a/karavan-app/pom.xml
+++ b/karavan-app/pom.xml
@@ -108,10 +108,6 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-compress</artifactId>
         </dependency>
-        <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-openshift-client</artifactId>
-        </dependency>
         <dependency>
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-minikube</artifactId>
diff --git 
a/karavan-app/src/main/java/org/apache/camel/karavan/api/InfrastructureResource.java
 
b/karavan-app/src/main/java/org/apache/camel/karavan/api/InfrastructureResource.java
index 255499fb..c3158ae9 100644
--- 
a/karavan-app/src/main/java/org/apache/camel/karavan/api/InfrastructureResource.java
+++ 
b/karavan-app/src/main/java/org/apache/camel/karavan/api/InfrastructureResource.java
@@ -102,13 +102,6 @@ public class InfrastructureResource {
         }
     }
 
-    @GET
-    @Produces(MediaType.APPLICATION_JSON)
-    @Path("/imagetag/{env}/{projectId}")
-    public Response getProjectImageTags(@PathParam("env") String env, 
@PathParam("projectId") String projectId) throws Exception {
-        return Response.ok(kubernetesService.getProjectImageTags(projectId, 
kubernetesService.getNamespace())).build();
-    }
-
     @GET
     @Produces(MediaType.APPLICATION_JSON)
     @Path("/configmaps")
diff --git 
a/karavan-app/src/main/java/org/apache/camel/karavan/kubernetes/KubernetesService.java
 
b/karavan-app/src/main/java/org/apache/camel/karavan/kubernetes/KubernetesService.java
index f63a9deb..a537b2c1 100644
--- 
a/karavan-app/src/main/java/org/apache/camel/karavan/kubernetes/KubernetesService.java
+++ 
b/karavan-app/src/main/java/org/apache/camel/karavan/kubernetes/KubernetesService.java
@@ -22,8 +22,6 @@ import io.fabric8.kubernetes.client.KubernetesClient;
 import io.fabric8.kubernetes.client.KubernetesClientBuilder;
 import io.fabric8.kubernetes.client.dsl.LogWatch;
 import io.fabric8.kubernetes.client.informers.SharedIndexInformer;
-import io.fabric8.openshift.api.model.ImageStream;
-import io.fabric8.openshift.client.OpenShiftClient;
 import io.quarkus.runtime.configuration.ProfileManager;
 import io.quarkus.vertx.ConsumeEvent;
 import io.smallrye.mutiny.tuples.Tuple2;
@@ -47,7 +45,6 @@ import org.jboss.logging.Logger;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Paths;
 import java.util.*;
-import java.util.stream.Collectors;
 
 import static org.apache.camel.karavan.service.KaravanService.KARAVAN_STARTED;
 import static org.apache.camel.karavan.shared.Constants.*;
@@ -76,11 +73,6 @@ public class KubernetesService implements HealthCheck {
         return new KubernetesClientBuilder().build();
     }
 
-    @Produces
-    public OpenShiftClient openshiftClient() {
-        return kubernetesClient().adapt(OpenShiftClient.class);
-    }
-
     @ConfigProperty(name = "karavan.environment")
     public String environment;
 
@@ -102,6 +94,9 @@ public class KubernetesService implements HealthCheck {
     @ConfigProperty(name = "karavan.private-key-path")
     Optional<String> privateKeyPath;
 
+    @ConfigProperty(name = "karavan.openshift")
+    Optional<Boolean> isOpenShift;
+
     List<SharedIndexInformer> informers = new ArrayList<>(INFORMERS);
 
     public void startInformers(String data) {
@@ -407,23 +402,6 @@ public class KubernetesService implements HealthCheck {
         return result;
     }
 
-    public List<String> getProjectImageTags(String projectId, String 
namespace) {
-        List<String> result = new ArrayList<>();
-        try {
-            if (isOpenshift()) {
-                ImageStream is = 
openshiftClient().imageStreams().inNamespace(namespace).withName(projectId).get();
-                if (is != null) {
-                    result.addAll(is.getSpec().getTags().stream().map(t -> 
t.getName()).sorted(Comparator.reverseOrder()).collect(Collectors.toList()));
-                }
-            } else {
-                // TODO: Implement for Kubernetes/Minikube
-            }
-        } catch (Exception ex) {
-            LOGGER.error(ex.getMessage());
-        }
-        return result;
-    }
-
     public void runDevModeContainer(Project project, String jBangOptions, 
Map<String, String> files) {
         String name = project.getProjectId();
         Map<String, String> labels = getLabels(name, project, 
ContainerStatus.ContainerType.devmode);
@@ -589,9 +567,7 @@ public class KubernetesService implements HealthCheck {
     }
 
     public boolean isOpenshift() {
-        try (KubernetesClient client = kubernetesClient()) {
-            return ConfigService.inKubernetes() ? 
client.isAdaptable(OpenShiftClient.class) : false;
-        }
+        return isOpenShift.isPresent() && isOpenShift.get();
     }
 
     public String getCluster() {
diff --git a/karavan-app/src/main/webui/package-lock.json 
b/karavan-app/src/main/webui/package-lock.json
index f3424476..90e575c9 100644
--- a/karavan-app/src/main/webui/package-lock.json
+++ b/karavan-app/src/main/webui/package-lock.json
@@ -74,7 +74,7 @@
       }
     },
     "../../../../karavan-core": {
-      "version": "4.6.0",
+      "version": "4.7.0",
       "license": "Apache-2.0",
       "dependencies": {
         "@types/js-yaml": "^4.0.7",

Reply via email to