You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dm...@apache.org on 2017/02/14 01:29:33 UTC
ignite git commit: IGNITE-4160: added tests and documentation.
Repository: ignite
Updated Branches:
refs/heads/ignite-4159 8b970594e -> 7f4125d58
IGNITE-4160: added tests and documentation.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7f4125d5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7f4125d5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7f4125d5
Branch: refs/heads/ignite-4159
Commit: 7f4125d589bd958ba038a8b09967e9431482bcd7
Parents: 8b97059
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Feb 13 16:13:42 2017 -0800
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Feb 13 16:13:42 2017 -0800
----------------------------------------------------------------------
modules/kubernetes/DEVNOTES.txt | 63 +++++++++++++
modules/kubernetes/README.txt | 8 +-
modules/kubernetes/config/Dockerfile | 45 ++++++++++
modules/kubernetes/config/example-kube.xml | 44 +++++++++
.../kubernetes/config/ignite-deployment.yaml | 26 ++++++
modules/kubernetes/config/ignite-service.yaml | 14 +++
modules/kubernetes/config/run.sh | 50 +++++++++++
modules/kubernetes/pom.xml | 21 +++++
.../TcpDiscoveryKubernetesIpFinder.java | 93 ++++++++++++++------
.../tcp/ipfinder/kubernetes/package-info.java | 2 +-
.../tcp/ipfinder/gce/package-info.java | 22 -----
.../TcpDiscoveryKubernetesIpFinderSelfTest.java | 93 ++++++++++++++++++++
.../tcp/ipfinder/kubernetes/package-info.java | 22 +++++
.../testsuites/IgniteKubernetesTestSuite.java | 41 +++++++++
14 files changed, 489 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/modules/kubernetes/DEVNOTES.txt b/modules/kubernetes/DEVNOTES.txt
new file mode 100644
index 0000000..b2a8173
--- /dev/null
+++ b/modules/kubernetes/DEVNOTES.txt
@@ -0,0 +1,63 @@
+Building and testing Kubernetes module
+=========================================
+
+The instructions provide a guidance on how to build and test Ignite Kubernetes IP finder in Kubernetes environment.
+
+To test the IP finder you have to build the whole Apache Ignite project, package the binary as a Docker image and
+feed the image to your kubernetes environment.
+
+Building Apache Ignite
+=========================
+
+Use the command below to assemble an Apache Ignite binary:
+ mvn clean package -Prelease -Dignite.edition=fabric-lgpl -DskipTests
+
+Note, if you alter the build instruction somehow make sure to update the files under 'config' folder if needed.
+
+Installing Docker and Minikube
+==============================
+
+Install Docker and Minikube for testing purpose in your development environment.
+
+Once this is done, make sure that Minikube sees Docker images registered locally:
+ eval $(minikube docker-env)
+
+Start Minikube:
+ minikube start --vm-driver=xhyve
+
+Assembling Apache Ignite Docker Image
+=====================================
+
+Create a folder for all the files to be placed in the Docker image and copy the following there:
+ - Apache Ignite binary in a zip form built at the step above.
+ - Dockerfile from `ignite-kubernetes/config/Dockerfile`.
+ - Ignite configuration with enabled Kubernetes IP finder from `ignite-kubernetes/config/example-kube.xml`.
+ - The executable file that will start an Ignite node process from `ignite-kubernetes/config/run.sh`
+
+Go to the folder and execute a command below to prepare the image:
+ docker build -t ignite-kube:v1 .
+
+Creating containerized Ignite pods and Ignite lookup service
+============================================================
+
+Start the Kubernetes service that is used for IP addresses lookup. Use `ignite-kubernetes/config/ignite-service.yaml`:
+ kubectl create -f {path_to}/ignite-service.yaml
+
+Create and deploy Ignite pods using `ignite-kubernetes/config/ignite-deployment.yaml` configuration:
+ kubectl create -f {path_to}/ignite-deployment.yaml
+
+Make sure that the pods were deployed and running properly:
+ kubectl get pod
+ kubectl logs {pod name}
+
+Increase or decrease number of Ignite pods checking that Kubernetes IP finder works as expected:
+ kubectl scale --replicas=4 -f {path_to}/ignite-deployment.yaml
+
+Docker Image Redeployment
+=========================
+
+If you need to redeploy the docker image after it gets updated and you prefer not to change the image version then
+delete a current Kubernetes Ignite deployment (don't delete the service):
+ kubectl delete deployment ignite-cluster
+
+After that you are free to build and deploy an updated docker image using the same commands as listed above.
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/README.txt
----------------------------------------------------------------------
diff --git a/modules/kubernetes/README.txt b/modules/kubernetes/README.txt
index c2e23d6..a9a5a09 100644
--- a/modules/kubernetes/README.txt
+++ b/modules/kubernetes/README.txt
@@ -1,14 +1,14 @@
Apache Ignite Kubernetes Module
------------------------
-Apache Ignite Kubernetes module provides a TCP Discovery IP Finder that uses a Kubernetes Service
-to locate IPs of Apache Ignite nodes containerized by Kubernetes.
+Apache Ignite Kubernetes module provides a TCP Discovery IP Finder that uses a dedicated Kubernetes service
+for IP addresses lookup of Apache Ignite pods containerized by Kubernetes.
-To enable Kubernetes module when starting a standalone node, move 'optional/ignite-Kubernetes' folder to
+To enable Kubernetes module when starting a standalone node, move 'optional/ignite-kubernetes' folder to
'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
be added to classpath in this case.
-Importing GCE Module In Maven Project
+Importing Kubernetes Module In Maven Project
-------------------------------------
If you are using Maven to manage dependencies of your project, you can add Kubernetes module
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/config/Dockerfile
----------------------------------------------------------------------
diff --git a/modules/kubernetes/config/Dockerfile b/modules/kubernetes/config/Dockerfile
new file mode 100644
index 0000000..4e08ce8
--- /dev/null
+++ b/modules/kubernetes/config/Dockerfile
@@ -0,0 +1,45 @@
+# Use Java 8 image as default one.
+FROM java:8
+
+# Set Apache Ignite version.
+ENV IGNITE_VERSION 2.0.0-SNAPSHOT
+
+# Set IGNITE_HOME variable.
+ENV IGNITE_HOME /opt/ignite/apache-ignite-fabric-lgpl-${IGNITE_VERSION}-bin
+
+# Setting a path to an Apache Ignite configuration file. Used by run.sh script below.
+ENV CONFIG_URI ${IGNITE_HOME}/config/example-kube.xml
+
+# Make sure kubernetes lib is copied to 'libs' folder.
+ENV OPTION_LIBS ignite-kubernetes
+
+# Disabling quiet mode.
+ENV IGNITE_QUIET=false
+
+# Install or update needed tools.
+RUN apt-get update && apt-get install -y --no-install-recommends unzip
+
+# Creating and setting a working directory for following commands.
+WORKDIR /opt/ignite
+
+# Copying local Apache Ignite build to the docker image.
+COPY ./apache-ignite-fabric-lgpl-${IGNITE_VERSION}-bin.zip apache-ignite-fabric-lgpl-${IGNITE_VERSION}-bin.zip
+
+# Unpacking the build.
+RUN unzip apache-ignite-fabric-lgpl-${IGNITE_VERSION}-bin.zip
+RUN rm apache-ignite-fabric-lgpl-${IGNITE_VERSION}-bin.zip
+
+# Copying the executable file and setting permissions.
+COPY ./run.sh $IGNITE_HOME/
+RUN chmod +x $IGNITE_HOME/run.sh
+
+# Copying the configuration.
+COPY ./example-kube.xml $IGNITE_HOME/config
+
+# Starting an Apache Ignite node.
+CMD $IGNITE_HOME/run.sh
+
+# Exposing the ports.
+EXPOSE 11211 47100 47500 49112
+
+
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/config/example-kube.xml
----------------------------------------------------------------------
diff --git a/modules/kubernetes/config/example-kube.xml b/modules/kubernetes/config/example-kube.xml
new file mode 100644
index 0000000..bc04463
--- /dev/null
+++ b/modules/kubernetes/config/example-kube.xml
@@ -0,0 +1,44 @@
+<?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.
+-->
+
+<!--
+ Configuration example with Kubernetes IP finder enabled.
+-->
+<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">
+
+ <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+
+ <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <!--
+ Enables Kubernetes IP finder with default settings.
+ -->
+ <bean
+ class="org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder"/>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/config/ignite-deployment.yaml
----------------------------------------------------------------------
diff --git a/modules/kubernetes/config/ignite-deployment.yaml b/modules/kubernetes/config/ignite-deployment.yaml
new file mode 100644
index 0000000..ed5c102
--- /dev/null
+++ b/modules/kubernetes/config/ignite-deployment.yaml
@@ -0,0 +1,26 @@
+# An example of a Kubernetes configuration for Ignite pods deployment.
+apiVersion: extensions/v1beta1
+kind: Deployment
+metadata:
+ # Custom Ignite cluster's name.
+ name: ignite-cluster
+spec:
+ # Number of nodes to be started by Kubernetes initially.
+ replicas: 2
+ template:
+ metadata:
+ labels:
+ # Must be equal to Ignite's Kubernetes service name.
+ app: ignite
+ spec:
+ containers:
+ # Custom Ignite node's pod name.
+ - name: ignite-node
+ # Custom Ignite Docker image name.
+ image: ignite-kube:v1
+ ports:
+ # Ports to open.
+ - containerPort: 11211 # REST port number.
+ - containerPort: 47100 # communication SPI port number.
+ - containerPort: 47500 # discovery SPI port number.
+ - containerPort: 49112 # JMX port number.
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/config/ignite-service.yaml
----------------------------------------------------------------------
diff --git a/modules/kubernetes/config/ignite-service.yaml b/modules/kubernetes/config/ignite-service.yaml
new file mode 100644
index 0000000..07b7516
--- /dev/null
+++ b/modules/kubernetes/config/ignite-service.yaml
@@ -0,0 +1,14 @@
+# An example of a Kubernetes configuration for Ignite lookup service deployment.
+apiVersion: v1
+kind: Service
+metadata:
+ # Name of Ignite Service used by Kubernetes IP finder for IP addresses lookup.
+ # The name must be equal to TcpDiscoveryKubernetesIpFinder.setServiceName parameter.
+ name: ignite
+spec:
+ clusterIP: None
+ ports:
+ - port: 9042 # some custom port (optional).
+ selector:
+ # Must be equal to the label set for Ignite pods.
+ app: ignite
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/config/run.sh
----------------------------------------------------------------------
diff --git a/modules/kubernetes/config/run.sh b/modules/kubernetes/config/run.sh
new file mode 100644
index 0000000..dbf2871
--- /dev/null
+++ b/modules/kubernetes/config/run.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# 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.
+#
+
+if [ ! -z "$OPTION_LIBS" ]; then
+ IFS=, LIBS_LIST=("$OPTION_LIBS")
+
+ for lib in ${LIBS_LIST[@]}; do
+ cp -r $IGNITE_HOME/libs/optional/"$lib"/* \
+ $IGNITE_HOME/libs/
+ done
+fi
+
+if [ ! -z "$EXTERNAL_LIBS" ]; then
+ IFS=, LIBS_LIST=("$EXTERNAL_LIBS")
+
+ for lib in ${LIBS_LIST[@]}; do
+ echo $lib >> temp
+ done
+
+ wget -i temp -P $IGNITE_HOME/libs
+
+ rm temp
+fi
+
+QUIET=""
+
+if [ "$IGNITE_QUIET" = "false" ]; then
+ QUIET="-v"
+fi
+
+if [ -z $CONFIG_URI ]; then
+ $IGNITE_HOME/bin/ignite.sh $QUIET
+else
+ $IGNITE_HOME/bin/ignite.sh $QUIET $CONFIG_URI
+fi
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/pom.xml
----------------------------------------------------------------------
diff --git a/modules/kubernetes/pom.xml b/modules/kubernetes/pom.xml
index 9957d68..5d4e5f0 100644
--- a/modules/kubernetes/pom.xml
+++ b/modules/kubernetes/pom.xml
@@ -62,11 +62,32 @@
</dependency>
<dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
index 3c292e8..a5bd24f 100644
--- a/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
+++ b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
@@ -41,12 +41,42 @@ import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.resources.LoggerResource;
import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.ObjectMapper;
/**
- * Kubernetes Service based IP finder.
+ * IP finder for automatic lookup of Ignite nodes running in Kubernetes environment. All Ignite nodes have to deployed
+ * as Kubernetes pods in order to be discovered. An application that uses Ignite client nodes as a gateway to the
+ * cluster is required to be containerized as well. Applications and Ignite nodes running outside of Kubernetes will
+ * not be able to reach the containerized counterparts.
+ * <p>
+ * The implementation is based on a dedicated Kubernetes service that has to be created and should be deployed prior
+ * Ignite nodes startup. The service will maintain a list of all endpoints (internal IP addresses) of all containerized
+ * Ignite pods running so far. The name of the service must be equal to {@link #setServiceName(String)} which is
+ * `ignite` by default.
+ * <p>
+ * As for Ignite pods, it's recommended to label them in such a way that the service will use the label in its selector
+ * configuration excluding endpoints of irrelevant Kubernetes pods running in parallel.
+ * <p>
+ * The IP finder, in its turn, will call this service to retrieve Ignite pods IP addresses. The port will be
+ * either the one that is set with {@link TcpDiscoverySpi#setLocalPort(int)} or {@link TcpDiscoverySpi#DFLT_PORT}.
+ * Make sure that all Ignite pods occupy a similar discovery port, otherwise they will not be able to discover each
+ * other using this IP finder.
+ * <h2 class="header">Optional configuration</h2>
+ * <ul>
+ * <li>The Kubernetes service name for IP addresses lookup (see {@link #setServiceName(String)})</li>
+ * <li>The Kubernetes service namespace for IP addresses lookup (see {@link #setNamespace(String)}</li>
+ * <li>The host name of the Kubernetes API server (see {@link #setMasterUrl(String)})</li>
+ * <li>Path to the service token (see {@link #setAccountToken(String)}</li>
+ * </ul>
+ * <p>
+ * Both {@link #registerAddresses(Collection)} and {@link #unregisterAddresses(Collection)} have no effect.
+ * <p>
+ * Note, this IP finder is only workable when it used in Kubernetes environment.
+ * Choose another implementation of {@link org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder} for local
+ * or home network tests.
*/
public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter {
/** Grid logger. */
@@ -78,23 +108,23 @@ public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter
/** Ignite's Kubernetes Service name. */
private String serviceName = "ignite";
- /** Ignite Pod namespace name. */
+ /** Ignite Pod setNamespace name. */
private String namespace = "default";
- /** Kubernetes master URL. */
+ /** Kubernetes API server URL in a string form. */
private String master = "https://kubernetes.default.svc.cluster.local:443";
/** Account token location. */
private String accountToken = "/var/run/secrets/kubernetes.io/serviceaccount/token";
- /** Kubernets API URL. */
+ /** Kubernetes API server URL. */
private URL url;
/** SSL context */
private SSLContext ctx;
/**
- *
+ * Creates an instance of Kubernetes IP finder.
*/
public TcpDiscoveryKubernetesIpFinder() {
setShared(true);
@@ -154,43 +184,48 @@ public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter
}
/**
- * Sets the name of Ignite's Kubernetes Service where the IP finder will connect to in order to retrieve IP
- * addresses of existing Ignite pods.
+ * Sets the name of Kubernetes service for Ignite pods' IP addresses lookup. The name of the service must be equal
+ * to the name set in service's Kubernetes configuration. If this parameter is not changed then the name of the
+ * service has to be set to 'ignite' in the corresponding Kubernetes configuration.
*
- * @param service Ignite's Kubernetes Service name.
+ * @param service Kubernetes service name for IP addresses lookup. If it's not set then 'ignite' is used by default.
*/
- public void serviceName(String service) {
+ public void setServiceName(String service) {
this.serviceName = service;
}
/**
- * Sets the namespace name Ignite's Kubernetes Service belongs to.
- * If it is not set then 'default' is used as the namespace.
+ * Sets the namespace the Kubernetes service belongs to. By default, it's supposed that the service is running under
+ * Kubernetes `default` namespace.
*
- * @param namespace Ignite's Kubernetes Service namespace name.
+ * @param namespace The Kubernetes service namespace for IP addresses lookup.
*/
- public void namespace(String namespace) {
+ public void setNamespace(String namespace) {
this.namespace = namespace;
}
/**
- * Sets Kubernetes master's URL. By default 'kubernetes.default.svc' is used.
+ * Sets the host name of the Kubernetes API server. By default the following host name is used:
+ * 'https://kubernetes.default.svc.cluster.local:443'.
*
- * @param master URL string of Kubernetes master.
+ * @param master The host name of the Kubernetes API server.
*/
- public void masterUrl(String master) {
+ public void setMasterUrl(String master) {
this.master = master;
}
/**
- * @param accountToken
+ * Specifies the path to the service token file. By default the following account token is used:
+ * '/var/run/secrets/kubernetes.io/serviceaccount/token'.
+ *
+ * @param accountToken The path to the service token file.
*/
- public void accountToken(String accountToken) {
+ public void setAccountToken(String accountToken) {
this.accountToken = accountToken;
}
/**
- * Kubernetes IP finder initalization.
+ * Kubernetes IP finder initialization.
*
* @throws IgniteSpiException In case of error.
*/
@@ -202,9 +237,9 @@ public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter
master == null || master.isEmpty() ||
accountToken == null || accountToken.isEmpty()) {
throw new IgniteSpiException(
- "One or more configuration parameters are invalid [serviceName=" +
- serviceName + ", namespace=" + namespace + ", masterUrl=" +
- master + ", accountToken=" + accountToken + "]");
+ "One or more configuration parameters are invalid [setServiceName=" +
+ serviceName + ", setNamespace=" + namespace + ", setMasterUrl=" +
+ master + ", setAccountToken=" + accountToken + "]");
}
try {
@@ -238,19 +273,21 @@ public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter
}
/**
- * @param file
- * @return
+ * Reads content of the service account token file.
+ *
+ * @param file The path to the service account token.
+ * @return Service account token.
*/
private String serviceAccountToken(String file) {
try {
return new String(Files.readAllBytes(Paths.get(file)));
} catch (IOException e) {
- throw new IgniteSpiException("Failed to load services account token [accountToken= " + file + "]", e);
+ throw new IgniteSpiException("Failed to load services account token [setAccountToken= " + file + "]", e);
}
}
/**
- *
+ * Object used by Jackson for processing of Kubernetes lookup service's response.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
private static class Address {
@@ -259,7 +296,7 @@ public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter
}
/**
- *
+ * Object used by Jackson for processing of Kubernetes lookup service's response.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
private static class Subset {
@@ -268,7 +305,7 @@ public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter
}
/**
- *
+ * Object used by Jackson for processing of Kubernetes lookup service's response.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
private static class Endpoints {
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
index 6b42121..a572cb2 100644
--- a/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
+++ b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
@@ -17,6 +17,6 @@
/**
* <!-- Package description. -->
- * Contains Google Cloud Storage IP finder.
+ * Contains Kubernetes IP finder implementation.
*/
package org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/package-info.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/package-info.java b/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/package-info.java
deleted file mode 100644
index 4d33114..0000000
--- a/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains Google Cloud Storage IP finder internal tests.
- */
-package org.apache.ignite.spi.discovery.tcp.ipfinder.gce;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinderSelfTest.java b/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinderSelfTest.java
new file mode 100644
index 0000000..fd3e2a3
--- /dev/null
+++ b/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinderSelfTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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.ignite.spi.discovery.tcp.ipfinder.kubernetes;
+
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAbstractSelfTest;
+
+/**
+ * TcpDiscoveryKubernetesIpFinder test.
+ */
+public class TcpDiscoveryKubernetesIpFinderSelfTest extends
+ TcpDiscoveryIpFinderAbstractSelfTest<TcpDiscoveryKubernetesIpFinder> {
+ /**
+ * Constructor.
+ *
+ * @throws Exception If any error occurs.
+ */
+ public TcpDiscoveryKubernetesIpFinderSelfTest() throws Exception {
+ // No-op.
+ }
+
+ @Override protected void beforeTest() throws Exception {
+ // No-op.
+ }
+
+ /* {@inheritDoc} */
+ @Override protected TcpDiscoveryKubernetesIpFinder ipFinder() throws Exception {
+ // No-op.
+ return null;
+ }
+
+ /* {@inheritDoc} */
+ @Override public void testIpFinder() throws Exception {
+ TcpDiscoveryKubernetesIpFinder ipFinder = new TcpDiscoveryKubernetesIpFinder();
+
+ ipFinder.setAccountToken(null);
+
+ try {
+ ipFinder.getRegisteredAddresses();
+ }
+ catch (IgniteSpiException e) {
+ assertTrue(e.getMessage().startsWith("One or more configuration parameters are invalid"));
+ }
+
+ ipFinder = new TcpDiscoveryKubernetesIpFinder();
+
+ ipFinder.setMasterUrl(null);
+
+ try {
+ ipFinder.getRegisteredAddresses();
+ }
+ catch (IgniteSpiException e) {
+ assertTrue(e.getMessage().startsWith("One or more configuration parameters are invalid"));
+ }
+
+ ipFinder = new TcpDiscoveryKubernetesIpFinder();
+
+ ipFinder.setNamespace(null);
+
+ try {
+ ipFinder.getRegisteredAddresses();
+ }
+ catch (IgniteSpiException e) {
+ assertTrue(e.getMessage().startsWith("One or more configuration parameters are invalid"));
+ }
+
+ ipFinder = new TcpDiscoveryKubernetesIpFinder();
+
+ ipFinder.setServiceName("");
+
+ try {
+ ipFinder.getRegisteredAddresses();
+ }
+ catch (IgniteSpiException e) {
+ assertTrue(e.getMessage().startsWith("One or more configuration parameters are invalid"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java b/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
new file mode 100644
index 0000000..83ab56f
--- /dev/null
+++ b/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains Kubernetes IP finder internal tests.
+ */
+package org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4125d5/modules/kubernetes/src/test/java/org/apache/ignite/testsuites/IgniteKubernetesTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/test/java/org/apache/ignite/testsuites/IgniteKubernetesTestSuite.java b/modules/kubernetes/src/test/java/org/apache/ignite/testsuites/IgniteKubernetesTestSuite.java
new file mode 100644
index 0000000..540657e
--- /dev/null
+++ b/modules/kubernetes/src/test/java/org/apache/ignite/testsuites/IgniteKubernetesTestSuite.java
@@ -0,0 +1,41 @@
+/*
+ * 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.ignite.testsuites;
+
+
+import junit.framework.TestSuite;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinderSelfTest;
+import org.apache.ignite.testframework.IgniteTestSuite;
+
+/**
+ * Ignite Kubernetes integration test.
+ */
+public class IgniteKubernetesTestSuite extends TestSuite {
+ /**
+ * @return Test suite.
+ * @throws Exception Thrown in case of the failure.
+ */
+ public static TestSuite suite() throws Exception {
+ TestSuite suite = new IgniteTestSuite("Kubernetes Integration Test Suite");
+
+ // Cloud Nodes IP finder.
+ suite.addTestSuite(TcpDiscoveryKubernetesIpFinderSelfTest.class);
+
+ return suite;
+ }
+}
\ No newline at end of file