You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ga...@apache.org on 2015/08/27 14:15:16 UTC
[09/12] stratos git commit: Upgrading fabric8 kubernetes api version
to 2.2.16 and removing forked code
Upgrading fabric8 kubernetes api version to 2.2.16 and removing forked code
Conflicts:
dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/AbstractWatcher.java
dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/ExceptionResponseMapper.java
dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesApiException.java
dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Watcher.java
dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/Dockerfile
dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/kubernetes.html
dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/kubernetes.raml
dependencies/fabric8/kubernetes-api/src/main/resources/log4j.properties
dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchBuilds.java
dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchBuildsExample.java
dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchPodsExample.java
dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchServicesExample.java
dependencies/fabric8/kubernetes-api/src/test/resources/config.yml
dependencies/fabric8/kubernetes-api/src/test/resources/glance-api-service.yaml
dependencies/fabric8/kubernetes-model/pom.xml
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/KubernetesBaseConfig.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/KubernetesConfig.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/OpenshiftConfig.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/HasMetadata.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesKind.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesList.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResource.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/resource/Quantity.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/util/IntOrString.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/HasMetadataComparator.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/HasMetadataSet.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/KubernetesDeserializer.java
dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/openshift/api/model/template/Template.java
dependencies/fabric8/kubernetes-model/src/main/resources/log4j.properties
dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/InlineTest.java
dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/KubernetesListTest.java
dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/UnmarshallTest.java
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/12c0ea00
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/12c0ea00
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/12c0ea00
Branch: refs/heads/tenant-isolation
Commit: 12c0ea00691ecbfce920db3022816aa8752ac3b5
Parents: ad9b2c2
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sun Jul 26 05:42:14 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Thu Aug 27 16:42:54 2015 +0530
----------------------------------------------------------------------
.../org.apache.stratos.cloud.controller/pom.xml | 2 +-
.../iaases/kubernetes/KubernetesIaas.java | 12 +-
.../pom.xml | 4 +-
.../kubernetes/client/KubernetesApiClient.java | 31 +-
.../kubernetes/client/KubernetesConstants.java | 1 +
.../KubernetesAPIClientInterface.java | 8 +-
.../client/live/AbstractLiveTest.java | 15 +-
dependencies/fabric8/kubernetes-api/README.md | 10 +-
dependencies/fabric8/kubernetes-api/pom.xml | 68 +-
.../fabric8/kubernetes/api/AbstractWatcher.java | 61 -
.../io/fabric8/kubernetes/api/Controller.java | 850 ----
.../java/io/fabric8/kubernetes/api/Entity.java | 28 -
.../kubernetes/api/ExceptionResponseMapper.java | 69 -
.../io/fabric8/kubernetes/api/Kubernetes.java | 283 --
.../kubernetes/api/KubernetesApiException.java | 11 -
.../kubernetes/api/KubernetesClient.java | 1618 ------
.../kubernetes/api/KubernetesExtensions.java | 226 -
.../kubernetes/api/KubernetesFactory.java | 384 --
.../api/KubernetesGlobalExtensions.java | 56 -
.../kubernetes/api/KubernetesHelper.java | 1724 -------
.../fabric8/kubernetes/api/PodStatusType.java | 25 -
.../io/fabric8/kubernetes/api/ServiceNames.java | 58 -
.../api/UserConfigurationCompare.java | 201 -
.../java/io/fabric8/kubernetes/api/Watcher.java | 13 -
.../api/builders/ListEnvVarBuilder.java | 43 -
.../api/builds/BuildFinishedEvent.java | 64 -
.../kubernetes/api/builds/BuildListener.java | 30 -
.../kubernetes/api/builds/BuildWatcher.java | 121 -
.../fabric8/kubernetes/api/builds/Builds.java | 199 -
.../io/fabric8/kubernetes/api/builds/Links.java | 35 -
.../kubernetes/api/extensions/Configs.java | 117 -
.../kubernetes/api/extensions/Templates.java | 225 -
.../api/support/KindToClassMapping.java | 264 -
.../src/main/kubernetes/api/Dockerfile | 5 -
.../api/examples/controller-list.json | 35 -
.../kubernetes/api/examples/controller.json | 24 -
.../api/examples/external-service.json | 13 -
.../src/main/kubernetes/api/examples/list.json | 98 -
.../api/examples/pod-list-empty-results.json | 19 -
.../main/kubernetes/api/examples/pod-list.json | 93 -
.../src/main/kubernetes/api/examples/pod.json | 34 -
.../kubernetes/api/examples/service-list.json | 28 -
.../main/kubernetes/api/examples/service.json | 33 -
.../main/kubernetes/api/examples/template.json | 146 -
.../src/main/kubernetes/api/kubernetes.html | 1636 ------
.../src/main/kubernetes/api/kubernetes.raml | 185 -
.../src/main/resources/log4j.properties | 8 -
.../java/io/fabric8/kubernetes/api/Apply.java | 48 -
.../kubernetes/api/ConfigComparePodTest.java | 243 -
.../ConfigCompareReplicationControllerTest.java | 530 --
.../api/ConfigCompareServiceTest.java | 235 -
.../kubernetes/api/ConfigFileParseTest.java | 58 -
.../java/io/fabric8/kubernetes/api/Example.java | 134 -
.../api/FindOpenShiftNamespaceTest.java | 41 -
.../kubernetes/api/KubernetesHelperTest.java | 71 -
.../kubernetes/api/ParseDateTimeTest.java | 36 -
.../kubernetes/api/ParseExamplesTest.java | 128 -
.../kubernetes/api/ParseServiceTest.java | 65 -
.../io/fabric8/kubernetes/api/ParseTest.java | 157 -
.../PodIdToReplicationControllerIDExample.java | 42 -
.../api/ProcessTemplateLocallyTest.java | 54 -
.../fabric8/kubernetes/api/TemplatesTest.java | 50 -
.../io/fabric8/kubernetes/api/TriggerBuild.java | 45 -
.../kubernetes/api/UsingBadAddressTest.java | 47 -
.../fabric8/kubernetes/api/ViewEndpoints.java | 88 -
.../io/fabric8/kubernetes/api/ViewNodes.java | 61 -
.../fabric8/kubernetes/api/ViewServiceIPs.java | 45 -
.../io/fabric8/kubernetes/api/WatchBuilds.java | 52 -
.../kubernetes/api/WatchBuildsExample.java | 23 -
.../kubernetes/api/WatchPodsExample.java | 23 -
.../kubernetes/api/WatchServicesExample.java | 23 -
.../src/test/resources/config.yml | 52 -
.../src/test/resources/errorexample.json | 77 -
.../src/test/resources/fmq-service.json | 20 -
.../src/test/resources/glance-api-service.yaml | 7 -
.../src/test/resources/log4j.properties | 25 -
dependencies/fabric8/kubernetes-model/README.md | 7 -
dependencies/fabric8/kubernetes-model/pom.xml | 176 -
.../io/fabric8/config/KubernetesBaseConfig.java | 14 -
.../io/fabric8/config/KubernetesConfig.java | 81 -
.../java/io/fabric8/config/OpenshiftConfig.java | 67 -
.../kubernetes/api/model/HasMetadata.java | 7 -
.../kubernetes/api/model/KubernetesKind.java | 71 -
.../kubernetes/api/model/KubernetesList.java | 49 -
.../api/model/KubernetesResource.java | 8 -
.../kubernetes/api/model/resource/Quantity.java | 135 -
.../kubernetes/api/model/util/IntOrString.java | 195 -
.../internal/HasMetadataComparator.java | 30 -
.../kubernetes/internal/HasMetadataSet.java | 25 -
.../internal/KubernetesDeserializer.java | 33 -
.../openshift/api/model/template/Template.java | 306 --
.../src/main/resources/log4j.properties | 8 -
.../src/main/resources/schema/kube-schema.json | 4692 ------------------
.../kubernetes/api/model/InlineTest.java | 18 -
.../api/model/KubernetesListTest.java | 85 -
.../kubernetes/api/model/UnmarshallTest.java | 66 -
.../src/test/resources/service-list.json | 239 -
.../src/test/resources/simple-list.json | 64 -
.../src/test/resources/simple-template.json | 45 -
.../src/test/resources/valid-pod.json | 22 -
dependencies/fabric8/pom.xml | 1 -
.../pom.xml | 10 +-
pom.xml | 2 +
103 files changed, 61 insertions(+), 18088 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/components/org.apache.stratos.cloud.controller/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/pom.xml b/components/org.apache.stratos.cloud.controller/pom.xml
index 1e5ff3f..8828226 100644
--- a/components/org.apache.stratos.cloud.controller/pom.xml
+++ b/components/org.apache.stratos.cloud.controller/pom.xml
@@ -317,7 +317,7 @@
<dependency>
<groupId>org.apache.stratos</groupId>
<artifactId>kubernetes-api</artifactId>
- <version>2.1.11-stratosv1</version>
+ <version>${kubernetes.api.stratos.version}</version>
</dependency>
</dependencies>
<properties>
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
index 387d67d..4dcc472 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
@@ -520,13 +520,13 @@ public class KubernetesIaas extends Iaas {
}
// Create kubernetes service for port mapping
- int servicePort = clusterPortMapping.getKubernetesServicePort();
+ int nodePort = clusterPortMapping.getKubernetesServicePort();
String containerPortName = KubernetesIaasUtil.preparePortNameFromPortMapping(clusterPortMapping);
try {
// Services need to use minions private IP addresses for creating iptable rules
- kubernetesApi.createService(serviceId, serviceLabel, servicePort, containerPortName,
- containerPort, minionPrivateIPList, sessionAffinity);
+ kubernetesApi.createService(serviceId, serviceLabel, nodePort, containerPortName,
+ containerPort, sessionAffinity);
} finally {
// Persist kubernetes service sequence no
CloudControllerContext.getInstance().persist();
@@ -541,7 +541,7 @@ public class KubernetesIaas extends Iaas {
KubernetesService kubernetesService = new KubernetesService();
kubernetesService.setId(service.getMetadata().getName());
- kubernetesService.setPortalIP(service.getSpec().getPortalIP());
+ kubernetesService.setPortalIP(service.getSpec().getClusterIP());
// Expose minions public IP addresses as they need to be accessed by external networks
String[] minionPublicIPArray = minionPublicIPList.toArray(new String[minionPublicIPList.size()]);
kubernetesService.setPublicIPs(minionPublicIPArray);
@@ -552,8 +552,8 @@ public class KubernetesIaas extends Iaas {
if (log.isInfoEnabled()) {
log.info(String.format("Kubernetes service successfully created: [cluster] %s [service] %s " +
- "[protocol] %s [service-port] %d [container-port] %s", clusterId,
- serviceId, clusterPortMapping.getProtocol(), servicePort, containerPort));
+ "[protocol] %s [node-port] %d [container-port] %s", clusterId,
+ serviceId, clusterPortMapping.getProtocol(), nodePort, containerPort));
}
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/components/org.apache.stratos.kubernetes.client/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.kubernetes.client/pom.xml b/components/org.apache.stratos.kubernetes.client/pom.xml
index 4f5cd8e..287688b 100644
--- a/components/org.apache.stratos.kubernetes.client/pom.xml
+++ b/components/org.apache.stratos.kubernetes.client/pom.xml
@@ -52,7 +52,7 @@
<dependency>
<groupId>org.apache.stratos</groupId>
<artifactId>kubernetes-api</artifactId>
- <version>2.1.11-stratosv1</version>
+ <version>${kubernetes.api.stratos.version}</version>
</dependency>
</dependencies>
@@ -71,7 +71,7 @@
org.apache.stratos.kubernetes.client.exceptions,
</Export-Package>
<Import-Package>
- io.fabric8.kubernetes.api.*;version=2.1.11-stratosv1,
+ io.fabric8.kubernetes.api.*;version=${kubernetes.api.stratos.version},
*;resolution:=optional
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesApiClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesApiClient.java b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesApiClient.java
index 112f843..f176cd9 100644
--- a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesApiClient.java
+++ b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesApiClient.java
@@ -22,8 +22,6 @@ package org.apache.stratos.kubernetes.client;
import io.fabric8.kubernetes.api.KubernetesClient;
import io.fabric8.kubernetes.api.model.*;
-import io.fabric8.kubernetes.api.model.resource.Quantity;
-import io.fabric8.kubernetes.api.model.util.IntOrString;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.kubernetes.client.exceptions.KubernetesClientException;
@@ -71,7 +69,7 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface {
// Create pod definition
Pod pod = new Pod();
- pod.setApiVersion(Pod.ApiVersion.V_1_BETA_3);
+ pod.setApiVersion(Pod.ApiVersion.V_1);
pod.setKind(KubernetesConstants.KIND_POD);
pod.setSpec(new PodSpec());
@@ -157,23 +155,21 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface {
*
* @param serviceId Service id
* @param serviceLabel Service name to be used by the label name
- * @param servicePort Port to be exposed by the service
+ * @param nodePort Port to be exposed by the kubernetes node
* @param containerPortName Container port name defined in the port label
* @param containerPort Container port
- * @param publicIPs Public IP addresses of the minions
* @param sessionAffinity Session affinity configuration
* @throws KubernetesClientException
*/
@Override
- public void createService(String serviceId, String serviceLabel, int servicePort,
- String containerPortName, int containerPort, List<String> publicIPs,
- String sessionAffinity)
+ public void createService(String serviceId, String serviceLabel, int nodePort,
+ String containerPortName, int containerPort, String sessionAffinity)
throws KubernetesClientException {
try {
if (log.isDebugEnabled()) {
log.debug(String.format("Creating kubernetes service: [service-id] %s [service-name] %s [service-port] %d " +
- "[container-port-name] %s", serviceId, serviceLabel, servicePort,
+ "[container-port-name] %s", serviceId, serviceLabel, nodePort,
containerPortName));
}
@@ -182,19 +178,20 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface {
service.setSpec(new ServiceSpec());
service.setMetadata(new ObjectMeta());
- service.setApiVersion(Service.ApiVersion.V_1_BETA_3);
+ service.setApiVersion(Service.ApiVersion.V_1);
service.setKind(KubernetesConstants.KIND_SERVICE);
service.getMetadata().setName(serviceId);
- service.getSpec().setPublicIPs(publicIPs);
service.getSpec().setSessionAffinity(sessionAffinity);
+ service.getSpec().setType(KubernetesConstants.NODE_PORT);
// Set port
List<ServicePort> ports = new ArrayList<ServicePort>();
ServicePort port = new ServicePort();
port.setName(containerPortName);
- port.setPort(servicePort);
+ port.setPort(containerPort);
port.setTargetPort(new IntOrString(containerPort));
+ port.setNodePort(nodePort);
ports.add(port);
service.getSpec().setPorts(ports);
@@ -212,12 +209,14 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface {
kubernetesClient.createService(service);
if (log.isDebugEnabled()) {
- log.debug(String.format("Kubernetes service created successfully: [service-id] %s [service-name] %s [service-port] %d " +
- "[container-port-name] %s", serviceId, serviceLabel, servicePort, containerPortName));
+ log.debug(String.format("Kubernetes service created successfully: [service-id] %s [service-name] %s " +
+ "[node-port] %d [container-port-name] %s [container-port] %d", serviceId, serviceLabel,
+ nodePort, containerPortName, containerPort));
}
} catch (Exception e) {
- String message = String.format("Could not create kubernetes service: [service-id] %s [service-name] %s [service-port] %d " +
- "[container-port-name] %s", serviceId, serviceLabel, servicePort, containerPortName);
+ String message = String.format("Could not create kubernetes service: [service-id] %s [service-name] %s " +
+ "[node-port] %d [container-port-name] %s [container-port] %d", serviceId, serviceLabel,
+ nodePort, containerPortName, containerPort);
log.error(message, e);
throw new KubernetesClientException(message, e);
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesConstants.java b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesConstants.java
index 4b5210a..9c8fc7a 100644
--- a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesConstants.java
+++ b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesConstants.java
@@ -32,4 +32,5 @@ public class KubernetesConstants {
public static final String LABEL_NAME = "name";
public static final String RESOURCE_CPU = "cpu";
public static final String RESOURCE_MEMORY = "memory";
+ public static final String NODE_PORT = "NodePort";
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/interfaces/KubernetesAPIClientInterface.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/interfaces/KubernetesAPIClientInterface.java b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/interfaces/KubernetesAPIClientInterface.java
index 26772fc..6741d6b 100644
--- a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/interfaces/KubernetesAPIClientInterface.java
+++ b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/interfaces/KubernetesAPIClientInterface.java
@@ -76,16 +76,14 @@ public interface KubernetesAPIClientInterface {
*
* @param serviceId
* @param serviceLabel
- * @param servicePort
+ * @param nodePort
* @param containerPortName
* @param containerPort
- * @param publicIPs
* @param sessionAffinity
* @throws KubernetesClientException
*/
- public void createService(String serviceId, String serviceLabel, int servicePort,
- String containerPortName, int containerPort, List<String> publicIPs,
- String sessionAffinity)
+ public void createService(String serviceId, String serviceLabel, int nodePort,
+ String containerPortName, int containerPort, String sessionAffinity)
throws KubernetesClientException;
/**
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/AbstractLiveTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/AbstractLiveTest.java b/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/AbstractLiveTest.java
index 29b7ed4..293723c 100644
--- a/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/AbstractLiveTest.java
+++ b/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/AbstractLiveTest.java
@@ -19,11 +19,7 @@
package org.apache.stratos.kubernetes.client.live;
-import io.fabric8.kubernetes.api.model.Container;
-import io.fabric8.kubernetes.api.model.ContainerPort;
-import io.fabric8.kubernetes.api.model.Pod;
-import io.fabric8.kubernetes.api.model.Service;
-import io.fabric8.kubernetes.api.model.resource.Quantity;
+import io.fabric8.kubernetes.api.model.*;
import junit.framework.TestCase;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -53,7 +49,7 @@ public class AbstractLiveTest extends TestCase {
protected static final String DEFAULT_DOCKER_IMAGE = "fnichol/uhttpd";
protected static final int DEFAULT_CONTAINER_PORT = 80;
- protected static final int SERVICE_PORT = 4500;
+ protected static final int SERVICE_PORT = 30001;
protected static final int POD_ACTIVATION_WAIT_TIME = 10000; // 10 seconds
protected static final String KUBERNETES_API_ENDPOINT = "kubernetes.api.endpoint";
@@ -62,6 +58,7 @@ public class AbstractLiveTest extends TestCase {
protected static final String CONTAINER_PORT = "container.port";
protected static final String TEST_SERVICE_SOCKET = "test.service.socket";
protected static final String TEST_POD_ACTIVATION = "test.pod.activation";
+ protected static final String PROTOCOL_TCP = "TCP";
protected KubernetesApiClient client;
protected String dockerImage;
@@ -199,10 +196,10 @@ public class AbstractLiveTest extends TestCase {
}
}
- protected void createService(String serviceId, String serviceName, int servicePort, String containerPortName,
+ protected void createService(String serviceId, String serviceName, int nodePort, String containerPortName,
int containerPort, List<String> publicIPs) throws KubernetesClientException, InterruptedException, IOException {
log.info("Creating service...");
- client.createService(serviceId, serviceName, servicePort, containerPortName, containerPort, publicIPs,
+ client.createService(serviceId, serviceName, nodePort, containerPortName, containerPort,
KubernetesConstants.SESSION_AFFINITY_CLIENT_IP);
serviceIdList.add(serviceId);
@@ -248,7 +245,7 @@ public class AbstractLiveTest extends TestCase {
ContainerPort port = new ContainerPort();
port.setName(containerPortName);
port.setContainerPort(containerPort);
- port.setProtocol("tcp");
+ port.setProtocol(PROTOCOL_TCP);
ports.add(port);
return ports;
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/README.md
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/README.md b/dependencies/fabric8/kubernetes-api/README.md
index 1f8c473..1573883 100644
--- a/dependencies/fabric8/kubernetes-api/README.md
+++ b/dependencies/fabric8/kubernetes-api/README.md
@@ -1,7 +1,5 @@
-## Fabric8 Kubernetes Client API
-
-Fabric8 Kubernetes Client API 2.1.11 has been forked to fix issue [1]. The fix has been merged to master branch,
-once the next Fabric8 release is published to Nexus this fork can be removed.
-
-[1] [origin-schema-generator/pull/50] (https://github.com/fabric8io/origin-schema-generator/pull/50)
+## Fabric8 Kubernetes API
+This is a wrapper bundle for Fabric8 Kubernetes API for exposing proper bundle import
+& export statements and packaging apache cxf dependencies which cannot be imported into
+carbon runtime as separate bundles at the moment.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/pom.xml
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/pom.xml b/dependencies/fabric8/kubernetes-api/pom.xml
index 936935a..feec23b 100644
--- a/dependencies/fabric8/kubernetes-api/pom.xml
+++ b/dependencies/fabric8/kubernetes-api/pom.xml
@@ -27,21 +27,31 @@
</parent>
<artifactId>kubernetes-api</artifactId>
- <version>2.1.11-stratosv1</version>
+ <version>${kubernetes.api.stratos.version}</version>
<packaging>bundle</packaging>
<name>Fabric8 :: Kubernetes API</name>
+ <description>
+ This is a wrapper bundle for Fabric8 Kubernetes API for exposing proper bundle import
+ & export statements and packaging apache cxf dependencies which cannot be imported into
+ carbon runtime as separate bundles at the moment.
+ </description>
<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
+ <artifactId>kubernetes-api</artifactId>
+ <version>${kubernetes.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.fabric8</groupId>
<artifactId>cxf-utils</artifactId>
- <version>2.1.11</version>
+ <version>${fabric8-version}</version>
</dependency>
<dependency>
- <groupId>org.apache.stratos</groupId>
+ <groupId>io.fabric8</groupId>
<artifactId>kubernetes-model</artifactId>
- <version>2.1.11-stratosv1</version>
+ <version>1.0.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
@@ -98,11 +108,6 @@
<artifactId>jetty-util</artifactId>
<version>9.1.5.v20140505</version>
</dependency>
- <!-- dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.0.1</version>
- </dependency -->
<!-- testing -->
<dependency>
<groupId>org.assertj</groupId>
@@ -120,7 +125,7 @@
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-codegen</artifactId>
- <version>2.1.11</version>
+ <version>${fabric8-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -136,7 +141,7 @@
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Export-Package>
- io.fabric8.kubernetes.api.*,
+ io.fabric8.kubernetes.api.*;version=${kubernetes.api.stratos.version},
</Export-Package>
<Import-Package>
!javax.xml.bind.annotation.adapters,
@@ -144,7 +149,6 @@
*;resolution:=optional
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
- <!-- Embedding apache cxf dependencies as they cannot be imported into carbon runtime at the moment -->
<Embed-Dependency>
jackson-annotations,jackson-core,jackson-databind,jackson-jaxrs-base,jackson-jaxrs-json-provider,
jackson-module-jaxb-annotations,jackson-dataformat-yaml,javax.annotation-api,javax.ws.rs-api,
@@ -174,41 +178,7 @@
</plugins>
</build>
-
- <profiles>
- <profile>
- <id>trigger</id>
- <properties>
- <build>console-build</build>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>${exec-maven-plugin.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>exec</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <executable>java</executable>
- <classpathScope>test</classpathScope>
- <!-- TODO for some reason this fails when running inside maven - wacky! -->
- <arguments>
- <argument>-classpath</argument>
- <classpath />
- <argument>io.fabric8.kubernetes.api.TriggerBuild</argument>
- <argument>${build}</argument>
- </arguments>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ <properties>
+ <fabric8-version>2.2.16</fabric8-version>
+ </properties>
</project>
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/AbstractWatcher.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/AbstractWatcher.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/AbstractWatcher.java
deleted file mode 100644
index 68793bc..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/AbstractWatcher.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package io.fabric8.kubernetes.api;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.fabric8.kubernetes.api.model.HasMetadata;
-import io.fabric8.kubernetes.api.watch.WatchEvent;
-import org.eclipse.jetty.websocket.api.Session;
-import org.eclipse.jetty.websocket.api.UpgradeException;
-import org.eclipse.jetty.websocket.api.WebSocketAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-public abstract class AbstractWatcher<T extends HasMetadata> extends WebSocketAdapter implements Watcher<T> {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(KubernetesClient.class);
-
- private ObjectMapper objectMapper;
-
- @Override
- public void onWebSocketConnect(Session sess) {
- super.onWebSocketConnect(sess);
- LOG.debug("Got connect: {}", sess);
- objectMapper = KubernetesFactory.createObjectMapper();
- }
-
- @Override
- public void onWebSocketClose(int statusCode, String reason) {
- super.onWebSocketClose(statusCode, reason);
- LOG.debug("Connection closed: {} - {}", statusCode, reason);
- objectMapper = null;
- }
-
- @Override
- public void onWebSocketText(String message) {
- LOG.trace("Received message: {}", message);
- if (message != null && message.length() > 0) {
- try {
- WatchEvent event = objectMapper.reader(WatchEvent.class).readValue(message);
- T obj = (T) event.getObject();
- Action action = Action.valueOf(event.getType());
- eventReceived(action, obj);
- } catch (IOException e) {
- LOG.error("Could not deserialize watch event: {}", message, e);
- } catch (ClassCastException e) {
- LOG.error("Received wrong type of object for watch", e);
- } catch (IllegalArgumentException e) {
- LOG.error("Invalid event type", e);
- }
- }
- }
-
- public void onWebSocketError(Throwable cause) {
- if (cause instanceof UpgradeException) {
- LOG.error("WebSocketError: Could not upgrade connection: {}", (((UpgradeException) cause).getResponseStatusCode()), cause);
- } else {
- LOG.error("WebSocketError: {}", cause);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Controller.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Controller.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Controller.java
deleted file mode 100644
index 3e90776..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Controller.java
+++ /dev/null
@@ -1,850 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- *
- * Red Hat 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 io.fabric8.kubernetes.api;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import io.fabric8.kubernetes.api.extensions.Templates;
-import io.fabric8.kubernetes.api.model.HasMetadata;
-import io.fabric8.kubernetes.api.model.KubernetesList;
-import io.fabric8.kubernetes.api.model.Namespace;
-import io.fabric8.kubernetes.api.model.Pod;
-import io.fabric8.kubernetes.api.model.PodSpec;
-import io.fabric8.kubernetes.api.model.PodTemplateSpec;
-import io.fabric8.kubernetes.api.model.ReplicationController;
-import io.fabric8.kubernetes.api.model.ReplicationControllerSpec;
-import io.fabric8.kubernetes.api.model.SecretVolumeSource;
-import io.fabric8.kubernetes.api.model.Service;
-import io.fabric8.kubernetes.api.model.Volume;
-import io.fabric8.openshift.api.model.BuildConfig;
-import io.fabric8.openshift.api.model.DeploymentConfig;
-import io.fabric8.openshift.api.model.ImageStream;
-import io.fabric8.openshift.api.model.OAuthClient;
-import io.fabric8.openshift.api.model.Route;
-import io.fabric8.openshift.api.model.template.Template;
-import io.fabric8.utils.Files;
-import io.fabric8.utils.IOHelpers;
-import io.fabric8.utils.Objects;
-import io.fabric8.utils.Strings;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.yaml.snakeyaml.Yaml;
-
-import javax.ws.rs.WebApplicationException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.getName;
-import static io.fabric8.kubernetes.api.KubernetesHelper.getObjectId;
-import static io.fabric8.kubernetes.api.KubernetesHelper.getOrCreateMetadata;
-import static io.fabric8.kubernetes.api.KubernetesHelper.getPodMap;
-import static io.fabric8.kubernetes.api.KubernetesHelper.getReplicationControllerMap;
-import static io.fabric8.kubernetes.api.KubernetesHelper.getServiceMap;
-import static io.fabric8.kubernetes.api.KubernetesHelper.loadJson;
-import static io.fabric8.kubernetes.api.KubernetesHelper.summaryText;
-import static io.fabric8.kubernetes.api.KubernetesHelper.toItemList;
-
-/**
- * Applies DTOs to the current Kubernetes master
- */
-public class Controller {
- private static final transient Logger LOG = LoggerFactory.getLogger(Controller.class);
-
- private final KubernetesClient kubernetes;
- private Map<String, Pod> podMap;
- private Map<String, ReplicationController> replicationControllerMap;
- private Map<String, Service> serviceMap;
- private boolean throwExceptionOnError = true;
- private boolean allowCreate = true;
- private boolean recreateMode;
- private boolean servicesOnlyMode;
- private boolean ignoreServiceMode;
- private boolean ignoreRunningOAuthClients = true;
- private boolean processTemplatesLocally;
- private File logJsonDir;
- private File basedir;
-
- public Controller() {
- this(new KubernetesClient());
- }
-
- public Controller(KubernetesClient kubernetes) {
- this.kubernetes = kubernetes;
- }
-
- public String apply(File file) throws Exception {
- String ext = Files.getFileExtension(file);
-
- if ("yaml".equalsIgnoreCase(ext)) {
- return applyYaml(file);
- } else if ("json".equalsIgnoreCase(ext)) {
- return applyJson(file);
- } else {
- throw new IllegalArgumentException("Unknown file type " + ext);
- }
- }
-
- /**
- * Applies the given JSON to the underlying REST APIs in a single operation without needing to explicitly parse first.
- */
- public String applyJson(byte[] json) throws Exception {
- Object dto = loadJson(json);
- apply(dto, "REST call");
- return "";
- }
-
- /**
- * Applies the given JSON to the underlying REST APIs in a single operation without needing to explicitly parse first.
- */
- public String applyJson(String json) throws Exception {
- Object dto = loadJson(json);
- apply(dto, "REST call");
- return "";
- }
-
- /**
- * Applies the given JSON to the underlying REST APIs in a single operation without needing to explicitly parse first.
- */
- public String applyJson(File json) throws Exception {
- Object dto = loadJson(json);
- apply(dto, "REST call");
- return "";
- }
-
- /**
- * Applies the given YAML to the underlying REST APIs in a single operation without needing to explicitly parse first.
- */
- public String applyYaml(String yaml) throws Exception {
- String json = convertYamlToJson(yaml);
- Object dto = loadJson(json);
- apply(dto, "REST call");
- return "";
- }
-
- /**
- * Applies the given YAML to the underlying REST APIs in a single operation without needing to explicitly parse first.
- */
- public String applyYaml(File yaml) throws Exception {
- String json = convertYamlToJson(yaml);
- Object dto = loadJson(json);
- apply(dto, "REST call");
- return "";
- }
-
- private String convertYamlToJson(String yamlString) throws FileNotFoundException {
- Yaml yaml = new Yaml();
-
- Map<String, Object> map = (Map<String, Object>) yaml.load(yamlString);
- JSONObject jsonObject = new JSONObject(map);
-
- return jsonObject.toString();
- }
-
- private String convertYamlToJson(File yamlFile) throws FileNotFoundException {
- Yaml yaml = new Yaml();
- FileInputStream fstream = new FileInputStream(yamlFile);
-
- Map<String, Object> map = (Map<String, Object>) yaml.load(fstream);
- JSONObject jsonObject = new JSONObject(map);
-
- return jsonObject.toString();
- }
-
- /**
- * Applies the given JSON to the underlying REST APIs in a single operation without needing to explicitly parse first.
- */
- public String applyJson(InputStream json) throws Exception {
- Object dto = loadJson(json);
- apply(dto, "REST call");
- return "";
- }
-
- /**
- * Applies the given DTOs onto the Kubernetes master
- */
- public void apply(Object dto, String sourceName) throws Exception {
- if (dto instanceof List) {
- List list = (List) dto;
- for (Object element : list) {
- if (dto == element) {
- LOG.warn("Found recursive nested object for " + dto + " of class: " + dto.getClass().getName());
- continue;
- }
- apply(element, sourceName);
- }
- } else if (dto instanceof KubernetesList) {
- applyList((KubernetesList) dto, sourceName);
- } else if (dto != null) {
- applyEntity(dto, sourceName);
- }
- }
-
- /**
- * Applies the given DTOs onto the Kubernetes master
- */
- public void applyEntity(Object dto, String sourceName) throws Exception {
- if (dto instanceof Pod) {
- applyPod((Pod) dto, sourceName);
- } else if (dto instanceof ReplicationController) {
- applyReplicationController((ReplicationController) dto, sourceName);
- } else if (dto instanceof Service) {
- applyService((Service) dto, sourceName);
- } else if (dto instanceof Namespace) {
- applyNamespace((Namespace) dto);
- } else if (dto instanceof Route) {
- applyRoute((Route) dto, sourceName);
- } else if (dto instanceof BuildConfig) {
- applyBuildConfig((BuildConfig) dto, sourceName);
- } else if (dto instanceof DeploymentConfig) {
- applyDeploymentConfig((DeploymentConfig) dto, sourceName);
- } else if (dto instanceof ImageStream) {
- applyImageStream((ImageStream) dto, sourceName);
- } else if (dto instanceof OAuthClient) {
- applyOAuthClient((OAuthClient) dto, sourceName);
- } else if (dto instanceof Template) {
- applyTemplate((Template) dto, sourceName);
- } else {
- throw new IllegalArgumentException("Unknown entity type " + dto);
- }
- }
-
- public void applyOAuthClient(OAuthClient entity, String sourceName) {
- String id = getName(entity);
- Objects.notNull(id, "No name for " + entity + " " + sourceName);
- if (isServicesOnlyMode()) {
- LOG.debug("Only processing Services right now so ignoring OAuthClient: " + id);
- return;
- }
- OAuthClient old = kubernetes.getOAuthClient(id);
- if (isRunning(old)) {
- if (isIgnoreRunningOAuthClients()) {
- LOG.info("Not updating the OAuthClient which are shared across namespaces as its already running");
- return;
- }
- if (UserConfigurationCompare.configEqual(entity, old)) {
- LOG.info("OAuthClient hasn't changed so not doing anything");
- } else {
- if (isRecreateMode()) {
- kubernetes.deleteOAuthClient(id);
- doCreateOAuthClient(entity, sourceName);
- } else {
- try {
- Object answer = kubernetes.updateOAuthClient(id, entity);
- LOG.info("Updated pod result: " + answer);
- } catch (Exception e) {
- onApplyError("Failed to update pod from " + sourceName + ". " + e + ". " + entity, e);
- }
- }
- }
- } else {
- if (!isAllowCreate()) {
- LOG.warn("Creation disabled so not creating an OAuthClient from " + sourceName + " name " + getName(entity));
- } else {
- doCreateOAuthClient(entity, sourceName);
- }
- }
- }
-
- protected void doCreateOAuthClient(OAuthClient entity, String sourceName) {
- Object result = null;
- try {
- result = kubernetes.createOAuthClient(entity);
- } catch (Exception e) {
- onApplyError("Failed to create OAuthClient from " + sourceName + ". " + e + ". " + entity, e);
- }
- }
-
- /**
- * Creates/updates the template and processes it returning the processed DTOs
- */
- public Object applyTemplate(Template entity, String sourceName) throws Exception {
- if (!isProcessTemplatesLocally()) {
- String namespace = getNamespace();
- String id = getName(entity);
- Objects.notNull(id, "No name for " + entity + " " + sourceName);
- Template old = kubernetes.getTemplate(id, namespace);
- if (isRunning(old)) {
- if (UserConfigurationCompare.configEqual(entity, old)) {
- LOG.info("Template hasn't changed so not doing anything");
- } else {
- boolean recreateMode = isRecreateMode();
- // TODO seems you can't update templates right now
- recreateMode = true;
- if (recreateMode) {
- kubernetes.deleteTemplate(id, namespace);
- doCreateTemplate(entity, namespace, sourceName);
- } else {
- LOG.info("Updating a entity from " + sourceName);
- try {
- Object answer = kubernetes.updateTemplate(id, entity, namespace);
- LOG.info("Updated entity: " + answer);
- } catch (Exception e) {
- onApplyError("Failed to update controller from " + sourceName + ". " + e + ". " + entity, e);
- }
- }
- }
- } else {
- if (!isAllowCreate()) {
- LOG.warn("Creation disabled so not creating a entity from " + sourceName + " namespace " + namespace + " name " + getName(entity));
- } else {
- doCreateTemplate(entity, namespace, sourceName);
- }
- }
- }
- return processTemplate(entity, sourceName);
- }
-
- protected void doCreateTemplate(Template entity, String namespace, String sourceName) {
- LOG.info("Creating a template from " + sourceName + " namespace " + namespace + " name " + getName(entity));
- try {
- Object answer = kubernetes.createTemplate(entity, namespace);
- logGeneratedEntity("Created template: ", namespace, entity, answer);
- } catch (Exception e) {
- onApplyError("Failed to template entity from " + sourceName + ". " + e + ". " + entity, e);
- }
- }
-
- protected void logGeneratedEntity(String message, String namespace, HasMetadata entity, Object result) {
- if (logJsonDir != null) {
- File namespaceDir = new File(logJsonDir, namespace);
- namespaceDir.mkdirs();
- String kind = KubernetesHelper.getKind(entity);
- String name = KubernetesHelper.getName(entity);
- if (Strings.isNotBlank(kind)) {
- name = kind.toLowerCase() + "-" + name;
- }
- if (Strings.isNullOrBlank(name)) {
- LOG.warn("No name for the entity " + entity);
- } else {
- String fileName = name + ".json";
- File file = new File(namespaceDir, fileName);
- if (file.exists()) {
- int idx = 1;
- while (true) {
- fileName = name + "-" + idx++ + ".json";
- file = new File(namespaceDir, fileName);
- if (!file.exists()) {
- break;
- }
- }
- }
- String text;
- if (result instanceof String) {
- text = result.toString();
- } else {
- try {
- text = KubernetesHelper.toJson(result);
- } catch (JsonProcessingException e) {
- LOG.warn("Could not convert " + result + " to JSON: " + e, e);
- if (result != null) {
- text = result.toString();
- } else {
- text = "null";
- }
- }
- }
- try {
- IOHelpers.writeFully(file, text);
- Object fileLocation = file;
- if (basedir != null) {
- String path = Files.getRelativePath(basedir, file);
- if (path != null) {
- fileLocation = Strings.stripPrefix(path, "/");
- }
- }
- LOG.info(message + fileLocation);
- } catch (IOException e) {
- LOG.warn("Failed to write to file " + file + ". " + e, e);
- }
- return;
- }
- }
- LOG.info(message + result);
- }
-
- public Object processTemplate(Template entity, String sourceName) {
- if (isProcessTemplatesLocally()) {
- try {
- return Templates.processTemplatesLocally(entity);
- } catch (IOException e) {
- onApplyError("Failed to process template " + sourceName + ". " + e + ". " + entity, e);
- return null;
- }
- } else {
- String id = getName(entity);
- Objects.notNull(id, "No name for " + entity + " " + sourceName);
- String namespace = KubernetesHelper.getNamespace(entity);
- LOG.info("Creating Template " + namespace + ":" + id + " " + summaryText(entity));
- Object result = null;
- try {
- String json = kubernetes.processTemplate(entity, namespace);
- logGeneratedEntity("Template processed into: ", namespace, entity, json);
- result = loadJson(json);
- printSummary(result);
- } catch (Exception e) {
- onApplyError("Failed to create controller from " + sourceName + ". " + e + ". " + entity, e);
- }
- return result;
- }
- }
-
-
- protected void printSummary(Object kubeResource) throws IOException {
- if (kubeResource != null) {
- LOG.debug(" " + kubeResource.getClass().getSimpleName() + " " + kubeResource);
- }
- if (kubeResource instanceof Template) {
- Template template = (Template) kubeResource;
- String id = getName(template);
- LOG.info(" Template " + id + " " + summaryText(template));
- printSummary(template.getObjects());
- return;
- }
- List<HasMetadata> list = toItemList(kubeResource);
- for (HasMetadata object : list) {
- if (object != null) {
- if (object == list) {
- LOG.warn("Ignoring recursive list " + list);
- continue;
- } else if (object instanceof List) {
- printSummary(object);
- } else {
- String kind = object.getClass().getSimpleName();
- String id = getObjectId(object);
- LOG.info(" " + kind + " " + id + " " + summaryText(object));
- }
- }
- }
- }
-
- public void applyRoute(Route entity, String sourceName) {
- String id = getName(entity);
- Objects.notNull(id, "No name for " + entity + " " + sourceName);
- String namespace = KubernetesHelper.getNamespace(entity);
- if (Strings.isNullOrBlank(namespace)) {
- namespace = kubernetes.getNamespace();
- }
- Route route = kubernetes.findRoute(id, namespace);
- if (route == null) {
- try {
- LOG.info("Creating Route " + namespace + ":" + id + " " + KubernetesHelper.summaryText(entity));
- kubernetes.createRoute(entity, namespace);
- } catch (WebApplicationException e) {
- if (e.getResponse().getStatus() == 404) {
- // could be OpenShift 0.4.x which has the old style REST API - lets try that...
- LOG.warn("Got a 404 - could be an old Kubernetes/OpenShift environment - lets try the old style REST API...");
- try {
- kubernetes.createRouteOldAPi(entity, namespace);
- } catch (Exception e1) {
- onApplyError("Failed to create Route from " + sourceName + ". " + e1 + ". " + entity, e1);
- }
- } else {
- onApplyError("Failed to create Route from " + sourceName + ". " + e + ". " + entity, e);
- }
- } catch (Exception e) {
- onApplyError("Failed to create Route from " + sourceName + ". " + e + ". " + entity, e);
- }
- }
- }
-
- public void applyBuildConfig(BuildConfig entity, String sourceName) {
- String id = getName(entity);
- Objects.notNull(id, "No name for " + entity + " " + sourceName);
- String namespace = KubernetesHelper.getNamespace(entity);
- if (Strings.isNullOrBlank(namespace)) {
- namespace = kubernetes.getNamespace();
- }
- BuildConfig old = kubernetes.getBuildConfig(id, namespace);
- if (isRunning(old)) {
- if (UserConfigurationCompare.configEqual(entity, old)) {
- LOG.info("BuildConfig hasn't changed so not doing anything");
- } else {
- if (isRecreateMode()) {
- kubernetes.deleteBuildConfig(id, namespace);
- doCreateBuildConfig(entity, namespace, sourceName);
- } else {
- LOG.info("Updating BuildConfig from " + sourceName);
- try {
- String resourceVersion = KubernetesHelper.getResourceVersion(old);
- KubernetesHelper.getOrCreateMetadata(entity).setResourceVersion(resourceVersion);
- Object answer = kubernetes.updateBuildConfig(id, entity, namespace);
- logGeneratedEntity("Updated BuildConfig: ", namespace, entity, answer);
- } catch (Exception e) {
- onApplyError("Failed to update BuildConfig from " + sourceName + ". " + e + ". " + entity, e);
- }
- }
- }
- } else {
- if (!isAllowCreate()) {
- LOG.warn("Creation disabled so not creating BuildConfig from " + sourceName + " namespace " + namespace + " name " + getName(entity));
- } else {
- doCreateBuildConfig(entity, namespace, sourceName);
- }
- }
- }
-
- public void doCreateBuildConfig(BuildConfig entity, String namespace ,String sourceName) {
- try {
- kubernetes.createBuildConfig(entity, namespace);
- } catch (Exception e) {
- onApplyError("Failed to create BuildConfig from " + sourceName + ". " + e, e);
- }
- }
-
- public void applyDeploymentConfig(DeploymentConfig entity, String sourceName) {
- try {
- kubernetes.createDeploymentConfig(entity, getNamespace());
- } catch (Exception e) {
- onApplyError("Failed to create DeploymentConfig from " + sourceName + ". " + e, e);
- }
- }
-
- public void applyImageStream(ImageStream entity, String sourceName) {
- try {
- kubernetes.createImageStream(entity, getNamespace());
- } catch (Exception e) {
- onApplyError("Failed to create BuildConfig from " + sourceName + ". " + e, e);
- }
- }
-
- public void applyList(KubernetesList list, String sourceName) throws Exception {
- List<HasMetadata> entities = list.getItems();
- if (entities != null) {
- for (Object entity : entities) {
- applyEntity(entity, sourceName);
- }
- }
- }
-
- public void applyService(Service service, String sourceName) throws Exception {
- String namespace = getNamespace();
- String id = getName(service);
- Objects.notNull(id, "No name for " + service + " " + sourceName);
- if (isIgnoreServiceMode()) {
- LOG.debug("Ignoring Service: " + namespace + ":" + id);
- return;
- }
- if (serviceMap == null) {
- serviceMap = getServiceMap(kubernetes, namespace);
- }
- Service old = serviceMap.get(id);
- if (isRunning(old)) {
- if (UserConfigurationCompare.configEqual(service, old)) {
- LOG.info("Service hasn't changed so not doing anything");
- } else {
- if (isRecreateMode()) {
- kubernetes.deleteService(service, namespace);
- doCreateService(service, namespace, sourceName);
- } else {
- LOG.info("Updating a service from " + sourceName);
- try {
- Object answer = kubernetes.updateService(id, service, namespace);
- logGeneratedEntity("Updated service: ", namespace, service, answer);
- } catch (Exception e) {
- onApplyError("Failed to update controller from " + sourceName + ". " + e + ". " + service, e);
- }
- }
- }
- } else {
- if (!isAllowCreate()) {
- LOG.warn("Creation disabled so not creating a service from " + sourceName + " namespace " + namespace + " name " + getName(service));
- } else {
- doCreateService(service, namespace, sourceName);
- }
- }
- }
-
- protected void doCreateService(Service service, String namespace, String sourceName) {
- LOG.info("Creating a service from " + sourceName + " namespace " + namespace + " name " + getName(service));
- try {
- Object answer;
- if (Strings.isNotBlank(namespace)) {
- answer = kubernetes.createService(service, namespace);
- } else {
- answer = kubernetes.createService(service);
- }
- logGeneratedEntity("Created service: ", namespace, service, answer);
- } catch (Exception e) {
- onApplyError("Failed to create service from " + sourceName + ". " + e + ". " + service, e);
- }
- }
-
- public void applyNamespace(Namespace entity) {
- String namespace = getOrCreateMetadata(entity).getName();
- LOG.info("Creating a namespace " + namespace);
- try {
- Object answer = kubernetes.createNamespace(entity);
- logGeneratedEntity("Created namespace: ", namespace, entity, answer);
- } catch (Exception e) {
- onApplyError("Failed to create namespace. " + e + ". " + entity, e);
- }
- }
-
- public void applyReplicationController(ReplicationController replicationController, String sourceName) throws Exception {
- String namespace = getNamespace();
- String id = getName(replicationController);
- Objects.notNull(id, "No name for " + replicationController + " " + sourceName);
- if (isServicesOnlyMode()) {
- LOG.debug("Only processing Services right now so ignoring ReplicationController: " + namespace + ":" + id);
- return;
- }
- if (replicationControllerMap == null) {
- replicationControllerMap = getReplicationControllerMap(kubernetes, namespace);
- }
- ReplicationController old = replicationControllerMap.get(id);
- if (isRunning(old)) {
- if (UserConfigurationCompare.configEqual(replicationController, old)) {
- LOG.info("ReplicationController hasn't changed so not doing anything");
- } else {
- if (isRecreateMode()) {
- kubernetes.deleteReplicationControllerAndPods(replicationController, namespace);
- doCreateReplicationController(replicationController, namespace, sourceName);
- } else {
- LOG.info("Updating replicationController from " + sourceName + " namespace " + namespace + " name " + getName(replicationController));
- try {
- Object answer = kubernetes.updateReplicationController(id, replicationController);
- logGeneratedEntity("Updated replicationController: ", namespace, replicationController, answer);
- } catch (Exception e) {
- onApplyError("Failed to update replicationController from " + sourceName + ". " + e + ". " + replicationController, e);
- }
- }
- }
- } else {
- if (!isAllowCreate()) {
- LOG.warn("Creation disabled so not creating a replicationController from " + sourceName + " namespace " + namespace + " name " + getName(replicationController));
- } else {
- doCreateReplicationController(replicationController, namespace, sourceName);
- }
- }
- }
-
- protected void doCreateReplicationController(ReplicationController replicationController, String namespace, String sourceName) {
- LOG.info("Creating a replicationController from " + sourceName + " namespace " + namespace + " name " + getName(replicationController));
- try {
- // lets check that if secrets are required they exist
- ReplicationControllerSpec spec = replicationController.getSpec();
- if (spec != null) {
- PodTemplateSpec template = spec.getTemplate();
- if (template != null) {
- PodSpec podSpec = template.getSpec();
- validatePodSpec(podSpec, namespace);
- }
- }
- Object answer;
- if (Strings.isNotBlank(namespace)) {
- answer = kubernetes.createReplicationController(replicationController, namespace);
- } else {
- answer = kubernetes.createReplicationController(replicationController);
- }
- logGeneratedEntity("Created replicationController: ", namespace, replicationController, answer);
- } catch (Exception e) {
- onApplyError("Failed to create replicationController from " + sourceName + ". " + e + ". " + replicationController, e);
- }
- }
-
- /**
- * Lets verify that any dependencies are available; such as volumes or secrets
- */
- protected void validatePodSpec(PodSpec podSpec, String namespace) {
- List<Volume> volumes = podSpec.getVolumes();
- if (volumes != null) {
- for (Volume volume : volumes) {
- SecretVolumeSource secret = volume.getSecret();
- if (secret != null) {
- String secretName = secret.getSecretName();
- if (Strings.isNotBlank(secretName)) {
- KubernetesHelper.validateSecretExists(kubernetes, namespace, secretName);
- }
- }
- }
- }
- }
-
- public void applyPod(Pod pod, String sourceName) throws Exception {
- String namespace = getNamespace();
- String id = getName(pod);
- Objects.notNull(id, "No name for " + pod + " " + sourceName);
- if (isServicesOnlyMode()) {
- LOG.debug("Only processing Services right now so ignoring Pod: " + namespace + ":" + id);
- return;
- }
- if (podMap == null) {
- podMap = getPodMap(kubernetes, namespace);
- }
- Pod old = podMap.get(id);
- if (isRunning(old)) {
- if (UserConfigurationCompare.configEqual(pod, old)) {
- LOG.info("Pod hasn't changed so not doing anything");
- } else {
- if (isRecreateMode()) {
- kubernetes.deletePod(pod, namespace);
- doCreatePod(pod, namespace, sourceName);
- } else {
- LOG.info("Updating a pod from " + sourceName + " namespace " + namespace + " name " + getName(pod));
- try {
- Object answer = kubernetes.updatePod(id, pod);
- LOG.info("Updated pod result: " + answer);
- } catch (Exception e) {
- onApplyError("Failed to update pod from " + sourceName + ". " + e + ". " + pod, e);
- }
- }
- }
- } else {
- if (!isAllowCreate()) {
- LOG.warn("Creation disabled so not creating a pod from " + sourceName + " namespace " + namespace + " name " + getName(pod));
- } else {
- doCreatePod(pod, namespace, sourceName);
- }
- }
- }
-
- protected void doCreatePod(Pod pod, String namespace, String sourceName) {
- LOG.info("Creating a pod from " + sourceName + " namespace " + namespace + " name " + getName(pod));
- try {
- PodSpec podSpec = pod.getSpec();
- if (podSpec != null) {
- validatePodSpec(podSpec, namespace);
- }
- Object answer;
- if (Strings.isNotBlank(namespace)) {
- answer = kubernetes.createPod(pod, namespace);
- } else {
- answer = kubernetes.createPod(pod);
- }
- LOG.info("Created pod result: " + answer);
- } catch (Exception e) {
- onApplyError("Failed to create pod from " + sourceName + ". " + e + ". " + pod, e);
- }
- }
-
- public String getNamespace() {
- return kubernetes.getNamespace();
- }
-
- public void setNamespace(String namespace) {
- kubernetes.setNamespace(namespace);
- }
-
- public boolean isThrowExceptionOnError() {
- return throwExceptionOnError;
- }
-
- public void setThrowExceptionOnError(boolean throwExceptionOnError) {
- this.throwExceptionOnError = throwExceptionOnError;
- }
-
- public boolean isProcessTemplatesLocally() {
- return processTemplatesLocally;
- }
-
- public void setProcessTemplatesLocally(boolean processTemplatesLocally) {
- this.processTemplatesLocally = processTemplatesLocally;
- }
-
- public File getLogJsonDir() {
- return logJsonDir;
- }
-
- /**
- * Lets you configure the directory where JSON logging files should go
- */
- public void setLogJsonDir(File logJsonDir) {
- this.logJsonDir = logJsonDir;
- }
-
- public File getBasedir() {
- return basedir;
- }
-
- public void setBasedir(File basedir) {
- this.basedir = basedir;
- }
-
- protected boolean isRunning(HasMetadata entity) {
- return entity != null;
- }
-
-
- /**
- * Logs an error applying some JSON to Kubernetes and optionally throws an exception
- */
- protected void onApplyError(String message, Exception e) {
- LOG.error(message, e);
- if (throwExceptionOnError) {
- throw new RuntimeException(message, e);
- }
- }
-
- /**
- * Returns true if this controller allows new resources to be created in the given namespace
- */
- public boolean isAllowCreate() {
- return allowCreate;
- }
-
- public void setAllowCreate(boolean allowCreate) {
- this.allowCreate = allowCreate;
- }
-
- /**
- * If enabled then updates are performed by deleting the resource first then creating it
- */
- public boolean isRecreateMode() {
- return recreateMode;
- }
-
- public void setRecreateMode(boolean recreateMode) {
- this.recreateMode = recreateMode;
- }
-
- public void setServicesOnlyMode(boolean servicesOnlyMode) {
- this.servicesOnlyMode = servicesOnlyMode;
- }
-
- /**
- * If enabled then only services are created/updated to allow services to be created/updated across
- * a number of apps before any pods/replication controllers are updated
- */
- public boolean isServicesOnlyMode() {
- return servicesOnlyMode;
- }
-
- /**
- * If enabled then all services are ignored to avoid them being recreated. This is useful if you want to
- * recreate ReplicationControllers and Pods but leave Services as they are to avoid the portalIP addresses
- * changing
- */
- public boolean isIgnoreServiceMode() {
- return ignoreServiceMode;
- }
-
- public void setIgnoreServiceMode(boolean ignoreServiceMode) {
- this.ignoreServiceMode = ignoreServiceMode;
- }
-
- public boolean isIgnoreRunningOAuthClients() {
- return ignoreRunningOAuthClients;
- }
-
- public void setIgnoreRunningOAuthClients(boolean ignoreRunningOAuthClients) {
- this.ignoreRunningOAuthClients = ignoreRunningOAuthClients;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Entity.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Entity.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Entity.java
deleted file mode 100644
index 1b37892..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Entity.java
+++ /dev/null
@@ -1,28 +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 io.fabric8.kubernetes.api;
-
-/**
- * The base interface for all entities which have an ID and a kind
- */
-public interface Entity {
-
- String getId();
-
- String getKind();
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/ExceptionResponseMapper.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/ExceptionResponseMapper.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/ExceptionResponseMapper.java
deleted file mode 100644
index 263dfee..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/ExceptionResponseMapper.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package io.fabric8.kubernetes.api;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.fabric8.kubernetes.api.model.base.Status;
-import io.fabric8.utils.IOHelpers;
-import io.fabric8.utils.Strings;
-import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.io.InputStream;
-
-public class ExceptionResponseMapper implements ResponseExceptionMapper<Exception> {
- private static final transient Logger LOG = LoggerFactory.getLogger(ExceptionResponseMapper.class);
-
- @Override
- public Exception fromResponse(Response response) {
- try {
- Object entity = response.getEntity();
- String message = extractErrorMessage(entity);
- message = "HTTP " + response.getStatus() + " " + message;
- return new WebApplicationException(message, response);
- } catch (Exception ex) {
- return new Exception(
- "Could not deserialize server side exception: " + ex.getMessage());
- }
- }
-
- public static String extractErrorMessage(Object entity) {
- String message = "No message";
- ObjectMapper mapper = KubernetesFactory.createObjectMapper();
- try {
- String json = null;
- if (entity instanceof InputStream) {
- InputStream inputStream = (InputStream) entity;
- json = IOHelpers.readFully(inputStream);
- } else if (entity != null) {
- json = entity.toString();
- }
- if (Strings.isNotBlank(json)) {
- message = json;
- if (textLooksLikeJsonObject(json)) {
- try {
- Status error = mapper.readValue(json, Status.class);
- if (error != null) {
- message = error.getMessage();
- if (Strings.isNullOrBlank(message)) {
- message = error.getReason();
- }
- }
- } catch (IOException e) {
- LOG.warn("Failed to parse Status from JSON:" + json + ". Reason: " + e, e);
- }
- }
- }
- } catch (Exception e) {
- message = "Failed to extract message from request: " + e;
- }
- return message;
- }
-
- protected static boolean textLooksLikeJsonObject(String text) {
- text = text.trim();
- return text.startsWith("{") && text.endsWith("}");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Kubernetes.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Kubernetes.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Kubernetes.java
deleted file mode 100644
index 49a34ef..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Kubernetes.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- *
- * Red Hat 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 io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.Endpoints;
-import io.fabric8.kubernetes.api.model.EndpointsList;
-import io.fabric8.kubernetes.api.model.Namespace;
-import io.fabric8.kubernetes.api.model.NamespaceList;
-import io.fabric8.kubernetes.api.model.Node;
-import io.fabric8.kubernetes.api.model.NodeList;
-import io.fabric8.kubernetes.api.model.Pod;
-import io.fabric8.kubernetes.api.model.PodList;
-import io.fabric8.kubernetes.api.model.ReplicationController;
-import io.fabric8.kubernetes.api.model.ReplicationControllerList;
-import io.fabric8.kubernetes.api.model.Secret;
-import io.fabric8.kubernetes.api.model.SecretList;
-import io.fabric8.kubernetes.api.model.Service;
-import io.fabric8.kubernetes.api.model.ServiceList;
-
-import javax.validation.constraints.NotNull;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-/**
- * Represents the Remote API to working with <a href="http://kubernetes.io/">Kubernetes</a> providing a facade
- * over the generated JAXRS client.
- */
-@Path(Kubernetes.ROOT_API_PATH)
-@Produces("application/json")
-@Consumes("application/json")
-public interface Kubernetes {
-
- static final String ROOT_API_PATH = "api/v1beta3";
-
- static final String NAMESPACE_ALL = "";
- static final String NAMESPACE_DEFAULT = "default";
-
- static final String SERVICE_ACCOUNT_TOKEN_FILE = "/var/run/secrets/kubernetes.io/servicaccount/token";
-
- /**
- * List all namespaces on this cluster
- */
- @GET
- @Path("namespaces")
- NamespaceList getNamespaces();
-
-
- @POST
- @Path("namespaces")
- @Consumes("application/json")
- String createNamespace(Namespace entity) throws Exception;
-
- /**
- * Get a specific Namespace
- */
- @GET
- @Path("namespaces/{name}")
- Namespace getNamespace(@PathParam("name") @NotNull String name);
-
- /**
- * Update a namespace
- * @param namespaceId
- * @param entity
- */
- @PUT
- @Path("namespaces/{name}")
- @Consumes("application/json")
- String updateNamespace(@PathParam("name") @NotNull String namespaceId, Namespace entity) throws Exception;
-
- @DELETE
- @Path("namespaces/{name}")
- @Consumes("text/plain")
- String deleteNamespace(@PathParam("name") @NotNull String name) throws Exception;
-
- /**
- * List all pods on this cluster
- * @param namespace
- */
- @GET
- @Path("namespaces/{namespace}/pods")
- PodList getPods(@PathParam("namespace") String namespace);
-
- @POST
- @Path("namespaces/{namespace}/pods")
- @Consumes("application/json")
- String createPod(Pod entity, @PathParam("namespace") String namespace) throws Exception;
-
- /**
- * Get a specific pod
- *
- * @param podId
- * @param namespace
- */
- @GET
- @Path("namespaces/{namespace}/pods/{podId}")
- Pod getPod(@PathParam("podId") @NotNull String podId, @PathParam("namespace") String namespace);
-
- /**
- * Update a pod
- * @param podId
- * @param entity
- * @param namespace
- */
- @PUT
- @Path("namespaces/{namespace}/pods/{podId}")
- @Consumes("application/json")
- String updatePod(@PathParam("podId") @NotNull String podId, Pod entity, @PathParam("namespace") String namespace) throws Exception;
-
- @DELETE
- @Path("namespaces/{namespace}/pods/{podId}")
- @Consumes("text/plain")
- String deletePod(@PathParam("podId") @NotNull String podId, @PathParam("namespace") String namespace) throws Exception;
-
- /**
- * List all services on this cluster
- * @param namespace
- */
- @Path("namespaces/{namespace}/services")
- @GET
- @Produces("application/json")
- ServiceList getServices(@PathParam("namespace") String namespace);
-
- @Path("namespaces/{namespace}/services")
- @POST
- @Consumes("application/json")
- String createService(Service entity, @PathParam("namespace") String namespace) throws Exception;
-
- /**
- * Get a specific service
- *
- * @param serviceId
- * @param namespace
- */
- @GET
- @Path("namespaces/{namespace}/services/{serviceId}")
- @Produces("application/json")
- Service getService(@PathParam("serviceId") @NotNull String serviceId, @PathParam("namespace") String namespace);
-
- /**
- * Update a service
- */
- @PUT
- @Path("namespaces/{namespace}/services/{serviceId}")
- @Consumes("application/json")
- String updateService(@PathParam("serviceId") @NotNull String serviceId, Service entity, @PathParam("namespace") String namespace) throws Exception;
-
- @DELETE
- @Path("namespaces/{namespace}/services/{serviceId}")
- @Produces("application/json")
- @Consumes("text/plain")
- String deleteService(@PathParam("serviceId") @NotNull String serviceId, @PathParam("namespace") String namespace) throws Exception;
-
- /**
- * List all replicationControllers on this cluster
- * @param namespace
- */
- @Path("namespaces/{namespace}/replicationcontrollers")
- @GET
- @Produces("application/json")
- ReplicationControllerList getReplicationControllers(@PathParam("namespace") String namespace);
-
- @Path("namespaces/{namespace}/replicationcontrollers")
- @POST
- @Consumes("application/json")
- String createReplicationController(ReplicationController entity, @PathParam("namespace") String namespace) throws Exception;
-
- @PUT
- @Path("namespaces/{namespace}/replicationcontrollers/{controllerId}")
- @Consumes("application/json")
- String updateReplicationController(@PathParam("controllerId") @NotNull String controllerId, ReplicationController entity, @PathParam("namespace") String namespace) throws Exception;
-
- /**
- * Get a specific controller
- *
- * @param controllerId
- * @param namespace
- */
- @GET
- @Path("namespaces/{namespace}/replicationcontrollers/{controllerId}")
- @Produces("application/json")
- ReplicationController getReplicationController(@PathParam("controllerId") @NotNull String controllerId, @PathParam("namespace") String namespace);
-
- /**
- * Delete a specific controller
- *
- * @param controllerId
- */
- @DELETE
- @Path("namespaces/{namespace}/replicationcontrollers/{controllerId}")
- @Produces("application/json")
- @Consumes("text/plain")
- String deleteReplicationController(@PathParam("controllerId") @NotNull String controllerId, @PathParam("namespace") String namespace) throws Exception;
-
- /**
- * List all service endpoints on this cluster
- */
- @GET
- @Path("namespaces/{namespace}/endpoints")
- EndpointsList getEndpoints(@PathParam("namespace") String namespace);
-
- /**
- * List all endpoints for a service
- */
- @GET
- @Path("namespaces/{namespace}/endpoints/{serviceId}")
- Endpoints endpointsForService(@PathParam("serviceId") @NotNull String serviceId, @PathParam("namespace") String namespace);
-
-
- /**
- * List all secrets on this cluster
- * @param namespace
- */
- @Path("namespaces/{namespace}/secrets")
- @GET
- @Produces("application/json")
- SecretList getSecrets(@PathParam("namespace") String namespace);
-
- @Path("namespaces/{namespace}/secrets")
- @POST
- @Consumes("application/json")
- String createSecret(Secret entity, @PathParam("namespace") String namespace) throws Exception;
-
- /**
- * Get a specific secret
- *
- * @param secretId
- * @param namespace
- */
- @GET
- @Path("namespaces/{namespace}/secrets/{secretId}")
- @Produces("application/json")
- Secret getSecret(@PathParam("secretId") @NotNull String secretId, @PathParam("namespace") String namespace);
-
- /**
- * Update a secret
- */
- @PUT
- @Path("namespaces/{namespace}/secrets/{secretId}")
- @Consumes("application/json")
- String updateSecret(@PathParam("secretId") @NotNull String secretId, Secret entity, @PathParam("namespace") String namespace) throws Exception;
-
- @DELETE
- @Path("namespaces/{namespace}/secrets/{secretId}")
- @Produces("application/json")
- @Consumes("text/plain")
- String deleteSecret(@PathParam("secretId") @NotNull String secretId, @PathParam("namespace") String namespace) throws Exception;
-
-
-
- /**
- * List all the minions on this cluster
- */
- @GET
- @Path("nodes")
- NodeList getNodes();
-
- /**
- * List all endpoints for a service
- */
- @GET
- @Path("nodes/{nodeId}")
- Node node(@PathParam("nodeId") @NotNull String nodeId);
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesApiException.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesApiException.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesApiException.java
deleted file mode 100644
index d04c863..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesApiException.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package io.fabric8.kubernetes.api;
-
-public class KubernetesApiException extends Exception {
-
- public KubernetesApiException() {
- }
-
- public KubernetesApiException(String msg) {
- super(msg);
- }
-}