camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: CAMEL-9683: Kubernetes can lookup service using client, env or dns.
Date Wed, 18 May 2016 13:28:54 GMT
Repository: camel
Updated Branches:
  refs/heads/kube-lb b3e148a8f -> d373056f7


CAMEL-9683: Kubernetes can lookup service using client,env or dns.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d373056f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d373056f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d373056f

Branch: refs/heads/kube-lb
Commit: d373056f7c2e74f88d0f5ba985395481235de738
Parents: b3e148a
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed May 18 15:28:45 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed May 18 15:28:45 2016 +0200

----------------------------------------------------------------------
 .../processor/KubernetesClientServiceCallProcessor.java      | 8 +++-----
 .../processor/KubernetesServiceCallServerListStrategy.java   | 8 ++++----
 2 files changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d373056f/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesClientServiceCallProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesClientServiceCallProcessor.java
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesClientServiceCallProcessor.java
index 373f60e..afe2bfd 100644
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesClientServiceCallProcessor.java
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesClientServiceCallProcessor.java
@@ -19,10 +19,9 @@ package org.apache.camel.component.kubernetes.processor;
 import java.util.Collection;
 import java.util.concurrent.RejectedExecutionException;
 
+import io.fabric8.kubernetes.client.AutoAdaptableKubernetesClient;
 import io.fabric8.kubernetes.client.Config;
 import io.fabric8.kubernetes.client.ConfigBuilder;
-import io.fabric8.openshift.client.DefaultOpenShiftClient;
-import io.fabric8.openshift.client.OpenShiftClient;
 import org.apache.camel.AsyncCallback;
 import org.apache.camel.AsyncProcessor;
 import org.apache.camel.CamelContext;
@@ -196,8 +195,7 @@ public class KubernetesClientServiceCallProcessor extends ServiceSupport
impleme
         ServiceHelper.stopServices(processor, serverListStrategy);
     }
 
-    private OpenShiftClient createKubernetesClient() {
-        // TODO: need to use OpenShiftClient until fabric8-client can auto detect OS vs Kube
environment
+    private AutoAdaptableKubernetesClient createKubernetesClient() {
         LOG.debug("Create Kubernetes client with the following Configuration: " + configuration.toString());
 
         ConfigBuilder builder = new ConfigBuilder();
@@ -242,7 +240,7 @@ public class KubernetesClientServiceCallProcessor extends ServiceSupport
impleme
         }
 
         Config conf = builder.build();
-        return new DefaultOpenShiftClient(conf);
+        return new AutoAdaptableKubernetesClient(conf);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/d373056f/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallServerListStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallServerListStrategy.java
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallServerListStrategy.java
index 94fdc43..f35cfed 100644
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallServerListStrategy.java
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallServerListStrategy.java
@@ -25,7 +25,7 @@ import io.fabric8.kubernetes.api.model.EndpointAddress;
 import io.fabric8.kubernetes.api.model.EndpointPort;
 import io.fabric8.kubernetes.api.model.EndpointSubset;
 import io.fabric8.kubernetes.api.model.Endpoints;
-import io.fabric8.openshift.client.OpenShiftClient;
+import io.fabric8.kubernetes.client.AutoAdaptableKubernetesClient;
 import org.apache.camel.spi.ServiceCallServerListStrategy;
 import org.apache.camel.support.ServiceSupport;
 import org.apache.camel.util.IOHelper;
@@ -44,9 +44,9 @@ public class KubernetesServiceCallServerListStrategy extends ServiceSupport
impl
     private String name;
     private String namespace;
     private String portName;
-    private OpenShiftClient client;
+    private AutoAdaptableKubernetesClient client;
 
-    public KubernetesServiceCallServerListStrategy(String name, String namespace, String
portName, OpenShiftClient client) {
+    public KubernetesServiceCallServerListStrategy(String name, String namespace, String
portName, AutoAdaptableKubernetesClient client) {
         this.name = name;
         this.namespace = namespace;
         this.portName = portName;
@@ -62,7 +62,7 @@ public class KubernetesServiceCallServerListStrategy extends ServiceSupport
impl
     public Collection<KubernetesServer> getUpdatedListOfServers() {
         LOG.debug("Discovering endpoints from namespace: {} with name: {}", namespace, name);
         Endpoints endpoints = client.endpoints().inNamespace(namespace).withName(name).get();
-        List<KubernetesServer> result = new ArrayList<KubernetesServer>();
+        List<KubernetesServer> result = new ArrayList<>();
         if (endpoints != null) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Found {} endpoints in namespace: {} for name: {} and portName:
{}", endpoints.getSubsets().size(), namespace, name, portName);


Mime
View raw message