Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6C0062009EE for ; Wed, 18 May 2016 15:28:56 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6A5E5160A00; Wed, 18 May 2016 13:28:56 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B1EF81609B0 for ; Wed, 18 May 2016 15:28:55 +0200 (CEST) Received: (qmail 31483 invoked by uid 500); 18 May 2016 13:28:54 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 31473 invoked by uid 99); 18 May 2016 13:28:54 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 May 2016 13:28:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BDD9ADFBED; Wed, 18 May 2016 13:28:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: camel git commit: CAMEL-9683: Kubernetes can lookup service using client, env or dns. Date: Wed, 18 May 2016 13:28:54 +0000 (UTC) archived-at: Wed, 18 May 2016 13:28:56 -0000 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 Authored: Wed May 18 15:28:45 2016 +0200 Committer: Claus Ibsen 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 getUpdatedListOfServers() { LOG.debug("Discovering endpoints from namespace: {} with name: {}", namespace, name); Endpoints endpoints = client.endpoints().inNamespace(namespace).withName(name).get(); - List result = new ArrayList(); + List 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);