You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/01/11 12:04:15 UTC

[04/10] camel git commit: CAMEL-10638: Refactor ServiceCall EIP

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallRouteTest.java b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallRouteTest.java
new file mode 100644
index 0000000..2b959ea
--- /dev/null
+++ b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallRouteTest.java
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.etcd.cloud;
+
+import java.net.URI;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import mousio.etcd4j.EtcdClient;
+import org.apache.camel.component.etcd.EtcdHelper;
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringEtcdServiceCallRouteTest extends CamelSpringTestSupport {
+    private static final ObjectMapper MAPPER = EtcdHelper.createObjectMapper();
+    private static final EtcdClient CLIENT = new EtcdClient(URI.create("http://localhost:2379"));
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallRouteTest.xml");
+    }
+
+    // *************************************************************************
+    // Setup / tear down
+    // *************************************************************************
+
+    @Override
+    public void doPreSetup() throws Exception {
+        JsonNode service1 = MAPPER.createObjectNode()
+            .put("name", "http-service")
+            .put("address", "127.0.0.1")
+            .put("port", "9091");
+        JsonNode service2 = MAPPER.createObjectNode()
+            .put("name", "http-service")
+            .put("address", "127.0.0.1")
+            .put("port", "9092");
+        JsonNode service3 = MAPPER.createObjectNode()
+            .put("name", "http-service")
+            .put("address", "127.0.0.1")
+            .put("port", "9093");
+        JsonNode service4 = MAPPER.createObjectNode()
+            .put("name", "http-service")
+            .put("address", "127.0.0.1")
+            .put("port", "9094");
+
+        CLIENT.put("/etcd-services-1/" + "service-1", MAPPER.writeValueAsString(service1)).send().get();
+        CLIENT.put("/etcd-services-1/" + "service-2", MAPPER.writeValueAsString(service2)).send().get();
+        CLIENT.put("/etcd-services-2/" + "service-3", MAPPER.writeValueAsString(service3)).send().get();
+        CLIENT.put("/etcd-services-2/" + "service-4", MAPPER.writeValueAsString(service4)).send().get();
+
+        super.doPreSetup();
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+        CLIENT.deleteDir("/etcd-services-1/").recursive().send().get();
+        CLIENT.deleteDir("/etcd-services-2/").recursive().send().get();
+    }
+
+    // *************************************************************************
+    // Test
+    // *************************************************************************
+
+    @Test
+    public void testServiceCall() throws Exception {
+        getMockEndpoint("mock:result-1").expectedMessageCount(2);
+        getMockEndpoint("mock:result-1").expectedBodiesReceivedInAnyOrder("service-1 9091", "service-1 9092");
+        getMockEndpoint("mock:result-2").expectedMessageCount(2);
+        getMockEndpoint("mock:result-2").expectedBodiesReceivedInAnyOrder("service-2 9093", "service-2 9094");
+
+        template.sendBody("direct:start", "service-1");
+        template.sendBody("direct:start", "service-1");
+        template.sendBody("direct:start", "service-2");
+        template.sendBody("direct:start", "service-2");
+
+        assertMockEndpointsSatisfied();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/processor/remote/EtcdServiceCallRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/processor/remote/EtcdServiceCallRouteTest.java b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/processor/remote/EtcdServiceCallRouteTest.java
deleted file mode 100644
index 7987ec4..0000000
--- a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/processor/remote/EtcdServiceCallRouteTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.component.etcd.processor.remote;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import mousio.etcd4j.EtcdClient;
-import org.apache.camel.RoutesBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.etcd.EtcdHelper;
-import org.apache.camel.component.etcd.EtcdTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
-
-@Ignore("An etcd server is needed for this test ")
-public class EtcdServiceCallRouteTest extends EtcdTestSupport {
-    private static final ObjectMapper MAPPER = EtcdHelper.createObjectMapper();
-    private static final String SERVICE_NAME = "http-service";
-    private static final int SERVICE_COUNT = 5;
-    private static final int SERVICE_PORT_BASE = 8080;
-
-    private EtcdClient client;
-    private List<Map<String, Object>> servers;
-    private List<String> expectedBodies;
-
-    // *************************************************************************
-    // Setup / tear down
-    // *************************************************************************
-
-    @Override
-    protected void doPreSetup() throws Exception {
-        client = getClient();
-
-        servers = new ArrayList<>(SERVICE_COUNT);
-        expectedBodies = new ArrayList<>(SERVICE_COUNT);
-
-        for (int i = 0; i < SERVICE_COUNT; i++) {
-            Map<String, Object> server = new HashMap<>();
-            server.put("name", SERVICE_NAME);
-            server.put("address", "127.0.0.1");
-            server.put("port", SERVICE_PORT_BASE + i);
-
-            client.put("/services/" + "service-" + i, MAPPER.writeValueAsString(server)).send().get();
-
-            servers.add(Collections.unmodifiableMap(server));
-            expectedBodies.add("ping on " + (SERVICE_PORT_BASE + i));
-        }
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-        client.deleteDir("/services/").recursive().send().get();
-    }
-
-    // *************************************************************************
-    // Test
-    // *************************************************************************
-
-    @Test
-    public void testServiceCall() throws Exception {
-        getMockEndpoint("mock:result").expectedMessageCount(SERVICE_COUNT);
-        getMockEndpoint("mock:result").expectedBodiesReceivedInAnyOrder(expectedBodies);
-
-        servers.forEach(s -> template.sendBody("direct:start", "ping"));
-
-        assertMockEndpointsSatisfied();
-    }
-
-    // *************************************************************************
-    // Route
-    // *************************************************************************
-
-    @Override
-    protected RoutesBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start")
-                    .serviceCall()
-                        .name(SERVICE_NAME)
-                        .etcdConfiguration()
-                            .component("http")
-                            .loadBalancer("roundrobin")
-                            .serverListStrategy("ondemand")
-                        .end()
-                    .to("log:org.apache.camel.component.etcd.processor.service?level=INFO&showAll=true&multiline=true")
-                    .to("mock:result");
-
-                servers.forEach(s ->
-                    fromF("jetty:http://%s:%d", s.get("address"), s.get("port"))
-                        .transform().simple("${in.body} on " + s.get("port"))
-                );
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/processor/remote/EtcdServiceCallServerListStrategyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/processor/remote/EtcdServiceCallServerListStrategyTest.java b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/processor/remote/EtcdServiceCallServerListStrategyTest.java
deleted file mode 100644
index 837f057..0000000
--- a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/processor/remote/EtcdServiceCallServerListStrategyTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.etcd.processor.remote;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import mousio.etcd4j.EtcdClient;
-import mousio.etcd4j.responses.EtcdException;
-import org.apache.camel.component.etcd.EtcdConfiguration;
-import org.apache.camel.component.etcd.EtcdHelper;
-import org.apache.camel.component.etcd.EtcdTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
-
-@Ignore("An etcd server is needed for this test ")
-public class EtcdServiceCallServerListStrategyTest extends EtcdTestSupport {
-    private static final ObjectMapper MAPPER = EtcdHelper.createObjectMapper();
-    private static final EtcdConfiguration CONFIGURATION = new EtcdConfiguration(null);
-    private static final AtomicInteger PORT = new AtomicInteger(0);
-
-    private EtcdClient client;
-
-    @Override
-    public void doPreSetup() throws Exception {
-        client = getClient();
-        try {
-            client.deleteDir(CONFIGURATION.getServicePath()).recursive().send().get();
-        } catch (EtcdException e) {
-            // Ignore
-        }
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        try {
-            client.deleteDir(CONFIGURATION.getServicePath()).recursive().send().get();
-            client.close();
-            client = null;
-        } catch (EtcdException e) {
-            // Ignore
-        }
-    }
-
-    @Test
-    public void testOnDemandStrategy() throws Exception {
-        for (int i = 0; i < 3; i++) {
-            addServer(client, "serviceType-1");
-        }
-        for (int i = 0; i < 2; i++) {
-            addServer(client, "serviceType-2");
-        }
-
-        EtcdServiceCallServerListStrategy strategy = EtcdServiceCallServerListStrategies.onDemand(CONFIGURATION);
-        strategy.start();
-
-        List<EtcdServiceCallServer> type1 = strategy.getUpdatedListOfServers("serviceType-1");
-        assertEquals(3, type1.size());
-        for (EtcdServiceCallServer server : type1) {
-            assertNotNull(server.getMetadata());
-            assertTrue(server.getMetadata().containsKey("service_name"));
-            assertTrue(server.getMetadata().containsKey("port_delta"));
-        }
-
-        List<EtcdServiceCallServer> type2 = strategy.getUpdatedListOfServers("serviceType-2");
-        assertEquals(2, type2.size());
-        for (EtcdServiceCallServer server : type2) {
-            assertNotNull(server.getMetadata());
-            assertTrue(server.getMetadata().containsKey("service_name"));
-            assertTrue(server.getMetadata().containsKey("port_delta"));
-        }
-
-        strategy.stop();
-    }
-
-    @Test
-    public void testWatchStrategy() throws Exception {
-        addServer(client, "serviceType-3");
-
-        EtcdServiceCallServerListStrategy strategy = EtcdServiceCallServerListStrategies.watch(CONFIGURATION);
-        strategy.start();
-
-        assertEquals(1, strategy.getUpdatedListOfServers("serviceType-3").size());
-
-        addServer(client, "serviceType-3");
-        addServer(client, "serviceType-3");
-        addServer(client, "serviceType-4");
-
-        Thread.sleep(250);
-
-        assertEquals(3, strategy.getUpdatedListOfServers("serviceType-3").size());
-
-        strategy.stop();
-    }
-
-    private void addServer(EtcdClient client, String name) throws Exception {
-        int port = PORT.incrementAndGet();
-
-        Map<String, String> tags = new HashMap<>();
-        tags.put("service_name", name);
-        tags.put("port_delta", Integer.toString(port));
-
-        Map<String, Object> server = new HashMap<>();
-        server.put("name", name);
-        server.put("address", "127.0.0.1");
-        server.put("port", 8000 + port);
-        server.put("tags", tags);
-
-        client.put(CONFIGURATION.getServicePath() + "service-" + port, MAPPER.writeValueAsString(server)).send().get();
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-etcd/src/test/resources/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallDefaultRouteTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/test/resources/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallDefaultRouteTest.xml b/components/camel-etcd/src/test/resources/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallDefaultRouteTest.xml
new file mode 100644
index 0000000..d0194c8
--- /dev/null
+++ b/components/camel-etcd/src/test/resources/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallDefaultRouteTest.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans
+         http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://camel.apache.org/schema/spring
+         http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <serviceCall name="http-service"/>
+      <to uri="mock:result"/>
+    </route>
+
+    <route>
+      <from uri="jetty:http://localhost:9091"/>
+      <transform>
+        <constant>9091</constant>
+      </transform>
+    </route>
+
+    <route>
+      <from uri="jetty:http://localhost:9092"/>
+      <transform>
+        <constant>9092</constant>
+      </transform>
+    </route>
+  </camelContext>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-etcd/src/test/resources/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallRouteTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/test/resources/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallRouteTest.xml b/components/camel-etcd/src/test/resources/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallRouteTest.xml
new file mode 100644
index 0000000..57acf03
--- /dev/null
+++ b/components/camel-etcd/src/test/resources/org/apache/camel/component/etcd/cloud/SpringEtcdServiceCallRouteTest.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans
+         http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://camel.apache.org/schema/spring
+         http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <serviceCallConfiguration id="service-0">
+      <etcdServiceDiscovery servicePath="/etcd-services-0/"/>
+    </serviceCallConfiguration>
+
+    <route>
+      <from uri="direct:start"/>
+      <choice>
+        <when>
+          <simple>${body} == 'service-0'</simple>
+          <serviceCall name="http-service" configurationRef="service-0"/>
+          <to uri="mock:result-0"/>
+        </when>
+        <when>
+          <simple>${body} == 'service-1'</simple>
+          <serviceCall name="http-service">
+            <etcdServiceDiscovery servicePath="/etcd-services-1/"/>
+          </serviceCall>
+          <to uri="mock:result-1"/>
+        </when>
+        <when>
+          <simple>${body} == 'service-2'</simple>
+          <serviceCall name="http-service">
+            <etcdServiceDiscovery servicePath="/etcd-services-2/"/>
+          </serviceCall>
+          <to uri="mock:result-2"/>
+        </when>
+      </choice>
+    </route>
+
+    <route>
+      <from uri="jetty:http://localhost:9091"/>
+      <transform>
+        <simple>${body} 9091</simple>
+      </transform>
+    </route>
+
+    <route>
+      <from uri="jetty:http://localhost:9092"/>
+      <transform>
+        <simple>${body} 9092</simple>
+      </transform>
+    </route>
+
+    <route>
+      <from uri="jetty:http://localhost:9093"/>
+      <transform>
+        <simple>${body} 9093</simple>
+      </transform>
+    </route>
+
+    <route>
+      <from uri="jetty:http://localhost:9094"/>
+      <transform>
+        <simple>${body} 9094</simple>
+      </transform>
+    </route>
+  </camelContext>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
new file mode 100644
index 0000000..0557cb1
--- /dev/null
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
@@ -0,0 +1,148 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.kubernetes.cloud;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.kubernetes.client.AutoAdaptableKubernetesClient;
+import io.fabric8.kubernetes.client.ConfigBuilder;
+import org.apache.camel.cloud.ServiceDefinition;
+import org.apache.camel.component.kubernetes.KubernetesConfiguration;
+import org.apache.camel.impl.cloud.DefaultServiceDefinition;
+import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class KubernetesClientServiceDiscovery extends KubernetesServiceDiscovery {
+    private static final Logger LOG = LoggerFactory.getLogger(KubernetesClientServiceDiscovery.class);
+    private static final int FIRST = 0;
+
+    private AutoAdaptableKubernetesClient client;
+
+    public KubernetesClientServiceDiscovery(KubernetesConfiguration configuration) {
+        super(configuration);
+        this.client = null;
+    }
+
+    @Override
+    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+        LOG.debug("Discovering endpoints from namespace: {} with name: {}", getNamespace(), name);
+        Endpoints endpoints = client.endpoints().inNamespace(getNamespace()).withName(name).get();
+        List<ServiceDefinition> result = new ArrayList<>();
+        if (endpoints != null) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Found {} endpoints in namespace: {} for name: {} and portName: {}",
+                    endpoints.getSubsets().size(), getNamespace(), name, getPortName());
+            }
+            for (EndpointSubset subset : endpoints.getSubsets()) {
+                if (subset.getPorts().size() == 1) {
+                    addServers(name, result, subset.getPorts().get(FIRST), subset);
+                } else {
+                    final List<EndpointPort> ports = subset.getPorts();
+                    final int portSize = ports.size();
+
+                    EndpointPort port;
+                    for (int p = 0; p < portSize; p++) {
+                        port = ports.get(p);
+                        if (ObjectHelper.isEmpty(getPortName()) || getPortName().endsWith(port.getName())) {
+                            addServers(name, result, port, subset);
+                        }
+                    }
+                }
+            }
+        }
+
+        return result;
+    }
+
+    protected void addServers(String name, List<ServiceDefinition> servers, EndpointPort port, EndpointSubset subset) {
+        final List<EndpointAddress> addresses = subset.getAddresses();
+        final int size = addresses.size();
+
+        for (int i = 0; i < size; i++) {
+            servers.add(new DefaultServiceDefinition(name, addresses.get(i).getIp(), port.getPort()));
+        }
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        if (client != null) {
+            return;
+        }
+
+        final KubernetesConfiguration configuration = getConfiguration();
+
+        ConfigBuilder builder = new ConfigBuilder();
+        builder.withMasterUrl(configuration.getMasterUrl());
+
+        if ((ObjectHelper.isNotEmpty(configuration.getUsername())
+            && ObjectHelper.isNotEmpty(configuration.getPassword()))
+            && ObjectHelper.isEmpty(configuration.getOauthToken())) {
+            builder.withUsername(configuration.getUsername());
+            builder.withPassword(configuration.getPassword());
+        } else {
+            builder.withOauthToken(configuration.getOauthToken());
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getCaCertData())) {
+            builder.withCaCertData(configuration.getCaCertData());
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getCaCertFile())) {
+            builder.withCaCertFile(configuration.getCaCertFile());
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getClientCertData())) {
+            builder.withClientCertData(configuration.getClientCertData());
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getClientCertFile())) {
+            builder.withClientCertFile(configuration.getClientCertFile());
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getApiVersion())) {
+            builder.withApiVersion(configuration.getApiVersion());
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getClientKeyAlgo())) {
+            builder.withClientKeyAlgo(configuration.getClientKeyAlgo());
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getClientKeyData())) {
+            builder.withClientKeyData(configuration.getClientKeyData());
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getClientKeyFile())) {
+            builder.withClientKeyFile(configuration.getClientKeyFile());
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getClientKeyPassphrase())) {
+            builder.withClientKeyPassphrase(configuration.getClientKeyPassphrase());
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getTrustCerts())) {
+            builder.withTrustCerts(configuration.getTrustCerts());
+        }
+
+        client = new AutoAdaptableKubernetesClient(builder.build());
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        if (client != null) {
+            IOHelper.close(client);
+            client = null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesDnsServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesDnsServiceDiscovery.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesDnsServiceDiscovery.java
new file mode 100644
index 0000000..003bbdc
--- /dev/null
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesDnsServiceDiscovery.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.kubernetes.cloud;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.camel.cloud.ServiceDefinition;
+import org.apache.camel.component.kubernetes.KubernetesConfiguration;
+import org.apache.camel.impl.cloud.DefaultServiceDefinition;
+
+public class KubernetesDnsServiceDiscovery extends KubernetesServiceDiscovery {
+    private ConcurrentMap<String, List<ServiceDefinition>> cache;
+
+    public KubernetesDnsServiceDiscovery(KubernetesConfiguration configuration) {
+        super(configuration);
+        this.cache = new ConcurrentHashMap<>();
+    }
+
+    @Override
+    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+        return this.cache.computeIfAbsent(name, key -> Collections.singletonList(newService(name)));
+    }
+
+    private ServiceDefinition newService(String name) {
+        return new DefaultServiceDefinition(
+            name,
+            name + "." + getConfiguration().getNamespace() + ".svc." + getConfiguration().getDnsDomain(),
+            -1);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesEnvServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesEnvServiceDiscovery.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesEnvServiceDiscovery.java
new file mode 100644
index 0000000..4a01318
--- /dev/null
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesEnvServiceDiscovery.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.kubernetes.cloud;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.cloud.ServiceDefinition;
+import org.apache.camel.component.kubernetes.KubernetesConfiguration;
+import org.apache.camel.impl.cloud.DefaultServiceDefinition;
+
+public class KubernetesEnvServiceDiscovery extends KubernetesServiceDiscovery {
+    public KubernetesEnvServiceDiscovery(KubernetesConfiguration configuration) {
+        super(configuration);
+    }
+
+    @Override
+    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+        try {
+            final CamelContext ctx = getCamelContext();
+            final String host = ctx.resolvePropertyPlaceholders("{{service.host:" + name + "}}");
+            final String num = ctx.resolvePropertyPlaceholders("{{service.port:" + name + "}}");
+            final int port = ctx.getTypeConverter().tryConvertTo(int.class, num);
+
+            return Collections.singletonList(new DefaultServiceDefinition(name, host, port));
+        } catch (Exception e) {
+            throw new RuntimeCamelException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesServiceDiscovery.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesServiceDiscovery.java
new file mode 100644
index 0000000..b6899c7
--- /dev/null
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesServiceDiscovery.java
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.kubernetes.cloud;
+
+import io.fabric8.kubernetes.api.model.EndpointAddress;
+import io.fabric8.kubernetes.api.model.EndpointPort;
+import io.fabric8.kubernetes.client.AutoAdaptableKubernetesClient;
+import org.apache.camel.cloud.ServiceDefinition;
+import org.apache.camel.component.kubernetes.KubernetesConfiguration;
+import org.apache.camel.impl.cloud.DefaultServiceDefinition;
+import org.apache.camel.impl.cloud.DefaultServiceDiscovery;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Discovers where services are running on which servers in Kubernetes.
+ */
+abstract class KubernetesServiceDiscovery extends DefaultServiceDiscovery {
+    private static final Logger LOG = LoggerFactory.getLogger(KubernetesServiceDiscovery.class);
+    private static final int FIRST = 0;
+
+    private final KubernetesConfiguration configuration;
+    private final String namespace;
+    private final String portName;
+    private AutoAdaptableKubernetesClient client;
+
+    KubernetesServiceDiscovery(KubernetesConfiguration configuration) {
+        this.configuration = configuration;
+        this.namespace = configuration.getNamespace() != null ? configuration.getNamespace() : System.getenv("KUBERNETES_NAMESPACE");
+        this.portName = configuration.getPortName();
+        this.client = null;
+    }
+
+    @Override
+    public String toString() {
+        return "KubernetesServiceDiscovery";
+    }
+
+    protected ServiceDefinition newServer(String serviceName, EndpointAddress address, EndpointPort port) {
+        return new DefaultServiceDefinition(serviceName, address.getIp(), port.getPort());
+    }
+
+    protected KubernetesConfiguration getConfiguration() {
+        return this.configuration;
+    }
+
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public String getPortName() {
+        return portName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesServiceDiscoveryFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesServiceDiscoveryFactory.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesServiceDiscoveryFactory.java
new file mode 100644
index 0000000..37bdff1
--- /dev/null
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesServiceDiscoveryFactory.java
@@ -0,0 +1,187 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.kubernetes.cloud;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.cloud.ServiceDiscovery;
+import org.apache.camel.cloud.ServiceDiscoveryFactory;
+import org.apache.camel.component.kubernetes.KubernetesConfiguration;
+import org.apache.camel.util.ObjectHelper;
+
+public class KubernetesServiceDiscoveryFactory implements ServiceDiscoveryFactory {
+    private final KubernetesConfiguration configuration;
+    private String lookup;
+
+    public KubernetesServiceDiscoveryFactory() {
+        this.configuration = new KubernetesConfiguration();
+    }
+
+    // *************************************************************************
+    // Properties
+    // *************************************************************************
+
+    public String getMasterUrl() {
+        return configuration.getMasterUrl();
+    }
+
+    public void setMasterUrl(String masterUrl) {
+        configuration.setMasterUrl(masterUrl);
+    }
+
+    public String getUsername() {
+        return configuration.getUsername();
+    }
+
+    public void setUsername(String username) {
+        configuration.setUsername(username);
+    }
+
+    public String getPassword() {
+        return configuration.getPassword();
+    }
+
+    public void setPassword(String password) {
+        configuration.setPassword(password);
+    }
+
+    public String getApiVersion() {
+        return configuration.getApiVersion();
+    }
+
+    public void setApiVersion(String apiVersion) {
+        configuration.setApiVersion(apiVersion);
+    }
+
+    public String getCaCertData() {
+        return configuration.getCaCertData();
+    }
+
+    public void setCaCertData(String caCertData) {
+        configuration.setCaCertData(caCertData);
+    }
+
+    public String getCaCertFile() {
+        return configuration.getCaCertFile();
+    }
+
+    public void setCaCertFile(String caCertFile) {
+        configuration.setCaCertFile(caCertFile);
+    }
+
+    public String getClientCertData() {
+        return configuration.getClientCertData();
+    }
+
+    public void setClientCertData(String clientCertData) {
+        configuration.setClientCertData(clientCertData);
+    }
+
+    public String getClientCertFile() {
+        return configuration.getClientCertFile();
+    }
+
+    public void setClientCertFile(String clientCertFile) {
+        configuration.setClientCertFile(clientCertFile);
+    }
+
+    public String getClientKeyAlgo() {
+        return configuration.getClientKeyAlgo();
+    }
+
+    public void setClientKeyAlgo(String clientKeyAlgo) {
+        configuration.setClientKeyAlgo(clientKeyAlgo);
+    }
+
+    public String getClientKeyData() {
+        return configuration.getClientKeyData();
+    }
+
+    public void setClientKeyData(String clientKeyData) {
+        configuration.setClientKeyData(clientKeyData);
+    }
+
+    public String getClientKeyFile() {
+        return configuration.getClientKeyFile();
+    }
+
+    public void setClientKeyFile(String clientKeyFile) {
+        configuration.setClientKeyFile(clientKeyFile);
+    }
+
+    public String getClientKeyPassphrase() {
+        return configuration.getClientKeyPassphrase();
+    }
+
+    public void setClientKeyPassphrase(String clientKeyPassphrase) {
+        configuration.setClientKeyPassphrase(clientKeyPassphrase);
+    }
+
+    public String getOauthToken() {
+        return configuration.getOauthToken();
+    }
+
+    public void setOauthToken(String oauthToken) {
+        configuration.setOauthToken(oauthToken);
+    }
+
+    public Boolean getTrustCerts() {
+        return configuration.getTrustCerts();
+    }
+
+    public void setTrustCerts(Boolean trustCerts) {
+        configuration.setTrustCerts(trustCerts);
+    }
+
+    public String getNamespace() {
+        return configuration.getNamespace();
+    }
+
+    public void setNamespace(String namespace) {
+        configuration.setNamespace(namespace);
+    }
+
+    public String getDnsDomain() {
+        return configuration.getDnsDomain();
+    }
+
+    public void setDnsDomain(String dnsDomain) {
+        configuration.setDnsDomain(dnsDomain);
+    }
+
+    public String getLookup() {
+        return lookup;
+    }
+
+    public void setLookup(String lookup) {
+        this.lookup = lookup;
+    }
+
+    // *************************************************************************
+    // Factory
+    // *************************************************************************
+
+    @Override
+    public ServiceDiscovery newInstance(CamelContext camelContext) throws Exception {
+        if (ObjectHelper.equal("dns", lookup)) {
+            return new KubernetesDnsServiceDiscovery(configuration);
+        } else if (ObjectHelper.equal("client", lookup)) {
+            return new KubernetesClientServiceDiscovery(configuration);
+        }
+
+        return new KubernetesEnvServiceDiscovery(configuration);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesDnsServiceCallExpression.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesDnsServiceCallExpression.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesDnsServiceCallExpression.java
deleted file mode 100644
index 42903e1..0000000
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesDnsServiceCallExpression.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.kubernetes.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.remote.ServiceCallConstants;
-import org.apache.camel.support.ExpressionAdapter;
-import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class KubernetesDnsServiceCallExpression extends ExpressionAdapter {
-    private static final Logger LOG = LoggerFactory.getLogger(KubernetesDnsServiceCallExpression.class);
-
-    private final String name;
-    private final String scheme;
-    private final String contextPath;
-    private final String uri;
-
-    public KubernetesDnsServiceCallExpression(String name, String scheme, String contextPath, String uri) {
-        this.name = name;
-        this.scheme = scheme;
-        this.contextPath = contextPath;
-        this.uri = uri;
-    }
-
-    @Override
-    public Object evaluate(Exchange exchange) {
-        try {
-            return buildCamelEndpointUri(
-                name,
-                uri,
-                contextPath,
-                scheme,
-                ObjectHelper.notNull(
-                    exchange.getIn().getHeader(ServiceCallConstants.SERVER_IP, String.class),
-                    ServiceCallConstants.SERVER_IP)
-            );
-        } catch (Exception e) {
-            throw ObjectHelper.wrapRuntimeCamelException(e);
-        }
-    }
-
-    protected static String buildCamelEndpointUri(String name, String uri, String contextPath, String scheme, String dnsServicePart) {
-        // build basic uri if none provided
-        String answer = uri;
-        if (answer == null) {
-            if (scheme == null) {
-                // use http by default if no scheme has been configured
-                scheme = "http";
-            }
-            answer = scheme + "://" + dnsServicePart;
-            if (contextPath != null) {
-                answer += "/" + contextPath;
-            }
-        } else {
-            // we have existing uri, then replace the serviceName with name.namespace.svc.dnsDomain
-            if (answer.contains(name)) {
-                answer = answer.replaceFirst(name, dnsServicePart);
-            }
-        }
-
-        LOG.debug("Camel endpoint uri: {} for calling service: {}", answer, name);
-        return answer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java
deleted file mode 100644
index 86b8aa7..0000000
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.kubernetes.processor;
-
-import java.util.Map;
-import java.util.Optional;
-
-import org.apache.camel.ExchangePattern;
-import org.apache.camel.component.kubernetes.KubernetesConfiguration;
-import org.apache.camel.impl.remote.DefaultServiceCallProcessor;
-import org.apache.camel.impl.remote.DefaultServiceCallProcessorFactory;
-import org.apache.camel.spi.ProcessorFactory;
-import org.apache.camel.spi.RouteContext;
-import org.apache.camel.spi.ServiceCallServer;
-import org.apache.camel.spi.ServiceCallServerListStrategy;
-import org.apache.camel.util.ObjectHelper;
-
-/**
- * {@link ProcessorFactory} that creates the Kubernetes implementation of the ServiceCall EIP.
- */
-public class KubernetesProcessorFactory extends DefaultServiceCallProcessorFactory<KubernetesConfiguration, ServiceCallServer> {
-
-    @Override
-    protected KubernetesConfiguration createConfiguration(RouteContext routeContext) throws Exception {
-        return new KubernetesConfiguration();
-    }
-
-    @Override
-    protected DefaultServiceCallProcessor createProcessor(
-            String name,
-            String component,
-            String uri,
-            ExchangePattern mep,
-            KubernetesConfiguration conf,
-            Map<String, String> properties) throws Exception {
-
-        return new KubernetesServiceCallProcessor(name, component, uri, mep, conf);
-    }
-
-    @Override
-    protected Optional<ServiceCallServerListStrategy> builtInServerListStrategy(KubernetesConfiguration conf, String name) throws Exception {
-        ServiceCallServerListStrategy strategy = null;
-        if (ObjectHelper.equal("client", name, true)) {
-            strategy = new KubernetesServiceCallServerListStrategies.Client(conf);
-        } else if (ObjectHelper.equal("environment", name, true)) {
-            strategy = new KubernetesServiceCallServerListStrategies.Environment(conf);
-        } else if (ObjectHelper.equal("env", name, true)) {
-            strategy = new KubernetesServiceCallServerListStrategies.Environment(conf);
-        } else if (ObjectHelper.equal("dns", name, true)) {
-            strategy = new KubernetesServiceCallServerListStrategies.DNS(conf);
-        }
-
-        return Optional.ofNullable(strategy);
-    }
-
-    @Override
-    protected ServiceCallServerListStrategy<ServiceCallServer> createDefaultServerListStrategy(KubernetesConfiguration conf) throws Exception {
-        return new KubernetesServiceCallServerListStrategies.Client(conf);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallProcessor.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallProcessor.java
deleted file mode 100644
index f6e27e9..0000000
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallProcessor.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.kubernetes.processor;
-
-import org.apache.camel.ExchangePattern;
-import org.apache.camel.component.kubernetes.KubernetesConfiguration;
-import org.apache.camel.impl.remote.DefaultServiceCallProcessor;
-import org.apache.camel.spi.ServiceCallServer;
-import org.apache.camel.spi.ServiceCallServerListStrategy;
-
-public class KubernetesServiceCallProcessor extends DefaultServiceCallProcessor<ServiceCallServer> {
-    public KubernetesServiceCallProcessor(String name, String scheme, String uri, ExchangePattern exchangePattern, KubernetesConfiguration conf) {
-        super(name, scheme, uri, exchangePattern);
-    }
-
-    @Override
-    public void setServerListStrategy(ServiceCallServerListStrategy<ServiceCallServer> serverListStrategy) {
-        if (!(serverListStrategy instanceof KubernetesServiceCallServerListStrategy)) {
-            throw new IllegalArgumentException("ServerListStrategy is not an instance of KubernetesServiceCallServerListStrategy");
-        }
-
-        super.setServerListStrategy(serverListStrategy);
-    }
-
-    @Override
-    protected void doStart() throws Exception {
-        ServiceCallServerListStrategy<ServiceCallServer> strategy = getServerListStrategy();
-        if (strategy != null && strategy instanceof KubernetesServiceCallServerListStrategies.DNS) {
-            setServiceCallExpression(new KubernetesDnsServiceCallExpression(
-                getName(),
-                getScheme(),
-                getContextPath(),
-                getUri()
-            ));
-        }
-
-        super.doStart();
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallServerListStrategies.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallServerListStrategies.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallServerListStrategies.java
deleted file mode 100644
index ec04359..0000000
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallServerListStrategies.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.kubernetes.processor;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-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.kubernetes.client.AutoAdaptableKubernetesClient;
-import io.fabric8.kubernetes.client.ConfigBuilder;
-import org.apache.camel.CamelContext;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.component.kubernetes.KubernetesConfiguration;
-import org.apache.camel.impl.remote.DefaultServiceCallServer;
-import org.apache.camel.spi.ServiceCallServer;
-import org.apache.camel.util.IOHelper;
-import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class KubernetesServiceCallServerListStrategies {
-    private KubernetesServiceCallServerListStrategies() {
-    }
-
-    // *************************************************************************
-    // Client
-    // *************************************************************************
-
-    public static final class Client extends KubernetesServiceCallServerListStrategy {
-        private static final Logger LOG = LoggerFactory.getLogger(Client.class);
-        private static final int FIRST = 0;
-
-        private AutoAdaptableKubernetesClient client;
-
-        public Client(KubernetesConfiguration configuration) {
-            super(configuration);
-
-            this.client = null;
-        }
-
-        public List<ServiceCallServer> getUpdatedListOfServers(String name) {
-            LOG.debug("Discovering endpoints from namespace: {} with name: {}", getNamespace(), name);
-            Endpoints endpoints = client.endpoints().inNamespace(getNamespace()).withName(name).get();
-            List<ServiceCallServer> result = new ArrayList<>();
-            if (endpoints != null) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Found {} endpoints in namespace: {} for name: {} and portName: {}",
-                        endpoints.getSubsets().size(), getNamespace(), name, getPortName());
-                }
-                for (EndpointSubset subset : endpoints.getSubsets()) {
-                    if (subset.getPorts().size() == 1) {
-                        addServers(result, subset.getPorts().get(FIRST), subset);
-                    } else {
-                        final List<EndpointPort> ports = subset.getPorts();
-                        final int portSize = ports.size();
-
-                        EndpointPort port;
-                        for (int p = 0; p < portSize; p++) {
-                            port = ports.get(p);
-                            if (ObjectHelper.isEmpty(getPortName()) || getPortName().endsWith(port.getName())) {
-                                addServers(result, port, subset);
-                            }
-                        }
-                    }
-                }
-            }
-
-            return result;
-        }
-
-        protected void addServers(List<ServiceCallServer> servers, EndpointPort port, EndpointSubset subset) {
-            final List<EndpointAddress> addresses = subset.getAddresses();
-            final int size = addresses.size();
-
-            for (int i = 0; i < size; i++) {
-                servers.add(new DefaultServiceCallServer(addresses.get(i).getIp(), port.getPort()));
-            }
-        }
-
-        @Override
-        protected void doStart() throws Exception {
-            if (client != null) {
-                return;
-            }
-
-            final KubernetesConfiguration configuration = getConfiguration();
-
-            ConfigBuilder builder = new ConfigBuilder();
-            builder.withMasterUrl(configuration.getMasterUrl());
-
-            if ((ObjectHelper.isNotEmpty(configuration.getUsername())
-                && ObjectHelper.isNotEmpty(configuration.getPassword()))
-                && ObjectHelper.isEmpty(configuration.getOauthToken())) {
-                builder.withUsername(configuration.getUsername());
-                builder.withPassword(configuration.getPassword());
-            } else {
-                builder.withOauthToken(configuration.getOauthToken());
-            }
-            if (ObjectHelper.isNotEmpty(configuration.getCaCertData())) {
-                builder.withCaCertData(configuration.getCaCertData());
-            }
-            if (ObjectHelper.isNotEmpty(configuration.getCaCertFile())) {
-                builder.withCaCertFile(configuration.getCaCertFile());
-            }
-            if (ObjectHelper.isNotEmpty(configuration.getClientCertData())) {
-                builder.withClientCertData(configuration.getClientCertData());
-            }
-            if (ObjectHelper.isNotEmpty(configuration.getClientCertFile())) {
-                builder.withClientCertFile(configuration.getClientCertFile());
-            }
-            if (ObjectHelper.isNotEmpty(configuration.getApiVersion())) {
-                builder.withApiVersion(configuration.getApiVersion());
-            }
-            if (ObjectHelper.isNotEmpty(configuration.getClientKeyAlgo())) {
-                builder.withClientKeyAlgo(configuration.getClientKeyAlgo());
-            }
-            if (ObjectHelper.isNotEmpty(configuration.getClientKeyData())) {
-                builder.withClientKeyData(configuration.getClientKeyData());
-            }
-            if (ObjectHelper.isNotEmpty(configuration.getClientKeyFile())) {
-                builder.withClientKeyFile(configuration.getClientKeyFile());
-            }
-            if (ObjectHelper.isNotEmpty(configuration.getClientKeyPassphrase())) {
-                builder.withClientKeyPassphrase(configuration.getClientKeyPassphrase());
-            }
-            if (ObjectHelper.isNotEmpty(configuration.getTrustCerts())) {
-                builder.withTrustCerts(configuration.getTrustCerts());
-            }
-
-            client = new AutoAdaptableKubernetesClient(builder.build());
-        }
-
-        @Override
-        protected void doStop() throws Exception {
-            if (client != null) {
-                IOHelper.close(client);
-                client = null;
-            }
-        }
-
-        @Override
-        public String toString() {
-            return "KubernetesServiceDiscovery.Client";
-        }
-    }
-
-    // *************************************************************************
-    // DNS
-    // *************************************************************************
-
-    private abstract static class StaticServerListStrategy extends KubernetesServiceCallServerListStrategy {
-        private Map<String, List<ServiceCallServer>> servers;
-
-        StaticServerListStrategy(KubernetesConfiguration configuration) {
-            super(configuration);
-
-            servers = new ConcurrentHashMap<>();
-        }
-
-        @Override
-        public List<ServiceCallServer> getUpdatedListOfServers(String name) {
-            List<ServiceCallServer> list = servers.get(name);
-            if (list == null) {
-                synchronized (servers) {
-                    list = servers.computeIfAbsent(name, this::createServerList);
-                }
-            }
-
-            return list;
-        }
-
-        protected abstract List<ServiceCallServer> createServerList(String name);
-    }
-
-    // *************************************************************************
-    // DNS
-    // *************************************************************************
-
-    public static final class DNS extends StaticServerListStrategy {
-        public DNS(KubernetesConfiguration configuration) {
-            super(configuration);
-        }
-
-        @Override
-        protected List<ServiceCallServer> createServerList(String name) {
-            return Collections.singletonList(new DefaultServiceCallServer(
-                name + "." + getConfiguration().getNamespace() + ".svc." + getConfiguration().getDnsDomain(),
-                -1)
-            );
-        }
-
-        @Override
-        public String toString() {
-            return "KubernetesServiceDiscovery.DNS";
-        }
-    }
-
-    // *************************************************************************
-    // Environment
-    // *************************************************************************
-
-    public static final class Environment extends StaticServerListStrategy {
-        public Environment(KubernetesConfiguration configuration) {
-            super(configuration);
-        }
-
-        @Override
-        protected List<ServiceCallServer> createServerList(String name) {
-            try {
-                final CamelContext ctx = getCamelContext();
-                final String ip = ctx.resolvePropertyPlaceholders("{{service.host:" + name + "}}");
-                final String num = ctx.resolvePropertyPlaceholders("{{service.port:" + name + "}}");
-                final int port = ctx.getTypeConverter().tryConvertTo(int.class, num);
-
-                return Collections.singletonList(new DefaultServiceCallServer(ip, port));
-            } catch (Exception e) {
-                throw new RuntimeCamelException(e);
-            }
-        }
-
-        @Override
-        public String toString() {
-            return "KubernetesServiceDiscovery.Environment";
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/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
deleted file mode 100644
index e9358f0..0000000
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesServiceCallServerListStrategy.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.kubernetes.processor;
-
-import io.fabric8.kubernetes.api.model.EndpointAddress;
-import io.fabric8.kubernetes.api.model.EndpointPort;
-import io.fabric8.kubernetes.client.AutoAdaptableKubernetesClient;
-import org.apache.camel.component.kubernetes.KubernetesConfiguration;
-import org.apache.camel.impl.remote.DefaultServiceCallServer;
-import org.apache.camel.impl.remote.DefaultServiceCallServerListStrategy;
-import org.apache.camel.spi.ServiceCallServer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Discovers where services are running on which servers in Kubernetes.
- */
-public abstract class KubernetesServiceCallServerListStrategy extends DefaultServiceCallServerListStrategy<ServiceCallServer> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(KubernetesServiceCallServerListStrategy.class);
-    private static final int FIRST = 0;
-
-    private final KubernetesConfiguration configuration;
-    private final String namespace;
-    private final String portName;
-    private AutoAdaptableKubernetesClient client;
-
-
-    public KubernetesServiceCallServerListStrategy(KubernetesConfiguration configuration) {
-        this.configuration = configuration;
-        this.namespace = configuration.getNamespace() != null ? configuration.getNamespace() : System.getenv("KUBERNETES_NAMESPACE");
-        this.portName = configuration.getPortName();
-        this.client = null;
-    }
-
-    @Override
-    public String toString() {
-        return "KubernetesServiceDiscovery";
-    }
-
-    protected ServiceCallServer newServer(EndpointAddress address, EndpointPort port) {
-        return new DefaultServiceCallServer(address.getIp(), port.getPort());
-    }
-
-    protected KubernetesConfiguration getConfiguration() {
-        return this.configuration;
-    }
-
-    public String getNamespace() {
-        return namespace;
-    }
-
-    public String getPortName() {
-        return portName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/cloud/kubernetes-service-discovery
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/cloud/kubernetes-service-discovery b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/cloud/kubernetes-service-discovery
new file mode 100644
index 0000000..db3d36a
--- /dev/null
+++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/cloud/kubernetes-service-discovery
@@ -0,0 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+class=org.apache.camel.component.kubernetes.cloud.KubernetesServiceDiscoveryFactory

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/model/ServiceCallDefinition
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/model/ServiceCallDefinition b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/model/ServiceCallDefinition
deleted file mode 100644
index acf5be8..0000000
--- a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/model/ServiceCallDefinition
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-class=org.apache.camel.component.kubernetes.processor.KubernetesProcessorFactory

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/ServiceCallClientRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/ServiceCallClientRouteTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/ServiceCallClientRouteTest.java
new file mode 100644
index 0000000..bb42272
--- /dev/null
+++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/ServiceCallClientRouteTest.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.kubernetes.cloud;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.kubernetes.KubernetesConfiguration;
+import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("Manual test")
+public class ServiceCallClientRouteTest extends CamelTestSupport {
+
+    @Test
+    public void testServiceCall() throws Exception {
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                KubernetesConfiguration kubernetesConfiguration = new KubernetesConfiguration();
+                kubernetesConfiguration.setMasterUrl("http://172.28.128.80:8080");
+                kubernetesConfiguration.setUsername("admin");
+                kubernetesConfiguration.setPassword("admin");
+                kubernetesConfiguration.setNamespace("default");
+
+                ServiceCallConfigurationDefinition config = new ServiceCallConfigurationDefinition();
+                config.setServiceDiscovery(new KubernetesEnvServiceDiscovery(kubernetesConfiguration));
+
+                // register configuration
+                context.setServiceCallConfiguration(config);
+
+                from("direct:start")
+                    .serviceCall("cdi-camel-jetty")
+                    .serviceCall("cdi-camel-jetty")
+                    .to("mock:result");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/ServiceCallEnvironmentRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/ServiceCallEnvironmentRouteTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/ServiceCallEnvironmentRouteTest.java
new file mode 100644
index 0000000..b194d67
--- /dev/null
+++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/ServiceCallEnvironmentRouteTest.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.kubernetes.cloud;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.kubernetes.KubernetesConfiguration;
+import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("Manual test")
+public class ServiceCallEnvironmentRouteTest extends CamelTestSupport {
+
+    @Test
+    public void testServiceCall() throws Exception {
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                KubernetesConfiguration kubernetesConfiguration = new KubernetesConfiguration();
+
+                ServiceCallConfigurationDefinition config = new ServiceCallConfigurationDefinition();
+                config.setServiceDiscovery(new KubernetesEnvServiceDiscovery(kubernetesConfiguration));
+
+                // register configuration
+                context.setServiceCallConfiguration(config);
+
+                from("direct:start")
+                    .serviceCall("cdi-camel-jetty")
+                    .serviceCall("cdi-camel-jetty")
+                    .to("mock:result");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallClientRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallClientRouteTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallClientRouteTest.java
new file mode 100644
index 0000000..0983519
--- /dev/null
+++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallClientRouteTest.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.kubernetes.cloud;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+@Ignore("Manual test")
+public class SpringServiceCallClientRouteTest extends CamelSpringTestSupport {
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/kubernetes/cloud/SpringServiceCallClientRouteTest.xml");
+    }
+
+    @Test
+    public void testServiceCall() throws Exception {
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallDnsRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallDnsRouteTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallDnsRouteTest.java
new file mode 100644
index 0000000..23d48c6
--- /dev/null
+++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallDnsRouteTest.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.kubernetes.cloud;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+@Ignore("Manual test")
+public class SpringServiceCallDnsRouteTest extends CamelSpringTestSupport {
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/kubernetes/cloud/SpringServiceCallDnsRouteTest.xml");
+    }
+
+    @Test
+    public void testServiceCall() throws Exception {
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/a811f400/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallEnvironmentRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallEnvironmentRouteTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallEnvironmentRouteTest.java
new file mode 100644
index 0000000..cc9f21e
--- /dev/null
+++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cloud/SpringServiceCallEnvironmentRouteTest.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.kubernetes.cloud;
+
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+@Ignore("Manual test")
+public class SpringServiceCallEnvironmentRouteTest extends CamelSpringTestSupport {
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/kubernetes/cloud/SpringServiceCallEnvironmentRouteTest.xml");
+    }
+
+    @Test
+    public void testServiceCall() throws Exception {
+        getMockEndpoint("mock:result").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+}