From d11b228d45b2ce89b718872cba114bf2197cff3a Mon Sep 17 00:00:00 2001 From: Paulo Pires Date: Thu, 15 Jan 2015 11:52:38 +0000 Subject: [PATCH 1/3] Implemented Kubernetes discovery in Cellar clusters. --- assembly/pom.xml | 5 + assembly/src/main/resources/features.xml | 22 +++ assembly/src/main/resources/kubernetes.cfg | 5 + kubernetes/NOTICE | 39 +++++ kubernetes/pom.xml | 110 ++++++++++++++ .../karaf/cellar/kubernetes/Activator.java | 40 +++++ .../KubernetesDiscoveryService.java | 139 ++++++++++++++++++ .../KubernetesDiscoveryServiceFactory.java | 103 +++++++++++++ manual/src/main/webapp/user-guide/index.conf | 1 + .../main/webapp/user-guide/kubernetes.conf | 61 ++++++++ pom.xml | 9 ++ 11 files changed, 534 insertions(+) create mode 100644 assembly/src/main/resources/kubernetes.cfg create mode 100644 kubernetes/NOTICE create mode 100644 kubernetes/pom.xml create mode 100644 kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/Activator.java create mode 100644 kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryService.java create mode 100644 kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryServiceFactory.java create mode 100644 manual/src/main/webapp/user-guide/kubernetes.conf diff --git a/assembly/pom.xml b/assembly/pom.xml index 5b3d8b2f7..e9e99d66f 100644 --- a/assembly/pom.xml +++ b/assembly/pom.xml @@ -90,6 +90,11 @@ cfg node + + target/classes/kubernetes.cfg + cfg + kubernetes + target/classes/hazelcast.xml xml diff --git a/assembly/src/main/resources/features.xml b/assembly/src/main/resources/features.xml index ddefc5292..9bcf52907 100644 --- a/assembly/src/main/resources/features.xml +++ b/assembly/src/main/resources/features.xml @@ -16,6 +16,7 @@ mvn:org.apache.jclouds.karaf/jclouds-karaf/${jclouds.version}/xml/features + mvn:org.apache.cxf.karaf/apache-cxf/3.0.2/xml/features @@ -97,6 +98,27 @@ mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.cloud/${project.version} + + + mvn:org.apache.karaf.cellar/apache-karaf-cellar/${project.version}/cfg/kubernetes + + cellar-core + cxf-jaxrs + mvn:com.fasterxml.jackson.core/jackson-core/2.4.1 + mvn:com.fasterxml.jackson.core/jackson-annotations/2.4.1 + mvn:com.fasterxml.jackson.core/jackson-databind/2.4.1 + mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/2.4.1 + mvn:javax.validation/validation-api/1.1.0.Final + mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/2.4.1 + mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.4.1 + mvn:io.fabric8/fabric-utils/${fabric8.version} + mvn:commons-lang/commons-lang/2.6 + wrap:mvn:org.yaml/snakeyaml/1.5 + wrap:mvn:org.json/json/20140107 + mvn:io.fabric8/kubernetes-api/${fabric8.version} + mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.kubernetes/${project.version} + + cellar webconsole diff --git a/assembly/src/main/resources/kubernetes.cfg b/assembly/src/main/resources/kubernetes.cfg new file mode 100644 index 000000000..9e83ff850 --- /dev/null +++ b/assembly/src/main/resources/kubernetes.cfg @@ -0,0 +1,5 @@ +# +# Label selector used to idenfity Cellar nodes in Kubernetes cluster +# +pod.label.key = name +pod.label.value = cellar \ No newline at end of file diff --git a/kubernetes/NOTICE b/kubernetes/NOTICE new file mode 100644 index 000000000..ff0b4a5fe --- /dev/null +++ b/kubernetes/NOTICE @@ -0,0 +1,39 @@ +Apache Karaf Cellar +Copyright 2011-2014 The Apache Software Foundation + +I. Used Software + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). +Licensed under the Apache License 2.0. + +This product uses software developed at +The OSGi Alliance (http://www.osgi.org/). +Licensed under the Apache License 2.0. + +This product uses software developed at +Hazelcast (http://www.hazelcast.com/). +Licensed under the Apache License 2.0. + +This product uses software developed at +OPS4J (http://www.ops4j.org/). +Licensed under the Apache License 2.0. + +This product uses software developed at +FUSE Source (http://www.fusesource.org/). +Licensed under the Apache License 2.0. + +This product uses software developed at +Fabric8 (http://fabric8.io/). +Licensed under the Apache License 2.0. + +This product uses software developed at +SLF4J (http://www.slf4j.org/). +Licensed under the MIT License. + +This product includes software from http://www.json.org. +Copyright (c) 2002 JSON.org + +II. License Summary +- Apache License 2.0 +- MIT License diff --git a/kubernetes/pom.xml b/kubernetes/pom.xml new file mode 100644 index 000000000..b2219d12e --- /dev/null +++ b/kubernetes/pom.xml @@ -0,0 +1,110 @@ + + + + + + 4.0.0 + + + org.apache.karaf + cellar + 3.0.1-SNAPSHOT + ../pom.xml + + + org.apache.karaf.cellar + org.apache.karaf.cellar.kubernetes + bundle + Apache Karaf :: Cellar :: Kubernetes + + + + + + org.apache.karaf.cellar + org.apache.karaf.cellar.core + + + + + io.fabric8 + kubernetes-api + + + + + org.osgi + org.osgi.core + provided + + + org.osgi + org.osgi.compendium + provided + + + + + org.slf4j + slf4j-api + provided + + + + + junit + junit + test + + + + + + + org.apache.felix + maven-bundle-plugin + + + + org.apache.karaf.cellar.kubernetes*;version="${project.version}" + + + io.fabric8.kubernetes.api;version="${fabric8.version}", + org.apache.karaf.cellar.core*;version="${project.version}", + org.osgi*, + org.slf4j;version="[1.6,2)";resolution:=optional + + javax.*,org.w3c.*,org.xml.*,io.fabric8.*,* + org.apache.karaf.cellar.kubernetes.Activator + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + + + + + + diff --git a/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/Activator.java b/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/Activator.java new file mode 100644 index 000000000..8e7b28038 --- /dev/null +++ b/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/Activator.java @@ -0,0 +1,40 @@ +/* + * Licensed 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.karaf.cellar.kubernetes; + +import java.util.Hashtable; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.service.cm.ManagedServiceFactory; + +/** + * Kubernetes bundle activator. + */ +public class Activator implements BundleActivator { + + @Override + public void start(BundleContext context) throws Exception { + Hashtable properties = new Hashtable(); + properties.put(Constants.SERVICE_PID, "org.apache.karaf.cellar.kubernetes"); + KubernetesDiscoveryServiceFactory kubernetesDiscoveryServiceFactory = new KubernetesDiscoveryServiceFactory(context); + context.registerService(ManagedServiceFactory.class.getName(), kubernetesDiscoveryServiceFactory, properties); + } + + @Override + public void stop(BundleContext context) throws Exception { + // nothing to do + } + +} \ No newline at end of file diff --git a/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryService.java b/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryService.java new file mode 100644 index 000000000..a93776bd7 --- /dev/null +++ b/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryService.java @@ -0,0 +1,139 @@ +/* + * Licensed 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.karaf.cellar.kubernetes; + +import io.fabric8.kubernetes.api.KubernetesClient; +import io.fabric8.kubernetes.api.KubernetesFactory; +import io.fabric8.kubernetes.api.model.Pod; +import io.fabric8.kubernetes.api.model.PodList; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import org.apache.karaf.cellar.core.discovery.DiscoveryService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Discovery service that uses kubernetes API to discover other Cellar nodes. + */ +public class KubernetesDiscoveryService implements DiscoveryService { + + private static final transient Logger LOGGER = LoggerFactory.getLogger(KubernetesDiscoveryService.class); + + private String kubeHost; + private String kubePort; + private String kubePodLabelKey; + private String kubePodLabelValue; + + private KubernetesClient kubeClient; + + public KubernetesDiscoveryService() { + LOGGER.debug("CELLAR Kubernetes: discovery service initialized"); + } + + public void init() { + try { + String kubeUrl = "http://" + kubeHost + ":" + kubePort; + LOGGER.debug("CELLAR Kubernetes: Querying kubernetes API at {}..", kubeUrl); + kubeClient = new KubernetesClient(new KubernetesFactory(kubeUrl)); + } catch (Exception ex) { + LOGGER.error("CELLAR Kubernetes: error while initializing discovery service", ex); + } + } + + public void destroy() { + } + + public void update(Map properties) { + LOGGER.debug("CELLAR Kubernetes: updating properties"); + } + + /** + * Returns a {@link Set} of IPs. + * + * @return a set of IPs. + */ + @Override + public Set discoverMembers() { + LOGGER.debug("CELLAR Kubernetes: Querying pods labeled with [{}={}]", kubePodLabelKey, kubePodLabelValue); + Set members = new HashSet(); + try { + PodList podList = kubeClient.getPods(); + for (Pod pod : podList.getItems()) { + String val = pod.getLabels().get(kubePodLabelKey); + if (val != null && !val.isEmpty()) { + members.add(pod.getCurrentState().getPodIP()); + } + } + }catch(Exception ex){ + LOGGER.error("CELLAR Kubernetes: there was an error reading from Kubernetes API."); + } + LOGGER.debug("CELLAR Kubernetes: returning members {}", members); + return members; + } + + /** + * Sign In member to the {@link DiscoveryService}. + */ + @Override + public void signIn() { + } + + /** + * Refresh member to the {@link DiscoveryService}. + */ + @Override + public void refresh() { + } + + /** + * Sign out member to the {@link DiscoveryService}. + */ + @Override + public void signOut() { + } + + public String getKubeHost() { + return kubeHost; + } + + public void setKubeHost(String kubeHost) { + this.kubeHost = kubeHost; + } + + public String getKubePort() { + return kubePort; + } + + public void setKubePort(String kubePort) { + this.kubePort = kubePort; + } + + public String getKubePodLabelKey() { + return kubePodLabelKey; + } + + public void setKubePodLabelKey(String kubePodLabelKey) { + this.kubePodLabelKey = kubePodLabelKey; + } + + public String getKubePodLabelValue() { + return kubePodLabelValue; + } + + public void setKubePodLabelValue(String kubePodLabelValue) { + this.kubePodLabelValue = kubePodLabelValue; + } + +} diff --git a/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryServiceFactory.java b/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryServiceFactory.java new file mode 100644 index 000000000..f6dbd3e60 --- /dev/null +++ b/kubernetes/src/main/java/org/apache/karaf/cellar/kubernetes/KubernetesDiscoveryServiceFactory.java @@ -0,0 +1,103 @@ +/* + * Licensed 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.karaf.cellar.kubernetes; + +import java.util.Dictionary; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; +import org.apache.karaf.cellar.core.discovery.DiscoveryService; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedServiceFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A factory kubernetes discovery service. + */ +public class KubernetesDiscoveryServiceFactory implements ManagedServiceFactory { + + private static String getEnvOrDefault(String var, String def) { + final String val = System.getenv(var); + return val == null ? def : val; + } + + private static final transient Logger LOGGER = LoggerFactory.getLogger(KubernetesDiscoveryServiceFactory.class); + + private static final String KUBE_POD_LABEL_KEY = "pod.label.key"; + private static final String KUBE_POD_LABEL_VALUE = "pod.label.value"; + + private final Map registrations = new ConcurrentHashMap(); + + private final BundleContext bundleContext; + + public KubernetesDiscoveryServiceFactory(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + + @Override + public String getName() { + return "CELLAR KUBERNETES: discovery service factory"; + } + + @Override + public void updated(String pid, Dictionary properties) throws ConfigurationException { + ServiceRegistration newRegistration = null; + try { + if (properties != null) { + + Properties serviceProperties = new Properties(); + + for (Map.Entry entry : serviceProperties.entrySet()) { + Object key = entry.getKey(); + Object val = entry.getValue(); + serviceProperties.put(key, val); + } + + KubernetesDiscoveryService service = new KubernetesDiscoveryService(); + + String kubeHost = getEnvOrDefault("KUBERNETES_RO_SERVICE_HOST", "localhost"); + String kubePort = getEnvOrDefault("KUBERNETES_RO_SERVICE_PORT", "8080"); + String kubePodLabelKey = (String) properties.get(KUBE_POD_LABEL_KEY); + String kubePodLabelValue = (String) properties.get(KUBE_POD_LABEL_VALUE); + + service.setKubeHost(kubeHost); + service.setKubePort(kubePort); + service.setKubePodLabelKey(kubePodLabelKey); + service.setKubePodLabelValue(kubePodLabelValue); + service.init(); + + newRegistration = bundleContext.registerService(DiscoveryService.class.getName(), service, (Dictionary) serviceProperties); + } + } finally { + ServiceRegistration oldRegistration = (newRegistration == null) ? registrations.remove(pid) : registrations.put(pid, newRegistration); + if (oldRegistration != null) { + LOGGER.debug("CELLAR KUBERNETES: un-registering discovery service {}", pid); + oldRegistration.unregister(); + } + } + } + + @Override + public void deleted(String pid) { + LOGGER.debug("CELLAR Kubernetes: deleting discovery service {}", pid); + ServiceRegistration oldRegistration = registrations.remove(pid); + if (oldRegistration != null) { + oldRegistration.unregister(); + } + } + +} diff --git a/manual/src/main/webapp/user-guide/index.conf b/manual/src/main/webapp/user-guide/index.conf index 765013864..5f426dcb0 100644 --- a/manual/src/main/webapp/user-guide/index.conf +++ b/manual/src/main/webapp/user-guide/index.conf @@ -9,3 +9,4 @@ h1. Karaf Cellar User Guide * [OSGi Event broadcast with Karaf Cellar|/user-guide/event] * [DOSGi and Transport|/user-guide/transport] * [Cellar Cloud Discovery|/user-guide/cloud] +* [Kubernetes Discovery|user-guide/kubernetes] diff --git a/manual/src/main/webapp/user-guide/kubernetes.conf b/manual/src/main/webapp/user-guide/kubernetes.conf new file mode 100644 index 000000000..b7c185ac2 --- /dev/null +++ b/manual/src/main/webapp/user-guide/kubernetes.conf @@ -0,0 +1,61 @@ +h1. Cellar Kubernetes discovery + +h2. Kubernetes + +Kubernetes (http://kubernetes.io) is an open source orchestration system for Docker containers. It handles scheduling +onto nodes in a compute cluster and actively manages workloads to ensure that their state matches the users declared +intentions. +Using the concepts of "labels", "pods", "replicationControllers" and "services", it groups the containers which make up + an application into logical units for easy management and discovery. + +Following the aforementioned concept will most likely change how you package and provision your Karaf-based applications. +For instance, you will eventually have to provide a Docker image with a pre-configured Karaf, KAR files in deployment +folder, etc. so that your Kubernetes container may bootstrap everything on boot. + +h2. Cellar in Kubernetes + +Cellar relies on Hazelcast (http://www.hazelcast.com) in order to discover cluster nodes. This can happen either by using +multicast or unicast (specifying the IP address of each node) discovery. +Unfortunately, multicast traffic is blocked on most IaaS providers, hence it's blocked on Kubernetes clusters, as well. +The alternative is to specify each available node IP address beforehand, and only then start Cellar. +This creates configuration and maintenance difficulties, especially since in most cases the addresses are not known in +advance. +Also, it defeats scalability - remember that in Kubernetes containers (pods) can come and go and the only assurance +you will have is that the cluster will try to have at all times the number of containers you specified. + +Cellar solves this problem by using a Kubernetes discovery service. + +h2. Kubernetes discovery service + +In order to determine the IP address of each node, so that Hazelcast can connect to them, the Kubernetes discovery service +queries the Kubernetes API for containers labeled with the pod.label.key and pod.label.key specified +in etc/org.apache.karaf.cellar.kubernetes.cfg. So, you must be sure to label your containers (pods) +accordingly.1 + +NOTE: All containers in a Kubernetes cluster can access said API at http://$KUBERNETES_RO_SERVICE_HOST:$KUBERNETES_RO_SERVICE_PORT, +since environment variables are injected into all Kubernetes containers) + +After a Cellar node starts up, Kubernetes discovery service will configure Hazelcast with currently running Cellar nodes. +Since Hazelcast follows a peer-to-peer all-shared topology, whenever nodes come up and down, the cluster will remain +up-to-date. + +h2. Installing Kubernetes discovery service + +To install the Kubernetes discovery service, simply install cellar-kubernetes feature. + +{code} +karaf@root()> feature:install cellar-kubernetes +{code} + +Once the feature is installed, a new configuration file for the Kubernetes discovery service will live in +etc/org.apache.karaf.cellar.kubernetes.cfg with the following contents: + +{code} +# +# Label selector used to idenfity Cellar nodes in Kubernetes cluster +# +pod.label.key = name +pod.label.value = cellar +{code} + +In case you change the file, the discovery service will check again for new nodes. If new nodes are found, Hazelcast configuration will be updated and the instance restarted. \ No newline at end of file diff --git a/pom.xml b/pom.xml index 8aaf2f967..ba3e23fcb 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,7 @@ 4.2.2 3.3.4 1.8.1 + 2.0.19 2.5 4.11 3.0.2 @@ -61,6 +62,7 @@ hazelcast utils cloud + kubernetes webconsole assembly samples @@ -280,6 +282,13 @@ ${jclouds.version} + + + io.fabric8 + kubernetes-api + ${fabric8.version} + + joda-time From 8da9b2d0ea8f1f430fc9b2d0f81684a3238a5508 Mon Sep 17 00:00:00 2001 From: Paulo Pires Date: Thu, 15 Jan 2015 15:11:16 +0000 Subject: [PATCH 2/3] Improved documentation markup. --- .../main/webapp/user-guide/kubernetes.conf | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/manual/src/main/webapp/user-guide/kubernetes.conf b/manual/src/main/webapp/user-guide/kubernetes.conf index b7c185ac2..a791df0a3 100644 --- a/manual/src/main/webapp/user-guide/kubernetes.conf +++ b/manual/src/main/webapp/user-guide/kubernetes.conf @@ -2,11 +2,10 @@ h1. Cellar Kubernetes discovery h2. Kubernetes -Kubernetes (http://kubernetes.io) is an open source orchestration system for Docker containers. It handles scheduling -onto nodes in a compute cluster and actively manages workloads to ensure that their state matches the users declared -intentions. +[Kubernetes|http://kubernetes.io] is an open source orchestration system for Docker containers. It handles scheduling onto nodes in a compute +cluster and actively manages workloads to ensure that their state matches the users declared intentions. Using the concepts of "labels", "pods", "replicationControllers" and "services", it groups the containers which make up - an application into logical units for easy management and discovery. +an application into logical units for easy management and discovery. Following the aforementioned concept will most likely change how you package and provision your Karaf-based applications. For instance, you will eventually have to provide a Docker image with a pre-configured Karaf, KAR files in deployment @@ -14,30 +13,30 @@ folder, etc. so that your Kubernetes container may bootstrap everything on boot. h2. Cellar in Kubernetes -Cellar relies on Hazelcast (http://www.hazelcast.com) in order to discover cluster nodes. This can happen either by using -multicast or unicast (specifying the IP address of each node) discovery. +Cellar relies on [Hazelcast|http://www.hazelcast.com] in order to discover cluster nodes. This can happen either by using multicast or unicast discovery. Unfortunately, multicast traffic is blocked on most IaaS providers, hence it's blocked on Kubernetes clusters, as well. The alternative is to specify each available node IP address beforehand, and only then start Cellar. This creates configuration and maintenance difficulties, especially since in most cases the addresses are not known in advance. -Also, it defeats scalability - remember that in Kubernetes containers (pods) can come and go and the only assurance -you will have is that the cluster will try to have at all times the number of containers you specified. +Also, it defeats scalability - remember that in Kubernetes containers (pods) can come and go and the only assurance you will have +is that the cluster will try to have at all times the number of containers you specified. Cellar solves this problem by using a Kubernetes discovery service. h2. Kubernetes discovery service -In order to determine the IP address of each node, so that Hazelcast can connect to them, the Kubernetes discovery service -queries the Kubernetes API for containers labeled with the pod.label.key and pod.label.key specified -in etc/org.apache.karaf.cellar.kubernetes.cfg. So, you must be sure to label your containers (pods) -accordingly.1 +In order to determine the IP address of each node, so that Hazelcast can connect to them, the Kubernetes discovery service queries +the Kubernetes API for containers labeled with the _pod.label.key_ and _pod.label.key_ specified in _etc/org.apache.karaf.cellar.kubernetes.cfg_. +So, you *must be sure* to label your containers (pods) accordingly. -NOTE: All containers in a Kubernetes cluster can access said API at http://$KUBERNETES_RO_SERVICE_HOST:$KUBERNETES_RO_SERVICE_PORT, -since environment variables are injected into all Kubernetes containers) +*NOTE*: Since environment variables are injected into all Kubernetes containers, they can access said API at: + +{code} +http://$KUBERNETES_RO_SERVICE_HOST:$KUBERNETES_RO_SERVICE_PORT +{code} After a Cellar node starts up, Kubernetes discovery service will configure Hazelcast with currently running Cellar nodes. -Since Hazelcast follows a peer-to-peer all-shared topology, whenever nodes come up and down, the cluster will remain -up-to-date. +Since Hazelcast follows a peer-to-peer all-shared topology, whenever nodes come up and down, the cluster will remain up-to-date. h2. Installing Kubernetes discovery service @@ -48,7 +47,7 @@ karaf@root()> feature:install cellar-kubernetes {code} Once the feature is installed, a new configuration file for the Kubernetes discovery service will live in -etc/org.apache.karaf.cellar.kubernetes.cfg with the following contents: +_etc/org.apache.karaf.cellar.kubernetes.cfg_ with the following contents: {code} # @@ -58,4 +57,5 @@ pod.label.key = name pod.label.value = cellar {code} -In case you change the file, the discovery service will check again for new nodes. If new nodes are found, Hazelcast configuration will be updated and the instance restarted. \ No newline at end of file +In case you change the file, the discovery service will check again for new nodes. If new nodes are found, Hazelcast configuration will be +updated and the instance restarted. \ No newline at end of file From d9fcaefc34bd2f2725644865524abf692878bc44 Mon Sep 17 00:00:00 2001 From: Paulo Pires Date: Fri, 16 Jan 2015 10:40:00 +0000 Subject: [PATCH 3/3] Updated to new release of Fabric8 Kubernetes API which is more OSGi friendly. --- assembly/src/main/resources/features.xml | 16 ++-------------- pom.xml | 2 +- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/assembly/src/main/resources/features.xml b/assembly/src/main/resources/features.xml index 9bcf52907..61ad6ade8 100644 --- a/assembly/src/main/resources/features.xml +++ b/assembly/src/main/resources/features.xml @@ -16,7 +16,7 @@ mvn:org.apache.jclouds.karaf/jclouds-karaf/${jclouds.version}/xml/features - mvn:org.apache.cxf.karaf/apache-cxf/3.0.2/xml/features + mvn:io.fabric8/karaf-features/${fabric8.version}/xml/features @@ -103,19 +103,7 @@ mvn:org.apache.karaf.cellar/apache-karaf-cellar/${project.version}/cfg/kubernetes cellar-core - cxf-jaxrs - mvn:com.fasterxml.jackson.core/jackson-core/2.4.1 - mvn:com.fasterxml.jackson.core/jackson-annotations/2.4.1 - mvn:com.fasterxml.jackson.core/jackson-databind/2.4.1 - mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/2.4.1 - mvn:javax.validation/validation-api/1.1.0.Final - mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/2.4.1 - mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.4.1 - mvn:io.fabric8/fabric-utils/${fabric8.version} - mvn:commons-lang/commons-lang/2.6 - wrap:mvn:org.yaml/snakeyaml/1.5 - wrap:mvn:org.json/json/20140107 - mvn:io.fabric8/kubernetes-api/${fabric8.version} + fabric8-kubernetes-api mvn:org.apache.karaf.cellar/org.apache.karaf.cellar.kubernetes/${project.version} diff --git a/pom.xml b/pom.xml index ba3e23fcb..bd65732cc 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ 4.2.2 3.3.4 1.8.1 - 2.0.19 + 2.0.20 2.5 4.11 3.0.2