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:08 UTC
[01/12] stratos git commit: Upgrading fabric8 kubernetes api version
to 2.2.16 and removing forked code
Repository: stratos
Updated Branches:
refs/heads/tenant-isolation ad9b2c29d -> 573b70380
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/InlineTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/InlineTest.java b/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/InlineTest.java
deleted file mode 100644
index 72e6617..0000000
--- a/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/InlineTest.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package io.fabric8.kubernetes.api.model;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class InlineTest {
-
- @Test
- public void testIntOrString() throws JsonProcessingException {
- ServicePort port = new ServicePortBuilder().withNewTargetPort(2181).build();
- assertEquals(2181, port.getTargetPort().getIntVal().intValue());
-
- port = new ServicePortBuilder().withNewTargetPort("2181").build();
- assertEquals("2181", port.getTargetPort().getStrVal());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/KubernetesListTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/KubernetesListTest.java b/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/KubernetesListTest.java
deleted file mode 100644
index e7b994d..0000000
--- a/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/KubernetesListTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package io.fabric8.kubernetes.api.model;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import org.hamcrest.CoreMatchers;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-public class KubernetesListTest {
-
- @Test
- public void testDefaultValues() throws JsonProcessingException {
- Service service = new ServiceBuilder()
- .withNewMetadata()
- .withName("test-service")
- .endMetadata()
- .build();
- assertNotNull(service.getApiVersion());
- assertEquals(service.getKind(), "Service");
-
- ReplicationController replicationController = new ReplicationControllerBuilder()
- .withNewMetadata()
- .withName("test-controller")
- .endMetadata()
- .build();
- assertNotNull(replicationController.getApiVersion());
- assertEquals(replicationController.getKind(), "ReplicationController");
-
- KubernetesList kubernetesList = new KubernetesListBuilder()
- .addNewServiceItem()
- .withNewMetadata()
- .withName("test-service")
- .endMetadata()
- .and()
- .addNewReplicationControllerItem()
- .withNewMetadata()
- .withName("test-controller")
- .endMetadata()
- .and()
- .build();
-
- assertNotNull(kubernetesList.getApiVersion());
- assertEquals(kubernetesList.getKind(), "List");
- assertThat(kubernetesList.getItems(), CoreMatchers.hasItem(service));
- assertThat(kubernetesList.getItems(), CoreMatchers.hasItem(replicationController));
- }
-
- @Test
- public void testVisitor() throws JsonProcessingException {
- KubernetesList list = new KubernetesListBuilder()
- .addNewPodItem()
- .withNewSpec()
- .addNewContainer()
- .withName("my-container")
- .withImage("my/image")
- .endContainer()
- .endSpec()
- .and()
- .build();
-
- list = new KubernetesListBuilder(list).accept(new io.fabric8.common.Visitor() {
- public void visit(Object item) {
- if (item instanceof io.fabric8.kubernetes.api.model.PodSpecBuilder) {
- ((io.fabric8.kubernetes.api.model.PodSpecBuilder)item).addNewContainer()
- .withName("other-container")
- .withImage("other/image")
- .and();
- }
- }
- }).build();
- }
-
-
- @Test
- public void testDefaultNullValues() throws JsonProcessingException {
- Container container = new ContainerBuilder().build();
- assertNull(container.getLifecycle());
- assertNull(container.getLivenessProbe());
-
-
- Pod pod = new PodBuilder().build();
- assertNull(pod.getSpec());
- assertNull(pod.getStatus());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/UnmarshallTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/UnmarshallTest.java b/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/UnmarshallTest.java
deleted file mode 100644
index cd6d9df..0000000
--- a/dependencies/fabric8/kubernetes-model/src/test/java/io/fabric8/kubernetes/api/model/UnmarshallTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package io.fabric8.kubernetes.api.model;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.fabric8.common.Visitor;
-import io.fabric8.kubernetes.api.model.resource.Quantity;
-import io.fabric8.openshift.api.model.template.Template;
-import io.fabric8.openshift.api.model.template.TemplateBuilder;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static org.junit.Assert.assertEquals;
-
-public class UnmarshallTest {
-
- @Test
- public void testUnmarshallInt64ToLong() throws Exception {
- ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
- Pod pod = (Pod) mapper.readValue(getClass().getResourceAsStream("/valid-pod.json"), KubernetesResource.class);
- assertEquals(pod.getSpec().getContainers().get(0).getResources().getLimits().get("memory"), new Quantity("5Mi"));
- assertEquals(pod.getSpec().getContainers().get(0).getResources().getLimits().get("cpu"), new Quantity("1"));
- }
-
- @Test
- public void testUnmarshallWithVisitors() throws Exception {
- ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
- KubernetesList list = (KubernetesList) mapper.readValue(getClass().getResourceAsStream("/simple-list.json"), KubernetesResource.class);
- final AtomicInteger integer = new AtomicInteger();
- new KubernetesListBuilder(list).accept(new Visitor() {
- public void visit(Object o) {
- integer.incrementAndGet();
- }
- });
-
- //We just want to make sure that it visits nested objects when deserialization from json is used.
- // The exact number is volatile so we just care about the minimum number of objects (list, pod and service).
- Assert.assertTrue(integer.intValue() >= 3);
-
-
- Template template = (Template) mapper.readValue(getClass().getResourceAsStream("/simple-template.json"), KubernetesResource.class);
- integer.set(0);
- new TemplateBuilder(template).accept(new Visitor() {
- public void visit(Object o) {
- integer.incrementAndGet();
- }
- });
-
- //We just want to make sure that it visits nested objects when deserialization from json is used.
- // The exact number is volatile so we just care about the minimum number of objects (list, pod and service).
- Assert.assertTrue(integer.intValue() >= 2);
-
-
- ServiceList serviceList = (ServiceList) mapper.readValue(getClass().getResourceAsStream("/service-list.json"), KubernetesResource.class);
- integer.set(0);
- new ServiceListBuilder(serviceList).accept(new Visitor() {
- public void visit(Object o) {
- integer.incrementAndGet();
- }
- });
-
- //We just want to make sure that it visits nested objects when deserialization from json is used.
- // The exact number is volatile so we just care about the minimum number of objects (list, pod and service).
- Assert.assertTrue(integer.intValue() >= 2);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/test/resources/service-list.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/test/resources/service-list.json b/dependencies/fabric8/kubernetes-model/src/test/resources/service-list.json
deleted file mode 100644
index ef87d15..0000000
--- a/dependencies/fabric8/kubernetes-model/src/test/resources/service-list.json
+++ /dev/null
@@ -1,239 +0,0 @@
-{
- "kind": "ServiceList",
- "apiVersion": "v1beta3",
- "metadata": {
- "selfLink": "/api/v1beta3/services",
- "resourceVersion": "443"
- },
- "items": [
- {
- "metadata": {
- "name": "app-library",
- "namespace": "default",
- "selfLink": "/api/v1beta3/namespaces/default/services/app-library",
- "uid": "d2907fce-02e4-11e5-8091-08002719a237",
- "resourceVersion": "79",
- "creationTimestamp": "2015-05-25T13:49:11Z",
- "labels": {
- "component": "AppLibrary",
- "provider": "fabric8"
- }
- },
- "spec": {
- "ports": [
- {
- "name": "",
- "protocol": "TCP",
- "port": 80,
- "targetPort": 8080
- }
- ],
- "selector": {
- "component": "AppLibrary",
- "provider": "fabric8"
- },
- "portalIP": "172.30.17.111",
- "sessionAffinity": "None"
- },
- "status": {}
- },
- {
- "metadata": {
- "name": "app-library-jolokia",
- "namespace": "default",
- "selfLink": "/api/v1beta3/namespaces/default/services/app-library-jolokia",
- "uid": "d2a01536-02e4-11e5-8091-08002719a237",
- "resourceVersion": "81",
- "creationTimestamp": "2015-05-25T13:49:11Z"
- },
- "spec": {
- "ports": [
- {
- "name": "",
- "protocol": "TCP",
- "port": 8778,
- "targetPort": 8778
- }
- ],
- "selector": {
- "component": "AppLibrary",
- "provider": "fabric8"
- },
- "portalIP": "172.30.17.8",
- "sessionAffinity": "None"
- },
- "status": {}
- },
- {
- "metadata": {
- "name": "docker-registry",
- "namespace": "default",
- "selfLink": "/api/v1beta3/namespaces/default/services/docker-registry",
- "uid": "d1058b17-02e4-11e5-8091-08002719a237",
- "resourceVersion": "58",
- "creationTimestamp": "2015-05-25T13:49:08Z",
- "labels": {
- "docker-registry": "default"
- }
- },
- "spec": {
- "ports": [
- {
- "name": "",
- "protocol": "TCP",
- "port": 5000,
- "targetPort": 5000
- }
- ],
- "selector": {
- "docker-registry": "default"
- },
- "portalIP": "172.30.17.117",
- "sessionAffinity": "None"
- },
- "status": {}
- },
- {
- "metadata": {
- "name": "fabric8-console-service",
- "namespace": "default",
- "selfLink": "/api/v1beta3/namespaces/default/services/fabric8-console-service",
- "uid": "d3ec3762-02e4-11e5-8091-08002719a237",
- "resourceVersion": "93",
- "creationTimestamp": "2015-05-25T13:49:13Z"
- },
- "spec": {
- "ports": [
- {
- "name": "",
- "protocol": "TCP",
- "port": 80,
- "targetPort": 9090
- }
- ],
- "selector": {
- "component": "fabric8Console"
- },
- "portalIP": "172.30.17.249",
- "sessionAffinity": "None"
- },
- "status": {}
- },
- {
- "metadata": {
- "name": "fabric8-forge",
- "namespace": "default",
- "selfLink": "/api/v1beta3/namespaces/default/services/fabric8-forge",
- "uid": "d3615083-02e4-11e5-8091-08002719a237",
- "resourceVersion": "88",
- "creationTimestamp": "2015-05-25T13:49:12Z",
- "labels": {
- "component": "fabric8Forge",
- "provider": "fabric8"
- }
- },
- "spec": {
- "ports": [
- {
- "name": "",
- "protocol": "TCP",
- "port": 80,
- "targetPort": 8080
- }
- ],
- "selector": {
- "component": "fabric8Forge",
- "provider": "fabric8"
- },
- "portalIP": "172.30.17.159",
- "sessionAffinity": "None"
- },
- "status": {}
- },
- {
- "metadata": {
- "name": "kubernetes",
- "namespace": "default",
- "selfLink": "/api/v1beta3/namespaces/default/services/kubernetes",
- "uid": "bc84b6f4-02e4-11e5-8091-08002719a237",
- "resourceVersion": "5",
- "creationTimestamp": "2015-05-25T13:48:34Z",
- "labels": {
- "component": "apiserver",
- "provider": "kubernetes"
- }
- },
- "spec": {
- "ports": [
- {
- "name": "",
- "protocol": "TCP",
- "port": 443,
- "targetPort": 443
- }
- ],
- "selector": null,
- "portalIP": "172.30.17.2",
- "sessionAffinity": "None"
- },
- "status": {}
- },
- {
- "metadata": {
- "name": "kubernetes-ro",
- "namespace": "default",
- "selfLink": "/api/v1beta3/namespaces/default/services/kubernetes-ro",
- "uid": "bc85c655-02e4-11e5-8091-08002719a237",
- "resourceVersion": "4",
- "creationTimestamp": "2015-05-25T13:48:34Z",
- "labels": {
- "component": "apiserver",
- "provider": "kubernetes"
- }
- },
- "spec": {
- "ports": [
- {
- "name": "",
- "protocol": "TCP",
- "port": 80,
- "targetPort": 80
- }
- ],
- "selector": null,
- "portalIP": "172.30.17.1",
- "sessionAffinity": "None"
- },
- "status": {}
- },
- {
- "metadata": {
- "name": "router",
- "namespace": "default",
- "selfLink": "/api/v1beta3/namespaces/default/services/router",
- "uid": "d0391be9-02e4-11e5-8091-08002719a237",
- "resourceVersion": "52",
- "creationTimestamp": "2015-05-25T13:49:07Z",
- "labels": {
- "router": "router"
- }
- },
- "spec": {
- "ports": [
- {
- "name": "",
- "protocol": "TCP",
- "port": 80,
- "targetPort": 80
- }
- ],
- "selector": {
- "router": "router"
- },
- "portalIP": "172.30.17.219",
- "sessionAffinity": "None"
- },
- "status": {}
- }
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/test/resources/simple-list.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/test/resources/simple-list.json b/dependencies/fabric8/kubernetes-model/src/test/resources/simple-list.json
deleted file mode 100644
index 7d0ac22..0000000
--- a/dependencies/fabric8/kubernetes-model/src/test/resources/simple-list.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "kind": "List",
- "apiVersion": "v1beta3",
- "items": [
- {
- "apiVersion": "v1beta3",
- "kind": "Pod",
- "metadata": {
- "name": "simple-pod"
- },
- "labels": {
- "name": "simple-pod"
- },
- "spec": {
- "containers": [
- {
- "name": "simple-container",
- "image": "simple-image",
- "resources": {
- "limits": {
- "cpu": "1",
- "memory": "5Mi"
- }
- }
- }
- ]
- }
- },
- {
- "apiVersion": "v1beta3",
- "kind": "Service",
- "metadata": {
- "annotations": {},
- "labels": {
- "component": "simple",
- "provider": "simple",
- "group": "simple"
- },
- "name": "simple-service"
- },
- "spec": {
- "ports": [
- {
- "port": 8080,
- "protocol": "TCP",
- "targetPort": 8181
- }
- ],
- "publicIPs": [],
- "selector": {
- "component": "simple",
- "provider": "simple",
- "group": "simple"
- }
- }
- }
- ]
-}
-
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/test/resources/simple-template.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/test/resources/simple-template.json b/dependencies/fabric8/kubernetes-model/src/test/resources/simple-template.json
deleted file mode 100644
index d10f517..0000000
--- a/dependencies/fabric8/kubernetes-model/src/test/resources/simple-template.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "apiVersion": "v1beta3",
- "kind": "Template",
- "labels": {},
- "metadata": {
- "annotations": {},
- "labels": {},
- "name": "console"
- },
- "objects": [
- {
- "apiVersion": "v1beta3",
- "kind": "Service",
- "metadata": {
- "annotations": {},
- "labels": {
- "component": "console",
- "provider": "simple"
- },
- "name": "simple"
- },
- "spec": {
- "ports": [
- {
- "port": 80,
- "protocol": "TCP",
- "targetPort": 9090
- }
- ],
- "publicIPs": ["${DOMAIN}"],
- "selector": {
- "component": "console",
- "provider": "simple"
- }
- }
- }
- ],
- "parameters": [
- {
- "description": "The target port",
- "name": "DOMAIN",
- "value": "my.domain.org"
- }
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/test/resources/valid-pod.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/test/resources/valid-pod.json b/dependencies/fabric8/kubernetes-model/src/test/resources/valid-pod.json
deleted file mode 100644
index 2802a24..0000000
--- a/dependencies/fabric8/kubernetes-model/src/test/resources/valid-pod.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "apiVersion":"v1beta3",
- "kind": "Pod",
- "metadata": {
- "name": "valid-pod"
- },
- "labels": {
- "name": "valid-pod"
- },
- "spec": {
- "containers": [{
- "name": "kubernetes-serve-hostname",
- "image": "gcr.io/google_containers/serve_hostname",
- "resources": {
- "limits": {
- "cpu": "1",
- "memory": "5Mi"
- }
- }
- }]
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/pom.xml
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/pom.xml b/dependencies/fabric8/pom.xml
index 1421ddf..a67c452 100644
--- a/dependencies/fabric8/pom.xml
+++ b/dependencies/fabric8/pom.xml
@@ -34,7 +34,6 @@
<description>Fabric8 fork</description>
<modules>
- <module>kubernetes-model</module>
<module>kubernetes-api</module>
</modules>
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
----------------------------------------------------------------------
diff --git a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml b/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
index 838dfb3..6fde34e 100644
--- a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
+++ b/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
@@ -254,12 +254,7 @@
<dependency>
<groupId>org.apache.stratos</groupId>
<artifactId>kubernetes-api</artifactId>
- <version>2.1.11-stratosv1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.stratos</groupId>
- <artifactId>kubernetes-model</artifactId>
- <version>2.1.11-stratosv1</version>
+ <version>${kubernetes.api.stratos.version}</version>
</dependency>
</dependencies>
@@ -365,8 +360,7 @@
<bundleDef>org.apache.jclouds.api:sts:${jclouds.version}</bundleDef>
<bundleDef>javax.ws.rs:jsr311-api:1.1.1</bundleDef>
<bundleDef>org.apache.stratos:org.apache.stratos.messaging:${project.version}</bundleDef>
- <bundleDef>org.apache.stratos:kubernetes-api:2.1.11-stratosv1</bundleDef>
- <bundleDef>org.apache.stratos:kubernetes-model:2.1.11-stratosv1</bundleDef>
+ <bundleDef>org.apache.stratos:kubernetes-api:${kubernetes.api.stratos.version}</bundleDef>
</bundles>
<importBundles>
</importBundles>
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index eeffb26..8ba74d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -554,5 +554,7 @@
<axis2.osgi.version>1.6.1.wso2v10</axis2.osgi.version>
<jclouds.version>1.8.1</jclouds.version>
<project.jclouds.stratos.version>1.8.1-stratos</project.jclouds.stratos.version>
+ <kubernetes.api.version>2.2.16</kubernetes.api.version>
+ <kubernetes.api.stratos.version>2.2.16-stratosv1</kubernetes.api.stratos.version>
</properties>
</project>
[09/12] stratos git commit: Upgrading fabric8 kubernetes api version
to 2.2.16 and removing forked code
Posted by ga...@apache.org.
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);
- }
-}
[08/12] stratos git commit: Upgrading fabric8 kubernetes api version
to 2.2.16 and removing forked code
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesClient.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesClient.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesClient.java
deleted file mode 100644
index 78faa40..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesClient.java
+++ /dev/null
@@ -1,1618 +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.builds.Builds;
-import io.fabric8.kubernetes.api.extensions.Configs;
-import io.fabric8.kubernetes.api.model.*;
-import io.fabric8.kubernetes.api.model.config.Config;
-import io.fabric8.kubernetes.api.model.config.Context;
-import io.fabric8.openshift.api.model.*;
-import io.fabric8.openshift.api.model.template.Template;
-import io.fabric8.utils.*;
-import org.apache.cxf.jaxrs.client.WebClient;
-import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
-import org.eclipse.jetty.websocket.client.WebSocketClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.validation.constraints.NotNull;
-import javax.ws.rs.*;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URL;
-import java.util.*;
-import java.util.Objects;
-import java.util.concurrent.Callable;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.*;
-
-/**
- * A simple client interface abstracting away the details of working with
- * the {@link io.fabric8.kubernetes.api.KubernetesFactory} and the differences between
- * the core {@link io.fabric8.kubernetes.api.Kubernetes} API and the {@link io.fabric8.kubernetes.api.KubernetesExtensions}
- */
-public class KubernetesClient implements Kubernetes, KubernetesExtensions, KubernetesGlobalExtensions {
- private static final transient Logger LOG = LoggerFactory.getLogger(KubernetesClient.class);
- private static final long DEFAULT_TRIGGER_TIMEOUT = 60 * 1000;
-
- private KubernetesFactory factory;
- private Kubernetes kubernetes;
- private KubernetesExtensions kubernetesExtensions;
- private KubernetesGlobalExtensions kubernetesGlobalExtensions;
- private String namespace = defaultNamespace();
-
- public static String defaultNamespace() {
- String namespace = System.getenv("KUBERNETES_NAMESPACE");
- if (Strings.isNullOrBlank(namespace)) {
- namespace = findDefaultOpenShiftNamespace();
- }
- if (Strings.isNotBlank(namespace)) {
- return namespace;
- }
- return "default";
- }
-
- public static String findDefaultOpenShiftNamespace() {
- Config config = Configs.parseConfigs();
- if (config != null) {
- Context context = Configs.getCurrentContext(config);
- if (context != null) {
- return context.getNamespace();
- }
- }
- return null;
- }
-
- public KubernetesClient() {
- this(new KubernetesFactory());
- }
-
- public KubernetesClient(String url) {
- this(new KubernetesFactory(url));
- }
-
- public KubernetesClient(KubernetesFactory factory) {
- this.factory = factory;
- }
-
- // Properties
- //-------------------------------------------------------------------------
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
- public Kubernetes getKubernetes() {
- if (kubernetes == null) {
- kubernetes = getFactory().createKubernetes();
- }
- return kubernetes;
- }
-
- public KubernetesExtensions getKubernetesExtensions() {
- if (kubernetesExtensions == null) {
- kubernetesExtensions = getFactory().createKubernetesExtensions();
- }
- return kubernetesExtensions;
- }
-
- public KubernetesGlobalExtensions getKubernetesGlobalExtensions() {
- if (kubernetesGlobalExtensions == null) {
- kubernetesGlobalExtensions = getFactory().createKubernetesGlobalExtensions();
- }
- return kubernetesGlobalExtensions;
- }
-
- public KubernetesFactory getFactory() {
- if (factory == null) {
- factory = new KubernetesFactory();
- }
- return factory;
- }
-
- public void setFactory(KubernetesFactory factory) {
- this.factory = factory;
- }
-
- public String getAddress() {
- return getFactory().getAddress();
- }
-
- public String getWriteableAddress() {
- return getFactory().getAddress();
- }
-
-
- // Delegated Kubernetes API
- //-------------------------------------------------------------------------
-
- @Override
- @GET
- @Path("namespaces")
- public NamespaceList getNamespaces() {
- return getKubernetes().getNamespaces();
- }
-
- @Override
- public String createNamespace(Namespace entity) throws Exception {
- return getKubernetes().createNamespace(entity);
- }
-
- @Override
- @GET
- @Path("namespaces/{name}")
- public Namespace getNamespace(final @NotNull String name) {
- return handle404ByReturningNull(new Callable<Namespace>() {
- @Override
- public Namespace call() throws Exception {
- return getKubernetes().getNamespace(name);
- }
- });
- }
-
- @Override
- @PUT
- @Path("namespaces/{name}")
- @Consumes("application/json")
- public String updateNamespace(@NotNull String namespaceId, Namespace entity) throws Exception {
- return getKubernetes().updateNamespace(namespaceId, entity);
- }
-
- @Override
- @DELETE
- @Path("namespaces/{name}")
- @Consumes("text/plain")
- public String deleteNamespace(@NotNull String name) throws Exception {
- return getKubernetes().deleteNamespace(name);
- }
-
- @GET
- @Path("pods")
- public PodList getPods() {
- return getPods(getNamespace());
- }
-
- @Override
- public PodList getPods(@QueryParam("namespace") String namespace) {
- validateNamespace(namespace, null);
- return getKubernetes().getPods(namespace);
- }
-
- @DELETE
- @Path("pods/{podId}")
- public String deletePod(@NotNull String podId) throws Exception {
- validateNamespace(namespace, podId);
- return getKubernetes().deletePod(podId, getNamespace());
- }
-
- @Override
- @DELETE
- @Path("pods/{podId}")
- @Consumes("text/plain")
- public String deletePod(@NotNull String podId, String namespace) throws Exception {
- validateNamespace(namespace, podId);
- return getKubernetes().deletePod(podId, namespace);
- }
-
- @GET
- @Path("replicationControllers/{controllerId}")
- @Produces("application/json")
- public ReplicationController getReplicationController(@NotNull String controllerId) {
- validateNamespace(namespace, controllerId);
- return getReplicationController(controllerId, getNamespace());
- }
-
- @Override
- public ReplicationController getReplicationController(final @PathParam("controllerId") @NotNull String controllerId, final @QueryParam("namespace") String namespace) {
- validateNamespace(namespace, controllerId);
- return handle404ByReturningNull(new Callable<ReplicationController>() {
- @Override
- public ReplicationController call() throws Exception {
- return getKubernetes().getReplicationController(controllerId, namespace);
- }
- });
- }
-
- @DELETE
- @Path("replicationControllers/{controllerId}")
- @Produces("application/json")
- public String deleteReplicationController(@NotNull String controllerId) throws Exception {
- validateNamespace(namespace, controllerId);
- return getKubernetes().deleteReplicationController(controllerId, getNamespace());
- }
-
- @Override
- @DELETE
- @Path("replicationControllers/{controllerId}")
- @Produces("application/json")
- @Consumes("text/plain")
- public String deleteReplicationController(@NotNull String controllerId, String namespace) throws Exception {
- validateNamespace(namespace, controllerId);
- return getKubernetes().deleteReplicationController(controllerId, namespace);
- }
-
- @Override
- @DELETE
- @Path("services/{serviceId}")
- @Produces("application/json")
- @Consumes("text/plain")
- public String deleteService(@NotNull String serviceId, String namespace) throws Exception {
- validateNamespace(namespace, serviceId);
- return getKubernetes().deleteService(serviceId, namespace);
- }
-
- @Path("replicationControllers")
- @GET
- @Produces("application/json")
- public ReplicationControllerList getReplicationControllers() {
- return getReplicationControllers(getNamespace());
- }
-
- @Override
- public ReplicationControllerList getReplicationControllers(@QueryParam("namespace") String namespace) {
- validateNamespace(namespace, null);
- return getKubernetes().getReplicationControllers(namespace);
- }
-
- @PUT
- @Path("replicationControllers/{controllerId}")
- @Consumes("application/json")
- public String updateReplicationController(@NotNull String controllerId, ReplicationController entity) throws Exception {
- validateNamespace(namespace, entity);
- return updateReplicationController(controllerId, entity, getNamespace());
- }
-
- @PUT
- @Path("replicationControllers/{controllerId}")
- @Consumes("application/json")
- public String updateReplicationController(@NotNull String controllerId, ReplicationController entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- if (!KubernetesHelper.hasResourceVersion(entity)) {
- // lets load it from the oldEntity
- ReplicationController oldEntity = getReplicationController(controllerId, namespace);
- if (oldEntity == null) {
- // no entity exists so lets create a new one
- return createReplicationController(entity, namespace);
- }
- String resourceVersion = KubernetesHelper.getResourceVersion(oldEntity);
- KubernetesHelper.getOrCreateMetadata(entity).setResourceVersion(resourceVersion);
- }
- return getKubernetes().updateReplicationController(controllerId, entity, namespace);
- }
-
- @PUT
- @Path("services/{serviceId}")
- @Consumes("application/json")
- public String updateService(@NotNull String serviceId, Service entity) throws Exception {
- validateNamespace(namespace, entity);
- return updateService(serviceId, entity, getNamespace());
- }
-
- @Override
- public String updateService(@PathParam("serviceId") @NotNull String serviceId, Service entity, @QueryParam("namespace") String namespace) throws Exception {
- validateNamespace(namespace, entity);
- if (!KubernetesHelper.hasResourceVersion(entity)) {
- // lets load it from the old service
- Service service = getService(serviceId, namespace);
- if (service == null) {
- // no service so lets create the service
- return createService(entity, namespace);
- }
- String resourceVersion = KubernetesHelper.getResourceVersion(service);
- KubernetesHelper.getOrCreateMetadata(entity).setResourceVersion(resourceVersion);
-
- // lets copy over some fields set on the spec by kubernetes
- ServiceSpec oldSpec = service.getSpec();
- ServiceSpec newSpec = entity.getSpec();
- if (oldSpec != null && newSpec != null) {
- if (Strings.isNullOrBlank(newSpec.getPortalIP())) {
- newSpec.setPortalIP(oldSpec.getPortalIP());
- }
- }
-
- }
- return getKubernetes().updateService(serviceId, entity, namespace);
- }
-
- @GET
- @Path("services/{serviceId}")
- @Produces("application/json")
- public Service getService(@NotNull String serviceId) {
- return getService(serviceId, getNamespace());
- }
-
- @Override
- public Service getService(final @PathParam("serviceId") @NotNull String serviceId, final @QueryParam("namespace") String namespace) {
- validateNamespace(namespace, serviceId);
- return handle404ByReturningNull(new Callable<Service>() {
- @Override
- public Service call() throws Exception {
- return getKubernetes().getService(serviceId, namespace);
- }
- });
- }
-
- @DELETE
- @Path("services/{serviceId}")
- @Produces("application/json")
- public String deleteService(@NotNull String serviceId) throws Exception {
- validateNamespace(namespace, serviceId);
- return deleteService(serviceId, getNamespace());
- }
-
- @GET
- @Path("pods/{podId}")
- public Pod getPod(@NotNull String podId) {
- return getPod(podId, getNamespace());
- }
-
- @Override
- public Pod getPod(final @PathParam("podId") @NotNull String podId, final @QueryParam("namespace") String namespace) {
- validateNamespace(namespace, podId);
- return handle404ByReturningNull(new Callable<Pod>() {
- @Override
- public Pod call() throws Exception {
- return getKubernetes().getPod(podId, namespace);
- }
- });
- }
-
- @PUT
- @Path("pods/{podId}")
- @Consumes("application/json")
- public String updatePod(@NotNull String podId, Pod entity) throws Exception {
- return updatePod(podId, entity, getNamespace());
- }
-
- @Override
- public String updatePod(@PathParam("podId") @NotNull String podId, Pod entity, @QueryParam("namespace") String namespace) throws Exception {
- validateNamespace(namespace, podId);
- return getKubernetes().updatePod(podId, entity, namespace);
- }
-
- @Path("services")
- @GET
- @Produces("application/json")
- public ServiceList getServices() {
- validateNamespace(namespace, null);
- return getServices(getNamespace());
- }
-
- @Override
- public ServiceList getServices(@QueryParam("namespace") String namespace) {
- validateNamespace(namespace, null);
- return getKubernetes().getServices(namespace);
- }
-
- @POST
- @Path("pods")
- @Consumes("application/json")
- public String createPod(Pod entity) throws Exception {
- validateNamespace(namespace, entity);
- return createPod(entity, getNamespace());
- }
-
- @Override
- @POST
- @Path("pods")
- @Consumes("application/json")
- public String createPod(Pod entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- getOrCreateMetadata(entity).setNamespace(namespace);
- return getKubernetes().createPod(entity, namespace);
- }
-
- @Path("services")
- @POST
- @Consumes("application/json")
- public String createService(Service entity) throws Exception {
- validateNamespace(namespace, entity);
- return createService(entity, getNamespace());
- }
-
- @Override
- @Path("services")
- @POST
- @Consumes("application/json")
- public String createService(Service entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- getOrCreateMetadata(entity).setNamespace(namespace);
- return getKubernetes().createService(entity, namespace);
- }
-
- @Path("replicationControllers")
- @POST
- @Consumes("application/json")
- public String createReplicationController(ReplicationController entity) throws Exception {
- validateNamespace(namespace, entity);
- return createReplicationController(entity, getNamespace());
- }
-
- @Override
- @Path("replicationControllers")
- @POST
- @Consumes("application/json")
- public String createReplicationController(ReplicationController entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- getOrCreateMetadata(entity).setNamespace(namespace);
- return getKubernetes().createReplicationController(entity, namespace);
- }
-
- @GET
- @Path("endpoints")
- public EndpointsList getEndpoints() {
- return getEndpoints(getNamespace());
- }
-
- @Override
- @GET
- @Path("endpoints")
- public EndpointsList getEndpoints(String namespace) {
- validateNamespace(namespace, null);
- return getKubernetes().getEndpoints(namespace);
- }
-
- @Override
- @GET
- @Path("endpoints/{serviceId}")
- public Endpoints endpointsForService(@NotNull String serviceId, String namespace) {
- try {
- validateNamespace(namespace, serviceId);
- return getKubernetes().endpointsForService(serviceId, namespace);
- } catch (WebApplicationException e) {
- if (e.getResponse().getStatus() == 404) {
- // does not exist
- Endpoints answer = new Endpoints();
- answer.setSubsets(new ArrayList<EndpointSubset>());
- return answer;
- } else {
- throw e;
- }
- }
- }
-
- @Override
- @Path("namespaces/{namespace}/secrets")
- @POST
- @Consumes("application/json")
- public String createSecret(Secret entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- return getKubernetes().createSecret(entity, namespace);
- }
-
- @Override
- @DELETE
- @Path("namespaces/{namespace}/secrets/{secretId}")
- @Produces("application/json")
- @Consumes("text/plain")
- public String deleteSecret(@NotNull String secretId, String namespace) throws Exception {
- validateNamespace(namespace, secretId);
- return getKubernetes().deleteSecret(secretId, namespace);
- }
-
- @Override
- @GET
- @Path("namespaces/{namespace}/secrets/{secretId}")
- @Produces("application/json")
- public Secret getSecret(final @NotNull String secretId, final String namespace) {
- validateNamespace(namespace, secretId);
- return handle404ByReturningNull(new Callable<Secret>() {
- @Override
- public Secret call() throws Exception {
- return getKubernetes().getSecret(secretId, namespace);
- }
- });
- }
-
- @Override
- @Path("namespaces/{namespace}/secrets")
- @GET
- @Produces("application/json")
- public SecretList getSecrets(final String namespace) {
- validateNamespace(namespace, null);
- SecretList answer = handle404ByReturningNull(new Callable<SecretList>() {
- @Override
- public SecretList call() throws Exception {
- return getKubernetes().getSecrets(namespace);
- }
- });
- if (answer == null) {
- answer = new SecretList();
- }
- return answer;
- }
-
- @Override
- @PUT
- @Path("namespaces/{namespace}/secrets/{secretId}")
- @Consumes("application/json")
- public String updateSecret(@NotNull String secretId, Secret entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- return getKubernetes().updateSecret(secretId, entity, namespace);
- }
-
- @Override
- @GET
- @Path("nodes")
- public NodeList getNodes() {
- return getKubernetes().getNodes();
- }
-
- @Override
- @GET
- @Path("nodes/{nodeId}")
- public Node node(@NotNull String nodeId) {
- return getKubernetes().node(nodeId);
- }
-
- // Delegated KubernetesExtensions API
- //-------------------------------------------------------------------------
-
-
- @Override
- @POST
- @Path("oauthclients")
- @Consumes("application/json")
- public String createOAuthClient(OAuthClient entity) throws Exception {
- getOrCreateMetadata(entity).setNamespace(namespace);
- String id = getName(entity);
- LOG.info("Creating OAuthClient " + id + " " + summaryText(entity));
- return getKubernetesGlobalExtensions().createOAuthClient(entity);
- }
-
- @Override
- @DELETE
- @Path("oauthclients/{name}")
- public String deleteOAuthClient(@NotNull String name) {
- LOG.info("Deleting OAuthClient " + name);
- return getKubernetesGlobalExtensions().deleteOAuthClient(name);
- }
-
- @Override
- @GET
- @Path("oauthclients/{name}")
- public OAuthClient getOAuthClient(final @NotNull String name) {
- return handle404ByReturningNull(new Callable<OAuthClient>() {
- @Override
- public OAuthClient call() throws Exception {
- return getKubernetesGlobalExtensions().getOAuthClient(name);
- }
- });
- }
-
- @Override
- @PUT
- @Path("oauthclients/{name}")
- @Consumes("application/json")
- public String updateOAuthClient(@NotNull String name, OAuthClient entity) throws Exception {
- LOG.info("Updating OAuthClient " + name + " " + summaryText(entity));
- return getKubernetesGlobalExtensions().updateOAuthClient(name, entity);
- }
-
- @Override
- @POST
- @Path("routes")
- public String createRoute(Route entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- return getKubernetesExtensions().createRoute(entity, namespace);
- }
-
- /**
- * Temporary workaround for 0.4.x of Openshift not having osapi/v1beta3
- * @param entity
- * @param namespace
- */
- public void createRouteOldAPi(Route entity, String namespace) {
- validateNamespace(namespace, entity);
-
- WebClient webClient = getFactory().createWebClient();
- String name = getName(entity);
- RouteSpec spec = entity.getSpec();
- String host = null;
- String serviceName = null;
- if (spec != null) {
- host = spec.getHost();
- ObjectReference to = spec.getTo();
- if (to != null) {
- serviceName = to.getName();
- }
- }
- if (Strings.isNullOrBlank(host)) {
- throw new IllegalArgumentException("No host defined!");
- }
- if (Strings.isNullOrBlank(serviceName)) {
- throw new IllegalArgumentException("No to.name defined!");
- }
- String json = "{ \"kind\": \"Route\", \"apiVersion\": \"v1beta1\", \"metadata\": { \"name\": \"" + name + "\"}, \"host\": \"" + host + "\", \"serviceName\": \"" + serviceName + "\"}";
- System.out.println("Posting JSON: " + json);
- Response response = webClient.path("/osapi/v1beta1/routes").query("namespace", namespace).post(json);
- Object responseEntity = response.getEntity();
- if (responseEntity instanceof InputStream) {
- InputStream inputStream = (InputStream) responseEntity;
- try {
- responseEntity = IOHelpers.readFully(inputStream);
- } catch (IOException e) {
- LOG.error("Failed to parse response: " + e, e);
- }
- }
- System.out.println("Result: " + responseEntity);
- int status = response.getStatus();
- System.out.println("Posted and got result: " + status);
- }
-
- @Override
- @POST
- @Path("deploymentConfigs")
- public String createDeploymentConfig(DeploymentConfig entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- getOrCreateMetadata(entity).setNamespace(namespace);
- return getKubernetesExtensions().createDeploymentConfig(entity, namespace);
- }
-
- @Override
- @POST
- @Path("templates")
- @Consumes("application/json")
- public String processTemplate(Template entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- return getKubernetesExtensions().processTemplate(entity, namespace);
- }
-
- @Override
- @Path("templates")
- @POST
- @Consumes("application/json")
- public String createTemplate(Template entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- return getKubernetesExtensions().createTemplate(entity, namespace);
- }
-
- @Override
- @GET
- @Path("templates/{name}")
- @Produces("application/json")
- public Template getTemplate(final @NotNull String name, final String namespace) {
- return handle404ByReturningNull(new Callable<Template>() {
- @Override
- public Template call() throws Exception {
- return getKubernetesExtensions().getTemplate(name, namespace);
- }
- });
- }
-
- @Override
- @PUT
- @Path("templates/{name}")
- @Consumes("application/json")
- public String updateTemplate(@NotNull String name, Template entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- if (!KubernetesHelper.hasResourceVersion(entity)) {
- // lets load it from the oldEntity
- ReplicationController oldEntity = getReplicationController(name, namespace);
- if (oldEntity == null) {
- // no entity exists so lets create a new one
- return createTemplate(entity, namespace);
- }
- String resourceVersion = KubernetesHelper.getResourceVersion(oldEntity);
- KubernetesHelper.getOrCreateMetadata(entity).setResourceVersion(resourceVersion);
- }
- return getKubernetesExtensions().updateTemplate(name, entity, namespace);
- }
-
- @Override
- @DELETE
- @Path("templates/{name}")
- @Produces("application/json")
- @Consumes("text/plain")
- public String deleteTemplate(@NotNull String name, String namespace) throws Exception {
- return getKubernetesExtensions().deleteTemplate(name, namespace);
- }
-
- @Override
- @DELETE
- @Path("buildConfigs/{name}")
- public String deleteBuildConfig(@NotNull String name, String namespace) {
- validateNamespace(namespace, name);
- return getKubernetesExtensions().deleteBuildConfig(name, namespace);
- }
-
- @Override
- @DELETE
- @Path("deploymentConfigs/{name}")
- public String deleteDeploymentConfig(@NotNull String name, String namespace) {
- validateNamespace(namespace, name);
- return getKubernetesExtensions().deleteDeploymentConfig(name, namespace);
- }
-
- @GET
- @Path("routes")
- @Override
- public RouteList getRoutes(final @QueryParam("namespace") String namespace) {
- validateNamespace(namespace, null);
- RouteList answer = handle404ByReturningNull(new Callable<RouteList>() {
- @Override
- public RouteList call() throws Exception {
- return getKubernetesExtensions().getRoutes(namespace);
- }
- });
- if (answer == null) {
- answer = new RouteList();
- }
- return answer;
- }
-
- @GET
- @Path("routes/{name}")
- @Override
- public Route getRoute(final @PathParam("name") @NotNull String name, final @QueryParam("namespace") String namespace) {
- validateNamespace(namespace, name);
- return handle404ByReturningNull(new Callable<Route>() {
- @Override
- public Route call() throws Exception {
- return getKubernetesExtensions().getRoute(name, namespace);
- }
- });
- }
-
- @Override
- @PUT
- @Path("routes/{name}")
- @Consumes("application/json")
- public String updateRoute(@NotNull String name, Route entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- return getKubernetesExtensions().updateRoute(name, entity, namespace);
- }
-
- @Override
- @DELETE
- @Path("routes/{name}")
- public String deleteRoute(@NotNull String name, String namespace) {
- validateNamespace(namespace, name);
- return getKubernetesExtensions().deleteRoute(name, namespace);
- }
-
- @Override
- @POST
- @Path("builds")
- public String createBuild(Build entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- getOrCreateMetadata(entity).setNamespace(namespace);
- return getKubernetesExtensions().createBuild(entity, namespace);
- }
-
- @Override
- @DELETE
- @Path("builds/{name}")
- public String deleteBuild(@NotNull String name, String namespace) {
- validateNamespace(namespace, name);
- return getKubernetesExtensions().deleteBuild(name, namespace);
- }
-
- @Override
- @GET
- @Path("builds/{name}")
- public Build getBuild(final @NotNull String name, final String namespace) {
- validateNamespace(namespace, name);
- return handle404ByReturningNull(new Callable<Build>() {
- @Override
- public Build call() throws Exception {
- return getKubernetesExtensions().getBuild(name, namespace);
- }
- });
- }
-
- @Override
- @GET
- @Path("builds")
- @Produces("application/json")
- public BuildList getBuilds(final String namespace) {
- validateNamespace(namespace, null);
- BuildList answer = handle404ByReturningNull(new Callable<BuildList>() {
- @Override
- public BuildList call() throws Exception {
- return getKubernetesExtensions().getBuilds(namespace);
- }
- });
- if (answer == null) {
- answer = new BuildList();
- }
- return answer;
- }
-
- @Override
- @PUT
- @Path("builds/{name}")
- @Consumes("application/json")
- public String updateBuild(@NotNull String name, Build entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- return getKubernetesExtensions().updateBuild(name, entity, namespace);
- }
-
- @Override
- @GET
- @Path("buildConfigs/{name}")
- public BuildConfig getBuildConfig(final @NotNull String name, final String namespace) {
- validateNamespace(namespace, name);
- return handle404ByReturningNull(new Callable<BuildConfig>() {
- @Override
- public BuildConfig call() throws Exception {
- return getKubernetesExtensions().getBuildConfig(name, namespace);
- }
- });
- }
-
- @Override
- @GET
- @Path("buildConfigs")
- public BuildConfigList getBuildConfigs(String namespace) {
- validateNamespace(namespace, null);
- return getKubernetesExtensions().getBuildConfigs(namespace);
- }
-
- @Override
- @GET
- @Path("deploymentConfigs/{name}")
- public DeploymentConfig getDeploymentConfig(final @NotNull String name, final String namespace) {
- validateNamespace(namespace, name);
- return handle404ByReturningNull(new Callable<DeploymentConfig>() {
- @Override
- public DeploymentConfig call() throws Exception {
- return getKubernetesExtensions().getDeploymentConfig(name, namespace);
- }
- });
- }
-
- @Override
- @GET
- @Path("deploymentConfigs")
- public DeploymentConfigList getDeploymentConfigs(final String namespace) {
- validateNamespace(namespace, null);
- DeploymentConfigList answer = handle404ByReturningNull(new Callable<DeploymentConfigList>() {
- @Override
- public DeploymentConfigList call() throws Exception {
- return getKubernetesExtensions().getDeploymentConfigs(namespace);
- }
- });
- if (answer == null) {
- answer = new DeploymentConfigList();
- }
- return answer;
- }
-
- @Override
- @PUT
- @Path("buildConfigs/{name}")
- @Consumes("application/json")
- public String updateBuildConfig(@NotNull String name, BuildConfig entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- return getKubernetesExtensions().updateBuildConfig(name, entity, namespace);
- }
-
- @Override
- @PUT
- @Path("deploymentConfigs/{name}")
- @Consumes("application/json")
- public String updateDeploymentConfig(@NotNull String name, DeploymentConfig entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- return getKubernetesExtensions().updateDeploymentConfig(name, entity, namespace);
- }
-
- @Override
- @POST
- @Path("buildConfigs")
- public String createBuildConfig(BuildConfig entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- getOrCreateMetadata(entity).setNamespace(namespace);
- return getKubernetesExtensions().createBuildConfig(entity, namespace);
- }
-
- @Override
- @GET
- @Path("imageStreams/{name}")
- public ImageStream getImageStream(final @NotNull String name, final String namespace) {
- validateNamespace(namespace, name);
- return handle404ByReturningNull(new Callable<ImageStream>() {
- @Override
- public ImageStream call() throws Exception {
- return getKubernetesExtensions().getImageStream(name, namespace);
- }
- });
- }
-
- @Override
- @GET
- @Path("imageStreams")
- public ImageStreamList getImageStreams(final String namespace) {
- validateNamespace(namespace, null);
- ImageStreamList answer = handle404ByReturningNull(new Callable<ImageStreamList>() {
- @Override
- public ImageStreamList call() throws Exception {
- return getKubernetesExtensions().getImageStreams(namespace);
- }
- });
- if (answer == null) {
- answer = new ImageStreamList();
- }
- return answer;
- }
-
- @Override
- @PUT
- @Path("imageStreams/{name}")
- @Consumes("application/json")
- public String updateImageStream(@NotNull String name, ImageStream entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- return getKubernetesExtensions().updateImageStream(name, entity, namespace);
- }
-
- @Override
- @DELETE
- @Path("imageStreams/{name}")
- public String deleteImageStream(@NotNull String name, String namespace) {
- validateNamespace(namespace, name);
- return getKubernetesExtensions().deleteImageStream(name, namespace);
- }
-
- @Override
- @POST
- @Path("imageStreams")
- public String createImageStream(ImageStream entity, String namespace) throws Exception {
- validateNamespace(namespace, entity);
- getOrCreateMetadata(entity).setNamespace(namespace);
- return getKubernetesExtensions().createImageStream(entity, namespace);
- }
-
- @Override
- @POST
- @Path("buildConfigHooks/{name}/{secret}/{type}")
- public String triggerBuild(@NotNull String name, String namespace, @NotNull String secret, @NotNull String type, byte[] body) {
- validateNamespace(namespace, name);
- return getKubernetesExtensions().triggerBuild(name, namespace, secret, type, body);
- }
-
- // Helper methods
- //-------------------------------------------------------------------------
- public void deletePod(Pod entity, String namespace) throws Exception {
- if (Strings.isNotBlank(namespace)) {
- entity.getMetadata().setNamespace(namespace);
- }
- deletePod(entity);
- }
-
- public void deletePod(Pod entity) throws Exception {
- String namespace = KubernetesHelper.getNamespace(entity);
- String id = getName(entity);
- validateNamespace(namespace, entity);
- LOG.info("Deleting Pod: " + id + " namespace: " + namespace);
- if (Strings.isNotBlank(namespace)) {
- deletePod(id, namespace);
- } else {
- deletePod(id);
- }
- }
-
- public void deleteService(Service entity, String namespace) throws Exception {
- if (Strings.isNotBlank(namespace)) {
- entity.getMetadata().setNamespace(namespace);
- }
- deleteService(entity);
- }
-
- public void deleteService(Service entity) throws Exception {
- String namespace = KubernetesHelper.getNamespace(entity);
- String id = getName(entity);
- validateNamespace(namespace, entity);
- LOG.info("Deleting Service: " + id + " namespace: " + namespace);
- if (Strings.isNotBlank(namespace)) {
- deleteService(id, namespace);
- } else {
- deleteService(id);
- }
- }
-
- public void deleteReplicationControllerAndPods(ReplicationController replicationController, String namespace) throws Exception {
- if (Strings.isNotBlank(namespace)) {
- replicationController.getMetadata().setNamespace(namespace);
- }
- deleteReplicationControllerAndPods(replicationController);
- }
-
- public void deleteReplicationControllerAndPods(ReplicationController replicationController) throws Exception {
- String id = getName(replicationController);
- String namespace = KubernetesHelper.getNamespace(replicationController);
- validateNamespace(namespace, replicationController);
- LOG.info("Deleting ReplicationController: " + id + " namespace: " + namespace);
- deleteReplicationController(replicationController);
- List<Pod> podsToDelete = getPodsForReplicationController(replicationController);
- for (Pod pod : podsToDelete) {
- deletePod(pod);
- }
- }
-
- /**
- * Validates a namespace is supplied giving a meaningful error if not
- */
- protected void validateNamespace(String namespace, Object entity) {
- if (Strings.isNullOrBlank(namespace)) {
- String message = "No namespace supported";
- if (entity != null) {
- message += " for " + KubernetesHelper.summaryText(entity);
- }
- throw new IllegalArgumentException(message);
- }
- }
-
- public void deleteReplicationController(ReplicationController replicationController, String namespace) throws Exception {
- if (Strings.isNotBlank(namespace)) {
- replicationController.getMetadata().setNamespace(namespace);
- }
- deleteReplicationController(replicationController);
- }
-
- public void deleteReplicationController(ReplicationController entity) throws Exception {
- String namespace = KubernetesHelper.getNamespace(entity);
- String id = getName(entity);
- if (Strings.isNotBlank(namespace)) {
- deleteReplicationController(id, namespace);
- } else {
- deleteReplicationController(id);
- }
- }
-
- public ReplicationController getReplicationControllerForPod(String podId) {
- Pod pod = getPod(podId);
- return getReplicationControllerForPod(pod);
- }
-
- public ReplicationController getReplicationControllerForPod(Pod pod) {
- if (pod != null) {
- Map<String, String> labels = pod.getMetadata().getLabels();
- if (labels != null && labels.size() > 0) {
- ReplicationControllerList replicationControllers = getReplicationControllers();
- List<ReplicationController> items = replicationControllers.getItems();
- if (items != null) {
- List<ReplicationController> matched = new ArrayList<>();
- for (ReplicationController item : items) {
- if (filterLabels(labels, item.getMetadata().getLabels())) {
- matched.add(item);
- }
- }
- int matchedSize = matched.size();
- if (matchedSize > 1) {
- // lets remove all the RCs with no current replicas and hope there's only 1 left
- List<ReplicationController> nonZeroReplicas = Filters.filter(matched, new Filter<ReplicationController>() {
- @Override
- public boolean matches(ReplicationController replicationController) {
- ReplicationControllerSpec replicationControllerSpec = replicationController.getSpec();
- if (replicationControllerSpec != null) {
- Integer desiredReplicas = replicationControllerSpec.getReplicas();
- if (desiredReplicas != null && desiredReplicas.intValue() > 0) {
- ReplicationControllerStatus currentStatus = replicationController.getStatus();
- if (currentStatus != null) {
- Integer replicas = currentStatus.getReplicas();
- if (replicas != null && replicas.intValue() > 0) {
- return true;
- }
- }
- }
- }
- return false;
- }
- });
- int size = nonZeroReplicas.size();
- if (size > 0) {
- // lets pick the first one for now :)
- return nonZeroReplicas.get(0);
- }
- }
- if (matchedSize >= 1) {
- // otherwise lets pick the first one we found
- return matched.get(0);
- }
- }
- }
- }
- return null;
- }
-
- public List<Pod> getPodsForReplicationController(ReplicationController service) {
- return KubernetesHelper.getPodsForReplicationController(service, getPodList());
- }
-
- public List<Pod> getPodsForReplicationController(String replicationControllerId) {
- ReplicationController replicationController = getReplicationController(replicationControllerId);
- if (replicationController == null) {
- return Collections.EMPTY_LIST;
- } else {
- return getPodsForReplicationController(replicationController);
- }
- }
-
- public List<Pod> getPodsForService(Service service) {
- return KubernetesHelper.getPodsForService(service, getPodList());
- }
-
- public List<Pod> getPodsForService(String serviceId) {
- Service service = getService(serviceId);
- if (service == null) {
- return Collections.EMPTY_LIST;
- } else {
- return getPodsForService(service);
- }
- }
-
- public WebSocketClient watchPods(Watcher<Pod> watcher) throws Exception {
- return watchPods(null, watcher);
- }
-
- public WebSocketClient watchPods(Map<String, String> labels, Watcher<Pod> watcher) throws Exception {
- return watchPods(getNamespace(), labels, watcher);
- }
-
- public WebSocketClient watchPods(String namespace, Map<String, String> labels, Watcher<Pod> watcher) throws Exception {
- PodList currentPodList = getPods(namespace);
- return watchPods(namespace, labels, watcher,
- currentPodList.getMetadata().getResourceVersion());
- }
-
- public WebSocketClient watchPods(String namespace, Map<String, String> labels, Watcher<Pod> watcher, String resourceVersion) throws Exception {
- return watchKubernetesEntities("pods", namespace, labels, watcher, resourceVersion);
- }
-
- public WebSocketClient watchServices(Watcher<Service> watcher) throws Exception {
- return watchServices(null, watcher);
- }
-
- public WebSocketClient watchServices(Map<String, String> labels, Watcher<Service> watcher) throws Exception {
- return watchServices(getNamespace(), labels, watcher);
- }
-
- public WebSocketClient watchServices(String namespace, Map<String, String> labels, Watcher<Service> watcher) throws Exception {
- ServiceList currentServiceList = getServices(namespace);
- return watchServices(namespace, labels, watcher,
- currentServiceList.getMetadata().getResourceVersion());
- }
-
- public WebSocketClient watchServices(String namespace, Map<String, String> labels, Watcher<Service> watcher, String resourceVersion) throws Exception {
- return watchKubernetesEntities("services", namespace, labels, watcher, resourceVersion);
- }
-
- public WebSocketClient watchEndpoints(Watcher<Endpoints> watcher) throws Exception {
- return watchEndpoints(null, watcher);
- }
-
- public WebSocketClient watchEndpoints(Map<String, String> labels, Watcher<Endpoints> watcher) throws Exception {
- return watchEndpoints(getNamespace(), labels, watcher);
- }
-
- public WebSocketClient watchEndpoints(String namespace, Map<String, String> labels, Watcher<Endpoints> watcher) throws Exception {
- EndpointsList currentEndpointList = getEndpoints(namespace);
- return watchEndpoints(namespace, labels, watcher,
- currentEndpointList.getMetadata().getResourceVersion());
- }
-
- public WebSocketClient watchEndpoints(String namespace, Map<String, String> labels, Watcher<Endpoints> watcher, String resourceVersion) throws Exception {
- return watchKubernetesEntities("endpoints", namespace, labels, watcher, resourceVersion);
- }
-
- public WebSocketClient watchReplicationControllers(Watcher<ReplicationController> watcher) throws Exception {
- return watchReplicationControllers(null, watcher);
- }
-
- public WebSocketClient watchReplicationControllers(Map<String, String> labels, Watcher<ReplicationController> watcher) throws Exception {
- return watchReplicationControllers(getNamespace(), labels, watcher);
- }
-
- public WebSocketClient watchReplicationControllers(String namespace, Map<String, String> labels, Watcher<ReplicationController> watcher) throws Exception {
- ReplicationControllerList currentReplicationControllerList = getReplicationControllers(namespace);
- return watchReplicationControllers(namespace, labels, watcher,
- currentReplicationControllerList.getMetadata().getResourceVersion());
- }
-
- public WebSocketClient watchReplicationControllers(String namespace, Map<String, String> labels, Watcher<ReplicationController> watcher, String resourceVersion) throws Exception {
- return watchKubernetesEntities("replicationcontrollers", namespace, labels, watcher, resourceVersion);
- }
-
- public WebSocketClient watchBuilds(Watcher<Build> watcher) throws Exception {
- return watchBuilds(null, watcher);
- }
-
- public WebSocketClient watchBuilds(Map<String, String> labels, Watcher<Build> watcher) throws Exception {
- return watchBuilds(getNamespace(), labels, watcher);
- }
-
- public WebSocketClient watchBuilds(String namespace, Map<String, String> labels, Watcher<Build> watcher) throws Exception {
- BuildList currentList = getBuilds(namespace);
- return watchBuilds(namespace, labels, watcher,
- currentList.getMetadata().getResourceVersion());
- }
-
- public WebSocketClient watchBuilds(String namespace, Map<String, String> labels, Watcher<Build> watcher, String resourceVersion) throws Exception {
- return watchOpenShiftEntities("builds", namespace, labels, watcher, resourceVersion);
- }
-
- public WebSocketClient watchRoutes(Watcher<Route> watcher) throws Exception {
- return watchRoutes(null, watcher);
- }
-
- public WebSocketClient watchRoutes(Map<String, String> labels, Watcher<Route> watcher) throws Exception {
- return watchRoutes(getNamespace(), labels, watcher);
- }
-
- public WebSocketClient watchRoutes(String namespace, Map<String, String> labels, Watcher<Route> watcher) throws Exception {
- RouteList currentList = getRoutes(namespace);
- return watchRoutes(namespace, labels, watcher,
- currentList.getMetadata().getResourceVersion());
- }
-
- public WebSocketClient watchRoutes(String namespace, Map<String, String> labels, Watcher<Route> watcher, String resourceVersion) throws Exception {
- return watchOpenShiftEntities("routes", namespace, labels, watcher, resourceVersion);
- }
-
- public WebSocketClient watchDeploymentConfigs(Watcher<DeploymentConfig> watcher) throws Exception {
- return watchDeploymentConfigs(null, watcher);
- }
-
- public WebSocketClient watchDeploymentConfigs(Map<String, String> labels, Watcher<DeploymentConfig> watcher) throws Exception {
- return watchDeploymentConfigs(getNamespace(), labels, watcher);
- }
-
- public WebSocketClient watchDeploymentConfigs(String namespace, Map<String, String> labels, Watcher<DeploymentConfig> watcher) throws Exception {
- DeploymentConfigList currentList = getDeploymentConfigs(namespace);
- return watchDeploymentConfigs(namespace, labels, watcher,
- currentList.getMetadata().getResourceVersion());
- }
-
- public WebSocketClient watchDeploymentConfigs(String namespace, Map<String, String> labels, Watcher<DeploymentConfig> watcher, String resourceVersion) throws Exception {
- return watchOpenShiftEntities("deploymentconfigs", namespace, labels, watcher, resourceVersion);
- }
-
- private WebSocketClient watchKubernetesEntities(String entityType, String namespace, Map<String, String> labels, Watcher<? extends HasMetadata> watcher, String resourceVersion) throws Exception {
- return watchEntities(Kubernetes.ROOT_API_PATH, entityType, namespace, labels, watcher, resourceVersion);
- }
-
- private WebSocketClient watchOpenShiftEntities(String entityType, String namespace, Map<String, String> labels, Watcher<? extends HasMetadata> watcher, String resourceVersion) throws Exception {
- return watchEntities(KubernetesExtensions.OSAPI_ROOT_PATH, entityType, namespace, labels, watcher, resourceVersion);
- }
-
- private WebSocketClient watchEntities(String apiPath, String entityType, String namespace, Map<String, String> labels, Watcher<? extends HasMetadata> watcher, String resourceVersion) throws Exception {
- String watchUrl = getAddress().replaceFirst("^http", "ws") + "/" + apiPath + "/namespaces/" + namespace + "/" + entityType + "?watch=true&resourceVersion=" + resourceVersion;
- String labelsString = toLabelsString(labels);
- if (Strings.isNotBlank(labelsString)) {
- watchUrl += "&labelSelector=" + labelsString;
- }
- LOG.debug("Connecting to {}", watchUrl);
-
- WebSocketClient client = getFactory().createWebSocketClient();
- try {
- URI watchUri = URI.create(watchUrl);
- ClientUpgradeRequest upgradeRequest = new ClientUpgradeRequest();
- upgradeRequest.setRequestURI(watchUri);
- upgradeRequest.setHeader("Origin", watchUri.getHost() + ":" + watchUri.getPort());
- String token = getFactory().findToken();
- if (token != null) {
- upgradeRequest.setHeader("Authorization", "Bearer " + token);
- }
- client.start();
- client.connect(watcher, watchUri, upgradeRequest);
- return client;
- } catch (Throwable t) {
- LOG.error("Failed to watch pods", t);
- return null;
- }
- }
-
- /**
- * Returns the URL to access the service; using the environment variables, routes
- * or service portalIP address
- *
- * @throws IllegalArgumentException if the URL cannot be found for the serviceName and namespace
- */
- public String getServiceURL(String serviceName, String namespace, String serviceProtocol, boolean serviceExternal) {
- Service srv = null;
- String serviceHost = serviceToHost(serviceName);
- String servicePort = serviceToPort(serviceName);
- String serviceProto = serviceProtocol != null ? serviceProtocol : serviceToProtocol(serviceName, servicePort);
-
- //1. Inside Kubernetes: Services as ENV vars
- if (!serviceExternal && Strings.isNotBlank(serviceHost) && Strings.isNotBlank(servicePort) && Strings.isNotBlank(serviceProtocol)) {
- return serviceProtocol + "://" + serviceHost + ":" + servicePort;
- //2. Anywhere: When namespace is passed System / Env var. Mostly needed for integration tests.
- } else if (Strings.isNotBlank(namespace)) {
- srv = getService(serviceName, namespace);
- } else {
- for (Service s : getServices().getItems()) {
- String sid = getName(s);
- if (serviceName.equals(sid)) {
- srv = s;
- break;
- }
- }
- }
- if (srv == null) {
- throw new IllegalArgumentException("No kubernetes service could be found for name: " + serviceName + " in namespace: " + namespace);
- }
- RouteList routeList = getRoutes(namespace);
- for (Route route : routeList.getItems()) {
- if (route.getSpec().getTo().getName().equals(serviceName)) {
- return (serviceProto + "://" + route.getSpec().getHost()).toLowerCase();
- }
- }
- return (serviceProto + "://" + srv.getSpec().getPortalIP() + ":" + srv.getSpec().getPorts().iterator().next().getPort()).toLowerCase();
- }
-
-
- // Extension helper methods
- //-------------------------------------------------------------------------
-
- /**
- * Returns the route for the given id and namespace or null if it could not be found.
- */
- public Route findRoute(String id, String namespace) {
- Route route = null;
- try {
- route = getRoute(id, namespace);
- } catch (WebApplicationException e) {
- if (e.getResponse().getStatus() == 404) {
- // does not exist
- } else {
- throw e;
- }
- }
- return route;
- }
-
- /**
- * Triggers a build and returns the UID of the newly created build if it can be found within the default time period
- */
- public String triggerBuildAndGetUuid(@NotNull String name, String namespace) {
- return triggerBuildAndGetUuid(name, namespace, DEFAULT_TRIGGER_TIMEOUT);
- }
-
- /**
- * Triggers a build and returns the UID of the newly created build if it can be found within the given time period
- */
- public String triggerBuildAndGetUuid(@NotNull String name, String namespace, long maxTimeoutMs) {
- String answer = triggerBuild(name, namespace);
- if (Strings.isNullOrBlank(answer)) {
- // lets poll the builds to find the latest build for this name
- int sleepMillis = 2000;
- long endTime = System.currentTimeMillis() + maxTimeoutMs;
- while (true) {
- Build build = findLatestBuild(name, namespace);
- // lets assume that the build is created immediately on the webhook
- if (build != null) {
- String uid = Builds.getUid(build);
- answer = uid;
- break;
- }
- if (System.currentTimeMillis() > endTime) {
- break;
- } else {
- try {
- Thread.sleep(sleepMillis);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
-
- }
- return answer;
- }
-
- /**
- * Returns all the builds for the given buildConfigName and namespace
- */
- public List<Build> findBuilds(String buildConfigName, String namespace) {
- List<Build> answer = new ArrayList<>();
- BuildList buildList = getBuilds(namespace);
- if (buildList != null) {
- List<Build> items = buildList.getItems();
- if (items != null) {
- for (Build build : items) {
- String namespace2 = Builds.getNamespace(build);
- String name2 = Builds.getBuildConfigName(build);
- if (Objects.equals(namespace, namespace2) && Objects.equals(buildConfigName, name2)) {
- answer.add(build);
- }
- }
- }
- }
- return answer;
- }
-
- public Build findLatestBuild(String name, String namespace) {
- List<Build> builds = findBuilds(name, namespace);
- int size = builds.size();
- if (size < 1) {
- return null;
- } else if (size == 1) {
- return builds.get(0);
- } else {
- // TODO add each build and sort by date...
- SortedMap<Date, Build> map = new TreeMap<>();
- for (Build build : builds) {
- Date date = Builds.getCreationTimestampDate(build);
- if (date != null) {
- Build otherBuild = map.get(date);
- if (otherBuild != null) {
- LOG.warn("Got 2 builds at the same time: " + build + " and " + otherBuild);
- } else {
- map.put(date, build);
- }
- }
- }
- Date lastKey = map.lastKey();
- Build build = map.get(lastKey);
- if (build == null) {
- LOG.warn("Should have a value for the last key " + lastKey + " for builds " + map);
- }
- return build;
- }
- }
-
- public String triggerBuild(@NotNull String name, String namespace) {
- BuildConfig buildConfig = getBuildConfig(name, namespace);
- if (buildConfig != null) {
- List<BuildTriggerPolicy> triggers = buildConfig.getSpec().getTriggers();
- String type = null;
- String secret = null;
- for (BuildTriggerPolicy trigger : triggers) {
- WebHookTrigger hook = trigger.getGeneric();
- if (hook != null) {
- secret = hook.getSecret();
- String aType = trigger.getType();
- if (Strings.isNotBlank(secret) && Strings.isNotBlank(aType)) {
- type = aType;
- }
- }
- }
- if (Strings.isNullOrBlank(secret) || Strings.isNullOrBlank(type)) {
- for (BuildTriggerPolicy trigger : triggers) {
- WebHookTrigger hook = trigger.getGithub();
- if (hook != null) {
- secret = hook.getSecret();
- String aType = trigger.getType();
- if (Strings.isNotBlank(secret) && Strings.isNotBlank(aType)) {
- type = aType;
- }
- }
- }
- }
- if (Strings.isNullOrBlank(type)) {
- throw new IllegalArgumentException("BuildConfig does not have a generic or github trigger for build: " + name + " namespace: "+ namespace);
- }
- if (Strings.isNullOrBlank(secret)) {
- throw new IllegalArgumentException("BuildConfig does not have secret for build: " + name + " namespace: "+ namespace);
- }
- LOG.info("Triggering build " + name + " namespace: " + namespace + " type: " + type);
- return doTriggerBuild(name, namespace, type, secret);
- } else {
- throw new IllegalArgumentException("No BuildConfig for build: " + name + " namespace: "+ namespace);
- }
- }
-
- protected String doTriggerBuild(String name, String namespace, String type, String secret) {
- String baseUrl;
- String url;
- WebClient webClient;
- boolean useVanillaUrl = true;
- boolean useFabric8Console = true;
- if (useFabric8Console) {
- // lets proxy through the fabric8 console REST API to work around bugs in OpenShift...
- baseUrl = getServiceURL(ServiceNames.FABRIC8_CONSOLE, namespace, "http", false);
- url = URLUtils.pathJoin("/kubernetes/osapi", defaultOsApiVersion, "buildConfigHooks", name, secret, type);
- webClient = new KubernetesFactory(baseUrl, true).createWebClient();
- } else {
- // using the direct REST API...
- KubernetesFactory factory = getFactory();
- baseUrl = factory.getAddress();
- webClient = factory.createWebClient();
- url = URLUtils.pathJoin("/osapi", defaultOsApiVersion, "buildConfigHooks", name, secret, type);
- }
- if (Strings.isNotBlank(namespace)) {
- url += "?namespace=" + namespace;
- }
- if (useVanillaUrl) {
- String triggerBuildUrlText = URLUtils.pathJoin(baseUrl, url);
- LOG.info("Using a URL to trigger: " + triggerBuildUrlText);
- try {
- URL triggerBuildURL = new URL(triggerBuildUrlText);
- HttpURLConnection connection = (HttpURLConnection) triggerBuildURL.openConnection();
- connection.setRequestMethod("POST");
- connection.setRequestProperty("Content-Type", "application/json");
- connection.setRequestProperty("Accept", "application/json");
- connection.setDoOutput(true);
-
- OutputStreamWriter out = new OutputStreamWriter(
- connection.getOutputStream());
- out.close();
-
- int status = connection.getResponseCode();
- String message = connection.getResponseMessage();
- System.out.println("Got response code: " + status + " message: " + message);
- if (status != 200) {
- throw new WebApplicationException(status + ": " + message, status);
- } else {
- return null;
- }
- } catch (IOException e) {
- throw new WebApplicationException(e, 400);
- }
-
- } else {
-
- LOG.info("Triggering build by posting to: " + url);
-
- webClient.getHeaders().remove(HttpHeaders.ACCEPT);
- webClient = webClient.path(url).
- header(HttpHeaders.CONTENT_TYPE, "application/json");
-
- Response response = webClient.
- post(new HashMap());
- int status = response.getStatus();
- if (status != 200) {
- Object entity = response.getEntity();
- if (entity != null) {
- String message = ExceptionResponseMapper.extractErrorMessage(entity);
- throw new WebApplicationException(status + ": " + message, status);
- } else {
- throw new WebApplicationException(status);
- }
- }
- return null;
- }
- //return getKubernetesExtensions().triggerBuild(name, namespace, secret, type, new byte[0]);
- }
-
-
-
- /**
- * A helper method to handle REST APIs which throw a 404 by just returning null
- */
- protected static <T> T handle404ByReturningNull(Callable<T> callable) {
- try {
- return callable.call();
- } catch (WebApplicationException e) {
- if (e.getResponse().getStatus() == 404) {
- return null;
- } else {
- throw e;
- }
- } catch (Exception e) {
- throw new WebApplicationException(e);
- }
- }
-
-
- // implementation methods
- //-------------------------------------------------------------------------
-
- protected Collection<Pod> getPodList() {
- return getPodMap(this, namespace).values();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesExtensions.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesExtensions.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesExtensions.java
deleted file mode 100644
index 342aac6..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesExtensions.java
+++ /dev/null
@@ -1,226 +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.openshift.api.model.Build;
-import io.fabric8.openshift.api.model.BuildConfig;
-import io.fabric8.openshift.api.model.BuildConfigList;
-import io.fabric8.openshift.api.model.BuildList;
-import io.fabric8.openshift.api.model.DeploymentConfig;
-import io.fabric8.openshift.api.model.DeploymentConfigList;
-import io.fabric8.openshift.api.model.ImageStream;
-import io.fabric8.openshift.api.model.ImageStreamList;
-import io.fabric8.openshift.api.model.Route;
-import io.fabric8.openshift.api.model.RouteList;
-import io.fabric8.openshift.api.model.template.Template;
-
-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;
-
-/**
- * Various Kubernetes extensions defined in the OpenShift project
- */
-@Path(KubernetesExtensions.OSAPI_ROOT_PATH + "/namespaces/{namespace}")
-@Produces("application/json")
-@Consumes("application/json")
-public interface KubernetesExtensions {
-
- String OSAPI_ROOT_PATH = "osapi/v1beta3";
-
- @POST
- @Path("processedtemplates")
- @Consumes("application/json")
- String processTemplate(Template entity, @PathParam("namespace") String namespace) throws Exception;
-
-
-/*
- TODO uncomment when TemplateList is in the schema
-
- @Path("templates")
- @GET
- @Produces("application/json")
- TemplateList getTemplates(@PathParam("namespace") String namespace);
-*/
-
- @Path("templates")
- @POST
- @Consumes("application/json")
- String createTemplate(Template entity, @PathParam("namespace") String namespace) throws Exception;
-
- @GET
- @Path("templates/{name}")
- @Produces("application/json")
- Template getTemplate(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace);
-
- @PUT
- @Path("templates/{name}")
- @Consumes("application/json")
- String updateTemplate(@PathParam("name") @NotNull String name, Template entity, @PathParam("namespace") String namespace) throws Exception;
-
- @DELETE
- @Path("templates/{name}")
- @Produces("application/json")
- @Consumes("text/plain")
- String deleteTemplate(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace) throws Exception;
-
-
- // Routes
- //-------------------------------------------------------------------------
-
-
- @GET
- @Path("routes")
- RouteList getRoutes(@PathParam("namespace") String namespace);
-
-
- @POST
- @Path("routes")
- String createRoute(Route entity, @PathParam("namespace") String namespace) throws Exception;
-
- @GET
- @Path("routes/{name}")
- Route getRoute(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace);
-
- @PUT
- @Path("routes/{name}")
- @Consumes("application/json")
- String updateRoute(@PathParam("name") @NotNull String name, Route entity, @PathParam("namespace") String namespace) throws Exception;
-
- @DELETE
- @Path("routes/{name}")
- String deleteRoute(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace);
-
-
- // Builds
- //-------------------------------------------------------------------------
-
- @GET
- @Path("builds")
- BuildList getBuilds(@PathParam("namespace") String namespace);
-
- @POST
- @Path("builds")
- String createBuild(Build entity, @PathParam("namespace") String namespace) throws Exception;
-
- @GET
- @Path("builds/{name}")
- Build getBuild(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace);
-
- @PUT
- @Path("builds/{name}")
- @Consumes("application/json")
- String updateBuild(@PathParam("name") @NotNull String name, Build entity, @PathParam("namespace") String namespace) throws Exception;
-
- @DELETE
- @Path("builds/{name}")
- String deleteBuild(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace);
-
-
- // BuildConfigs
- //-------------------------------------------------------------------------
-
- @GET
- @Path("buildconfigs")
- BuildConfigList getBuildConfigs(@PathParam("namespace") String namespace);
-
- @POST
- @Path("buildconfigs")
- String createBuildConfig(BuildConfig entity, @PathParam("namespace") String namespace) throws Exception;
-
- @GET
- @Path("buildconfigs/{name}")
- BuildConfig getBuildConfig(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace);
-
- @PUT
- @Path("buildconfigs/{name}")
- @Consumes("application/json")
- String updateBuildConfig(@PathParam("name") @NotNull String name, BuildConfig entity, @PathParam("namespace") String namespace) throws Exception;
-
- @DELETE
- @Path("buildconfigs/{name}")
- String deleteBuildConfig(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace);
-
-
- // BuildConfigHooks
- //-------------------------------------------------------------------------
- @POST
- @Path("buildconfigHooks/{name}/{secret}/{type}")
- @Produces("text/plain")
- @Consumes("application/json")
- String triggerBuild(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace,
- @PathParam("secret") @NotNull String secret,
- @PathParam("type") @NotNull String type,
- byte[] body);
-
-
- // ImageRepositorys
- //-------------------------------------------------------------------------
-
- @GET
- @Path("imagestreams")
- ImageStreamList getImageStreams(@PathParam("namespace") String namespace);
-
- @POST
- @Path("imagestreams")
- String createImageStream(ImageStream entity, @PathParam("namespace") String namespace) throws Exception;
-
- @GET
- @Path("imagestreams/{name}")
- ImageStream getImageStream(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace);
-
- @PUT
- @Path("imagestreams/{name}")
- @Consumes("application/json")
- String updateImageStream(@PathParam("name") @NotNull String name, ImageStream entity, @PathParam("namespace") String namespace) throws Exception;
-
- @DELETE
- @Path("imagestreams/{name}")
- String deleteImageStream(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace);
-
-
- // DeploymentConfigs
- //-------------------------------------------------------------------------
-
- @GET
- @Path("deploymentconfigs")
- DeploymentConfigList getDeploymentConfigs(@PathParam("namespace") String namespace);
-
- @POST
- @Path("deploymentconfigs")
- String createDeploymentConfig(DeploymentConfig entity, @PathParam("namespace") String namespace) throws Exception;
-
- @GET
- @Path("deploymentconfigs/{name}")
- DeploymentConfig getDeploymentConfig(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace);
-
- @PUT
- @Path("deploymentconfigs/{name}")
- @Consumes("application/json")
- String updateDeploymentConfig(@PathParam("name") @NotNull String name, DeploymentConfig entity, @PathParam("namespace") String namespace) throws Exception;
-
- @DELETE
- @Path("deploymentconfigs/{name}")
- String deleteDeploymentConfig(@PathParam("name") @NotNull String name, @PathParam("namespace") String namespace);
-
-
-}
[05/12] stratos git commit: Upgrading fabric8 kubernetes api version
to 2.2.16 and removing forked code
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/kubernetes.html
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/kubernetes.html b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/kubernetes.html
deleted file mode 100644
index d7b2668..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/kubernetes.html
+++ /dev/null
@@ -1,1636 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head><title>Kubernetes API documentation</title>
- <meta http-equiv=X-UA-Compatible content="IE=edge">
- <meta http-equiv=Content-Type content="text/html; charset=utf-8">
- <meta name=generator content="https://github.com/kevinrenskers/raml2html 0.30.0">
- <link rel=stylesheet href=http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css>
- <link rel=stylesheet href=http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/styles/default.min.css>
- <script type=text/javascript src=http://code.jquery.com/jquery-1.11.0.min.js></script>
- <script type=text/javascript src=http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js></script>
- <script type=text/javascript src=http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/highlight.min.js></script>
- <script type=text/javascript>
- $(document).ready(function () {
- $('.page-header pre code, .top-resource-description pre code').each(function (i, block) {
- hljs.highlightBlock(block);
- });
-
- $('[data-toggle]').click(function () {
- var selector = $(this).data('target') + ' pre code';
- $(selector).each(function (i, block) {
- hljs.highlightBlock(block);
- });
- });
- });
- </script>
- <style>
- .hljs {
- background: transparent;
- }
-
- .parent {
- color: #999;
- }
-
- .list-group-item > .badge {
- float: none;
- margin-right: 6px;
- }
-
- .panel-title > .methods {
- float: right;
- }
-
- .badge {
- border-radius: 0;
- text-transform: uppercase;
- width: 70px;
- font-weight: normal;
- color: #f3f3f6;
- line-height: normal;
- }
-
- .badge_get {
- background-color: #63a8e2;
- }
-
- .badge_post {
- background-color: #6cbd7d;
- }
-
- .badge_put {
- background-color: #22bac4;
- }
-
- .badge_delete {
- background-color: #d26460;
- }
-
- .list-group, .panel-group {
- margin-bottom: 0;
- }
-
- .panel-group .panel + .panel-white {
- margin-top: 0;
- }
-
- .panel-group .panel-white {
- border-bottom: 1px solid #F5F5F5;
- border-radius: 0;
- }
-
- .panel-white:last-child {
- border-bottom-color: white;
- -webkit-box-shadow: none;
- box-shadow: none;
- }
-
- .panel-white .panel-heading {
- background: white;
- }
-
- .tab-pane ul {
- padding-left: 2em;
- }
-
- .tab-pane h2 {
- font-size: 1.2em;
- padding-bottom: 4px;
- border-bottom: 1px solid #ddd;
- }
-
- .tab-pane h3 {
- font-size: 1.1em;
- }
-
- .tab-content {
- border-left: 1px solid #ddd;
- border-right: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
- padding: 10px;
- }
-
- #sidebar {
- margin-top: 30px;
- }
-
- .top-resource-description {
- border-bottom: 1px solid #ddd;
- background: #fcfcfc;
- padding: 15px 15px 0 15px;
- margin: -15px -15px 10px -15px;
- }
-
- .resource-description {
- border-bottom: 1px solid #fcfcfc;
- background: #fcfcfc;
- padding: 15px 15px 0 15px;
- margin: -15px -15px 10px -15px;
- }
-
- .panel > .panel-body > .panel-group > .panel:first-child .resource-description {
- display: none;
- }
-
- .list-group .badge {
- float: left;
- }
-
- .method_description {
- margin-left: 85px;
- }
-
- .method_description p:last-child {
- margin: 0;
- }
- </style>
-</head>
-<body data-spy=scroll data-target=#sidebar>
-<div class=container>
- <div class=row>
- <div class=col-md-9 role=main>
- <div class=page-header>
- <h1>Kubernetes API documentation
- <small>version v1beta1</small>
- </h1>
- <p>http://server/api/v1beta1</p>
-
- <h3 id=Overview><a href=#Overview>Overview</a></h3>
-
- <p>The Kubernetes API currently manages 3 main resources: <code>pods</code>, <code>replicationControllers</code>,
- and <code>services</code>. Pods correspond to colocated groups of <a href=http://docker.io>Docker
- containers</a> with shared volumes, as supported by <a
- href=https://developers.google.com/compute/docs/containers>Google Cloud Platform's container-vm
- images</a>. Singleton pods can be created directly via the <code>/pods</code> endpoint. Sets of pods may
- created, maintained, and scaled using replicationControllers. Services create load-balanced targets for sets
- of pods.</p>
-
- <h3 id=Resource-identifiers><a href=#Resource-identifiers>Resource identifiers</a></h3>
-
- <p>Each resource has a string <code>id</code> and list of key-value <code>labels</code>. The <code>id</code> is
- generated by the system and is guaranteed to be unique in space and time across all resources.
- <code>labels</code> is a map of string (key) to string (value). Each resource may have at most one label with
- a particular key. Individual labels are used to specify identifying metadata that can be used to define sets
- of resources by specifying required labels. Examples of typical pod label keys include <code>stage</code>,
- <code>service</code>, <code>name</code>, <code>tier</code>, <code>partition</code>, and <code>track</code>,
- but you are free to develop your own conventions.</p>
-
- <h3 id=Creation-semantics><a href=#Creation-semantics>Creation semantics</a></h3>
-
- <p>Creation is currently not idempotent. We plan to add a modification token to each resource. A unique value
- for the token should be provided by the user during creation. If the user specifies a duplicate token at
- creation time, the system should return an error with a pointer to the existing resource with that token. In
- this way a user can deterministically recover from a dropped connection during a resource creation
- request.</p>
-
- <h3 id=Update-semantics><a href=#Update-semantics>Update semantics</a></h3>
-
- <p>Custom verbs are minimized and are used only for 'edge triggered' actions such as a reboot. Resource
- descriptions are generally set up with <code>desiredState</code> for the user provided parameters and <code>currentState</code>
- for the actual system state. While consistent terminology is used across these two stanzas they do not match
- member for member.</p>
-
- <p>When a new version of a resource is PUT the <code>desiredState</code> is updated and available immediately.
- Over time the system will work to bring the <code>currentState</code> into line with the
- <code>desiredState</code>. The system will drive toward the most recent <code>desiredState</code> regardless
- of previous versions of that stanza. In other words, if a value is changed from 2 to 5 in one PUT and then
- back down to 3 in another PUT the system isn't required to 'touch base' at 5 before making 3 the
- <code>currentState</code>.</p>
-
- <p>When doing an update, we assume that the entire <code>desiredState</code> stanza is specified. If a field is
- omitted it is assumed that the user is looking to delete that field. It is viable for a user to GET the
- resource, modify what they like in the <code>desiredState</code> or labels stanzas and then PUT it back. If
- the <code>currentState</code> is included in the PUT it will be silently ignored.</p>
-
- <p>While currently unspecified, it is intended that concurrent modification should be accomplished with
- optimistic locking of resources. We plan to add a modification token to each resource. If this is included
- with the PUT operation the system will verify that there haven't been other successful mutations to the
- resource during a read/modify/write cycle. The correct client action at this point is to GET the resource
- again, apply the changes afresh and try submitting again.</p>
-
- <p>Note that updates currently only work for replicationControllers and services, but not for pods. Label
- updates have not yet been implemented, either.</p></div>
- <div class="panel panel-default">
- <div class=panel-heading><h3 id=_pods class=panel-title>/pods</h3></div>
- <div class=panel-body>
- <div class=panel-group>
- <div class="panel panel-white">
- <div class=panel-heading><h4 class=panel-title><a class=collapsed data-toggle=collapse
- href=#panel__pods><span class=parent></span>/pods</a>
- <span class=methods><a href=# data-toggle=modal data-target=#_pods_get><span
- class="badge badge_get">get</span></a> <a href=# data-toggle=modal data-target=#_pods_post><span
- class="badge badge_post">post</span></a></span></h4></div>
- <div id=panel__pods class="panel-collapse collapse">
- <div class=panel-body>
- <div class=list-group><a href=# data-toggle=modal data-target=#_pods_get class=list-group-item><span
- class="badge badge_get">get</span>
-
- <div class=method_description><p>List all pods on this cluster</p></div>
- <div class=clearfix></div>
- </a> <a href=# data-toggle=modal data-target=#_pods_post class=list-group-item><span
- class="badge badge_post">post</span>
-
- <div class=method_description><p>Create a new pod. currentState is ignored if present.</p></div>
- <div class=clearfix></div>
- </a></div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_pods_get>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_get">get</span> <span
- class=parent></span>/pods</h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>List all pods on this cluster</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_pods_get_request data-toggle=tab>Request</a></li>
- <li><a href=#_pods_get_response data-toggle=tab>Response</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_pods_get_request></div>
- <div class=tab-pane id=_pods_get_response><h2>HTTP status code <a href=http://httpstatus.es/200
- target=_blank>200</a></h2>
-
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "kind": "PodList",
- "apiVersion": "v1beta1",
- "items": [
- {
- "id": "my-pod-1",
- "labels": {
- "name": "testRun",
- "replicationController": "testRun"
- },
- "desiredState": {
- "manifest": {
- "version": "v1beta1",
- "id": "my-pod-1",
- "containers": [{
- "name": "nginx",
- "image": "dockerfile/nginx",
- "ports": [{
- "hostPort": 8080,
- "containerPort": 80
- }]
- }]
- }
- },
- "currentState": {
- "host": "host-1"
- }
- },
- {
- "id": "my-pod-2",
- "labels": {
- "name": "testRun",
- "replicationController": "testRun"
- },
- "desiredState": {
- "manifest": {
- "version": "v1beta1",
- "id": "my-pod-2",
- "containers": [{
- "name": "nginx",
- "image": "dockerfile/nginx",
- "ports": [{
- "hostPort": 8080,
- "containerPort": 80
- }]
- }]
- }
- },
- "currentState": {
- "host": "host-2"
- }
- }
- ]
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_pods_post>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_post">post</span> <span
- class=parent></span>/pods</h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Create a new pod. currentState is ignored if present.</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_pods_post_request data-toggle=tab>Request</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_pods_post_request><h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Schema</strong>:<pre><code>{
- "$schema": "http://json-schema.org/draft-03/schema",
- "type": "object",
- "required": false,
- "description": "Pod resource. A pod corresponds to a co-located group of [Docker
- containers](http://docker.io).",
- "properties": {
- "kind": {
- "type": "string",
- "required": false
- },
- "id": {
- "type": "string",
- "required": false
- },
- "creationTimestamp": {
- "type": "string",
- "required": false
- },
- "selfLink": {
- "type": "string",
- "required": false
- },
- "desiredState": {
- "type": "object",
- "required": false,
- "description": "The desired configuration of the pod",
- "properties": {
- "manifest": {
- "type": "object",
- "required": false,
- "description": "Manifest describing group of [Docker containers](http://docker.io);
- compatible with format used by [Google Cloud Platform's container-vm
- images](https://developers.google.com/compute/docs/containers)"
- },
- "status": {
- "type": "string",
- "required": false,
- "description": ""
- },
- "host": {
- "type": "string",
- "required": false,
- "description": ""
- },
- "hostIP": {
- "type": "string",
- "required": false,
- "description": ""
- },
- "info": {
- "type": "object",
- "required": false,
- "description": ""
- }
- }
- },
- "currentState": {
- "type": "object",
- "required": false,
- "description": "The current configuration and status of the pod. Fields in common with
- desiredState have the same meaning.",
- "properties": {
- "manifest": {
- "type": "object",
- "required": false
- },
- "status": {
- "type": "string",
- "required": false
- },
- "host": {
- "type": "string",
- "required": false
- },
- "hostIP": {
- "type": "string",
- "required": false
- },
- "info": {
- "type": "object",
- "required": false
- }
- }
- },
- "labels": {
- "type": "object",
- "required": false
- }
- }
- }
- </code></pre>
- </small>
- </p>
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "kind": "Pod",
- "apiVersion": "v1beta1",
- "id": "php",
- "desiredState": {
- "manifest": {
- "version": "v1beta1",
- "id": "php",
- "containers": [{
- "name": "nginx",
- "image": "dockerfile/nginx",
- "ports": [{
- "containerPort": 80,
- "hostPort": 8080
- }],
- "livenessProbe": {
- "enabled": true,
- "type": "http",
- "initialDelaySeconds": 30,
- "httpGet": {
- "path": "/index.html",
- "port": "8080"
- }
- }
- }]
- }
- },
- "labels": {
- "name": "foo"
- }
- }
-
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="panel panel-white">
- <div class=panel-heading><h4 class=panel-title><a class=collapsed data-toggle=collapse
- href=#panel__pods__podId_><span
- class=parent>/pods</span>/{podId}</a> <span class=methods><a href=# data-toggle=modal
- data-target=#_pods__podId__get><span
- class="badge badge_get">get</span></a> <a href=# data-toggle=modal data-target=#_pods__podId__put><span
- class="badge badge_put">put</span></a> <a href=# data-toggle=modal
- data-target=#_pods__podId__delete><span
- class="badge badge_delete">delete</span></a></span></h4></div>
- <div id=panel__pods__podId_ class="panel-collapse collapse">
- <div class=panel-body>
- <div class=list-group><a href=# data-toggle=modal data-target=#_pods__podId__get
- class=list-group-item><span class="badge badge_get">get</span>
-
- <div class=method_description><p>Get a specific pod</p></div>
- <div class=clearfix></div>
- </a> <a href=# data-toggle=modal data-target=#_pods__podId__put class=list-group-item><span
- class="badge badge_put">put</span>
-
- <div class=method_description><p>Update a pod</p></div>
- <div class=clearfix></div>
- </a> <a href=# data-toggle=modal data-target=#_pods__podId__delete class=list-group-item><span
- class="badge badge_delete">delete</span>
-
- <div class=method_description><p>Delete a specific pod</p></div>
- <div class=clearfix></div>
- </a></div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_pods__podId__get>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_get">get</span> <span class=parent>/pods</span>/{podId}
- </h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Get a specific pod</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_pods__podId__get_request data-toggle=tab>Request</a></li>
- <li><a href=#_pods__podId__get_response data-toggle=tab>Response</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_pods__podId__get_request><h3>URI Parameters</h3>
- <ul>
- <li><strong>podId</strong>: <em>required (string)</em></li>
- </ul>
- </div>
- <div class=tab-pane id=_pods__podId__get_response><h2>HTTP status code <a
- href=http://httpstatus.es/200 target=_blank>200</a></h2>
-
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "kind": "Pod",
- "apiVersion": "v1beta1",
- "id": "php",
- "desiredState": {
- "manifest": {
- "version": "v1beta1",
- "id": "php",
- "containers": [{
- "name": "nginx",
- "image": "dockerfile/nginx",
- "ports": [{
- "containerPort": 80,
- "hostPort": 8080
- }],
- "livenessProbe": {
- "enabled": true,
- "type": "http",
- "initialDelaySeconds": 30,
- "httpGet": {
- "path": "/index.html",
- "port": "8080"
- }
- }
- }]
- }
- },
- "labels": {
- "name": "foo"
- }
- }
-
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_pods__podId__put>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_put">put</span> <span class=parent>/pods</span>/{podId}
- </h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Update a pod</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_pods__podId__put_request data-toggle=tab>Request</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_pods__podId__put_request><h3>URI Parameters</h3>
- <ul>
- <li><strong>podId</strong>: <em>required (string)</em></li>
- </ul>
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Schema</strong>:<pre><code>{
- "$schema": "http://json-schema.org/draft-03/schema",
- "type": "object",
- "required": false,
- "description": "Pod resource. A pod corresponds to a co-located group of [Docker
- containers](http://docker.io).",
- "properties": {
- "kind": {
- "type": "string",
- "required": false
- },
- "id": {
- "type": "string",
- "required": false
- },
- "creationTimestamp": {
- "type": "string",
- "required": false
- },
- "selfLink": {
- "type": "string",
- "required": false
- },
- "desiredState": {
- "type": "object",
- "required": false,
- "description": "The desired configuration of the pod",
- "properties": {
- "manifest": {
- "type": "object",
- "required": false,
- "description": "Manifest describing group of [Docker containers](http://docker.io);
- compatible with format used by [Google Cloud Platform's container-vm
- images](https://developers.google.com/compute/docs/containers)"
- },
- "status": {
- "type": "string",
- "required": false,
- "description": ""
- },
- "host": {
- "type": "string",
- "required": false,
- "description": ""
- },
- "hostIP": {
- "type": "string",
- "required": false,
- "description": ""
- },
- "info": {
- "type": "object",
- "required": false,
- "description": ""
- }
- }
- },
- "currentState": {
- "type": "object",
- "required": false,
- "description": "The current configuration and status of the pod. Fields in common with
- desiredState have the same meaning.",
- "properties": {
- "manifest": {
- "type": "object",
- "required": false
- },
- "status": {
- "type": "string",
- "required": false
- },
- "host": {
- "type": "string",
- "required": false
- },
- "hostIP": {
- "type": "string",
- "required": false
- },
- "info": {
- "type": "object",
- "required": false
- }
- }
- },
- "labels": {
- "type": "object",
- "required": false
- }
- }
- }
- </code></pre>
- </small>
- </p>
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "kind": "Pod",
- "apiVersion": "v1beta1",
- "id": "php",
- "desiredState": {
- "manifest": {
- "version": "v1beta1",
- "id": "php",
- "containers": [{
- "name": "nginx",
- "image": "dockerfile/nginx",
- "ports": [{
- "containerPort": 80,
- "hostPort": 8080
- }],
- "livenessProbe": {
- "enabled": true,
- "type": "http",
- "initialDelaySeconds": 30,
- "httpGet": {
- "path": "/index.html",
- "port": "8080"
- }
- }
- }]
- }
- },
- "labels": {
- "name": "foo"
- }
- }
-
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_pods__podId__delete>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_delete">delete</span> <span
- class=parent>/pods</span>/{podId}</h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Delete a specific pod</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_pods__podId__delete_request data-toggle=tab>Request</a></li>
- <li><a href=#_pods__podId__delete_response data-toggle=tab>Response</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_pods__podId__delete_request><h3>URI Parameters</h3>
- <ul>
- <li><strong>podId</strong>: <em>required (string)</em></li>
- </ul>
- </div>
- <div class=tab-pane id=_pods__podId__delete_response><h2>HTTP status code <a
- href=http://httpstatus.es/200 target=_blank>200</a></h2>
-
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "success": true
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="panel panel-default">
- <div class=panel-heading><h3 id=_replicationControllers class=panel-title>/replicationControllers</h3></div>
- <div class=panel-body>
- <div class=panel-group>
- <div class="panel panel-white">
- <div class=panel-heading><h4 class=panel-title><a class=collapsed data-toggle=collapse
- href=#panel__replicationControllers><span
- class=parent></span>/replicationControllers</a> <span class=methods><a href=# data-toggle=modal
- data-target=#_replicationControllers_get><span
- class="badge badge_get">get</span></a> <a href=# data-toggle=modal
- data-target=#_replicationControllers_post><span
- class="badge badge_post">post</span></a></span></h4></div>
- <div id=panel__replicationControllers class="panel-collapse collapse">
- <div class=panel-body>
- <div class=list-group><a href=# data-toggle=modal data-target=#_replicationControllers_get
- class=list-group-item><span class="badge badge_get">get</span>
-
- <div class=method_description><p>List all replicationControllers on this cluster</p></div>
- <div class=clearfix></div>
- </a> <a href=# data-toggle=modal data-target=#_replicationControllers_post class=list-group-item><span
- class="badge badge_post">post</span>
-
- <div class=method_description><p>Create a new controller. currentState is ignored if present.</p>
- </div>
- <div class=clearfix></div>
- </a></div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_replicationControllers_get>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_get">get</span> <span
- class=parent></span>/replicationControllers</h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>List all replicationControllers on this cluster</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_replicationControllers_get_request data-toggle=tab>Request</a></li>
- <li><a href=#_replicationControllers_get_response data-toggle=tab>Response</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_replicationControllers_get_request></div>
- <div class=tab-pane id=_replicationControllers_get_response><h2>HTTP status code <a
- href=http://httpstatus.es/200 target=_blank>200</a></h2>
-
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "kind": "ReplicationControllerList",
- "apiVersion": "v1beta1",
- "items": [
- {
- "id": "testRun",
- "desiredState": {
- "replicas": 2,
- "replicaSelector": {
- "name": "testRun"
- },
- "podTemplate": {
- "desiredState": {
- "manifest": {
- "version": "v1beta1",
- "image": "dockerfile/nginx",
- "networkPorts": [
- {
- "hostPort": 8080,
- "containerPort": 80
- }
- ]
- }
- },
- "labels": {
- "name": "testRun"
- }
- }
- },
- "labels": {
- "name": "testRun"
- }
- }
- ]
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_replicationControllers_post>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_post">post</span> <span
- class=parent></span>/replicationControllers</h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Create a new controller. currentState is ignored if present.</p>
- </div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_replicationControllers_post_request data-toggle=tab>Request</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_replicationControllers_post_request><h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Schema</strong>:<pre><code>{
- "$schema": "http://json-schema.org/draft-03/schema",
- "type": "object",
- "required": false,
- "description": "A replicationController resource. A replicationController helps to create
- and manage a set of pods. It acts as a factory to create new pods based on a template. It
- ensures that there are a specific number of pods running. If fewer pods are running than
- `replicas` then the needed pods are generated using `podTemplate`. If
- more pods are running than `replicas`, then excess pods are deleted.",
- "properties": {
- "kind": {
- "type": "string",
- "required": false
- },
- "id": {
- "type": "string",
- "required": false
- },
- "creationTimestamp": {
- "type": "string",
- "required": false
- },
- "selfLink": {
- "type": "string",
- "required": false
- },
- "desiredState": {
- "type": "object",
- "required": false,
- "description": "The desired configuration of the replicationController",
- "properties": {
- "replicas": {
- "type": "number",
- "required": false,
- "description": "Number of pods desired in the set"
- },
- "replicaSelector": {
- "type": "object",
- "required": false,
- "description": "Required labels used to identify pods in the set"
- },
- "podTemplate": {
- "type": "object",
- "required": false,
- "description": "Template from which to create new pods, as necessary. Identical to pod
- schema."
- }
- }
- },
- "labels": {
- "type": "object",
- "required": false
- }
- }
- }
- </code></pre>
- </small>
- </p>
- <p>
- <small><strong>Example</strong>:<pre><code> {
- "id": "nginxController",
- "apiVersion": "v1beta1",
- "kind": "ReplicationController",
- "desiredState": {
- "replicas": 2,
- "replicaSelector": {"name": "nginx"},
- "podTemplate": {
- "desiredState": {
- "manifest": {
- "version": "v1beta1",
- "id": "nginxController",
- "containers": [{
- "name": "nginx",
- "image": "dockerfile/nginx",
- "ports": [{"containerPort": 80, "hostPort": 8080}]
- }]
- }
- },
- "labels": {"name": "nginx"}
- }},
- "labels": {"name": "nginx"}
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="panel panel-white">
- <div class=panel-heading><h4 class=panel-title><a class=collapsed data-toggle=collapse
- href=#panel__replicationControllers__controllerId_><span
- class=parent>/replicationControllers</span>/{controllerId}</a> <span class=methods><a href=#
- data-toggle=modal
- data-target=#_replicationControllers__controllerId__get><span
- class="badge badge_get">get</span></a> <a href=# data-toggle=modal
- data-target=#_replicationControllers__controllerId__put><span
- class="badge badge_put">put</span></a> <a href=# data-toggle=modal
- data-target=#_replicationControllers__controllerId__delete><span
- class="badge badge_delete">delete</span></a></span></h4></div>
- <div id=panel__replicationControllers__controllerId_ class="panel-collapse collapse">
- <div class=panel-body>
- <div class=list-group><a href=# data-toggle=modal
- data-target=#_replicationControllers__controllerId__get
- class=list-group-item><span class="badge badge_get">get</span>
-
- <div class=method_description><p>Get a specific controller</p></div>
- <div class=clearfix></div>
- </a> <a href=# data-toggle=modal data-target=#_replicationControllers__controllerId__put
- class=list-group-item><span class="badge badge_put">put</span>
-
- <div class=method_description><p>Update a controller</p></div>
- <div class=clearfix></div>
- </a> <a href=# data-toggle=modal data-target=#_replicationControllers__controllerId__delete
- class=list-group-item><span class="badge badge_delete">delete</span>
-
- <div class=method_description><p>Delete a specific controller</p></div>
- <div class=clearfix></div>
- </a></div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_replicationControllers__controllerId__get>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_get">get</span> <span class=parent>/replicationControllers</span>/{controllerId}
- </h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Get a specific controller</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_replicationControllers__controllerId__get_request data-toggle=tab>Request</a>
- </li>
- <li><a href=#_replicationControllers__controllerId__get_response data-toggle=tab>Response</a>
- </li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_replicationControllers__controllerId__get_request><h3>URI
- Parameters</h3>
- <ul>
- <li><strong>controllerId</strong>: <em>required (string)</em></li>
- </ul>
- </div>
- <div class=tab-pane id=_replicationControllers__controllerId__get_response><h2>HTTP status code
- <a href=http://httpstatus.es/200 target=_blank>200</a></h2>
-
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Example</strong>:<pre><code> {
- "id": "nginxController",
- "apiVersion": "v1beta1",
- "kind": "ReplicationController",
- "desiredState": {
- "replicas": 2,
- "replicaSelector": {"name": "nginx"},
- "podTemplate": {
- "desiredState": {
- "manifest": {
- "version": "v1beta1",
- "id": "nginxController",
- "containers": [{
- "name": "nginx",
- "image": "dockerfile/nginx",
- "ports": [{"containerPort": 80, "hostPort": 8080}]
- }]
- }
- },
- "labels": {"name": "nginx"}
- }},
- "labels": {"name": "nginx"}
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_replicationControllers__controllerId__put>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_put">put</span> <span class=parent>/replicationControllers</span>/{controllerId}
- </h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Update a controller</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_replicationControllers__controllerId__put_request data-toggle=tab>Request</a>
- </li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_replicationControllers__controllerId__put_request><h3>URI
- Parameters</h3>
- <ul>
- <li><strong>controllerId</strong>: <em>required (string)</em></li>
- </ul>
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Schema</strong>:<pre><code>{
- "$schema": "http://json-schema.org/draft-03/schema",
- "type": "object",
- "required": false,
- "description": "A replicationController resource. A replicationController helps to create
- and manage a set of pods. It acts as a factory to create new pods based on a template. It
- ensures that there are a specific number of pods running. If fewer pods are running than
- `replicas` then the needed pods are generated using `podTemplate`. If
- more pods are running than `replicas`, then excess pods are deleted.",
- "properties": {
- "kind": {
- "type": "string",
- "required": false
- },
- "id": {
- "type": "string",
- "required": false
- },
- "creationTimestamp": {
- "type": "string",
- "required": false
- },
- "selfLink": {
- "type": "string",
- "required": false
- },
- "desiredState": {
- "type": "object",
- "required": false,
- "description": "The desired configuration of the replicationController",
- "properties": {
- "replicas": {
- "type": "number",
- "required": false,
- "description": "Number of pods desired in the set"
- },
- "replicaSelector": {
- "type": "object",
- "required": false,
- "description": "Required labels used to identify pods in the set"
- },
- "podTemplate": {
- "type": "object",
- "required": false,
- "description": "Template from which to create new pods, as necessary. Identical to pod
- schema."
- }
- }
- },
- "labels": {
- "type": "object",
- "required": false
- }
- }
- }
- </code></pre>
- </small>
- </p>
- <p>
- <small><strong>Example</strong>:<pre><code> {
- "id": "nginxController",
- "apiVersion": "v1beta1",
- "kind": "ReplicationController",
- "desiredState": {
- "replicas": 2,
- "replicaSelector": {"name": "nginx"},
- "podTemplate": {
- "desiredState": {
- "manifest": {
- "version": "v1beta1",
- "id": "nginxController",
- "containers": [{
- "name": "nginx",
- "image": "dockerfile/nginx",
- "ports": [{"containerPort": 80, "hostPort": 8080}]
- }]
- }
- },
- "labels": {"name": "nginx"}
- }},
- "labels": {"name": "nginx"}
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_replicationControllers__controllerId__delete>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_delete">delete</span> <span
- class=parent>/replicationControllers</span>/{controllerId}</h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Delete a specific controller</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_replicationControllers__controllerId__delete_request data-toggle=tab>Request</a>
- </li>
- <li><a href=#_replicationControllers__controllerId__delete_response data-toggle=tab>Response</a>
- </li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_replicationControllers__controllerId__delete_request><h3>URI
- Parameters</h3>
- <ul>
- <li><strong>controllerId</strong>: <em>required (string)</em></li>
- </ul>
- </div>
- <div class=tab-pane id=_replicationControllers__controllerId__delete_response><h2>HTTP status
- code <a href=http://httpstatus.es/200 target=_blank>200</a></h2>
-
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "success": true
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="panel panel-default">
- <div class=panel-heading><h3 id=_services class=panel-title>/services</h3></div>
- <div class=panel-body>
- <div class=panel-group>
- <div class="panel panel-white">
- <div class=panel-heading><h4 class=panel-title><a class=collapsed data-toggle=collapse
- href=#panel__services><span class=parent></span>/services</a>
- <span class=methods><a href=# data-toggle=modal data-target=#_services_get><span
- class="badge badge_get">get</span></a> <a href=# data-toggle=modal
- data-target=#_services_post><span
- class="badge badge_post">post</span></a></span></h4></div>
- <div id=panel__services class="panel-collapse collapse">
- <div class=panel-body>
- <div class=list-group><a href=# data-toggle=modal data-target=#_services_get
- class=list-group-item><span class="badge badge_get">get</span>
-
- <div class=method_description><p>List all services on this cluster</p></div>
- <div class=clearfix></div>
- </a> <a href=# data-toggle=modal data-target=#_services_post class=list-group-item><span
- class="badge badge_post">post</span>
-
- <div class=method_description><p>Create a new service</p></div>
- <div class=clearfix></div>
- </a></div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_services_get>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_get">get</span> <span
- class=parent></span>/services</h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>List all services on this cluster</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_services_get_request data-toggle=tab>Request</a></li>
- <li><a href=#_services_get_response data-toggle=tab>Response</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_services_get_request></div>
- <div class=tab-pane id=_services_get_response><h2>HTTP status code <a
- href=http://httpstatus.es/200 target=_blank>200</a></h2>
-
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "kind": "ServiceList",
- "apiVersion": "v1beta1",
- "items": [
- {
- "id": "example1",
- "port": 8000,
- "labels": {
- "name": "nginx"
- },
- "selector": {
- "name": "nginx"
- }
- },
- {
- "id": "example2",
- "port": 8080,
- "labels": {
- "env": "prod",
- "name": "jetty"
- },
- "selector": {
- "env": "prod",
- "name": "jetty"
- }
- }
- ]
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_services_post>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_post">post</span> <span
- class=parent></span>/services</h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Create a new service</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_services_post_request data-toggle=tab>Request</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_services_post_request><h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Schema</strong>:<pre><code>{
- "$schema": "http://json-schema.org/draft-03/schema",
- "type": "object",
- "required": false,
- "description": "A service resource.",
- "properties": {
- "kind": {
- "type": "string",
- "required": false
- },
- "id": {
- "type": "string",
- "required": false
- },
- "creationTimestamp": {
- "type": "string",
- "required": false
- },
- "selfLink": {
- "type": "string",
- "required": false
- },
- "name": {
- "type": "string",
- "required": false
- },
- "port": {
- "type": "number",
- "required": false
- },
- "containerPort": {
- "type": "string",
- "required": false
- },
- "labels": {
- "type": "object",
- "required": false
- },
- "selector": {
- "type": "object",
- "required": false
- }
- }
- }
- </code></pre>
- </small>
- </p>
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "kind": "Service",
- "apiVersion": "v1beta1",
- "id": "example",
- "port": 8000,
- "labels": {
- "name": "nginx"
- },
- "selector": {
- "name": "nginx"
- }
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="panel panel-white">
- <div class=panel-heading><h4 class=panel-title><a class=collapsed data-toggle=collapse
- href=#panel__services__serviceId_><span class=parent>/services</span>/{serviceId}</a>
- <span class=methods><a href=# data-toggle=modal data-target=#_services__serviceId__get><span
- class="badge badge_get">get</span></a> <a href=# data-toggle=modal
- data-target=#_services__serviceId__put><span
- class="badge badge_put">put</span></a> <a href=# data-toggle=modal
- data-target=#_services__serviceId__delete><span
- class="badge badge_delete">delete</span></a></span></h4></div>
- <div id=panel__services__serviceId_ class="panel-collapse collapse">
- <div class=panel-body>
- <div class=list-group><a href=# data-toggle=modal data-target=#_services__serviceId__get
- class=list-group-item><span class="badge badge_get">get</span>
-
- <div class=method_description><p>Get a specific service</p></div>
- <div class=clearfix></div>
- </a> <a href=# data-toggle=modal data-target=#_services__serviceId__put class=list-group-item><span
- class="badge badge_put">put</span>
-
- <div class=method_description><p>Update a service</p></div>
- <div class=clearfix></div>
- </a> <a href=# data-toggle=modal data-target=#_services__serviceId__delete class=list-group-item><span
- class="badge badge_delete">delete</span>
-
- <div class=method_description><p>Delete a specific service</p></div>
- <div class=clearfix></div>
- </a></div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_services__serviceId__get>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_get">get</span> <span class=parent>/services</span>/{serviceId}
- </h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Get a specific service</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_services__serviceId__get_request data-toggle=tab>Request</a></li>
- <li><a href=#_services__serviceId__get_response data-toggle=tab>Response</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_services__serviceId__get_request><h3>URI Parameters</h3>
- <ul>
- <li><strong>serviceId</strong>: <em>required (string)</em></li>
- </ul>
- </div>
- <div class=tab-pane id=_services__serviceId__get_response><h2>HTTP status code <a
- href=http://httpstatus.es/200 target=_blank>200</a></h2>
-
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "kind": "Service",
- "apiVersion": "v1beta1",
- "id": "example",
- "port": 8000,
- "labels": {
- "name": "nginx"
- },
- "selector": {
- "name": "nginx"
- }
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_services__serviceId__put>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_put">put</span> <span class=parent>/services</span>/{serviceId}
- </h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Update a service</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_services__serviceId__put_request data-toggle=tab>Request</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_services__serviceId__put_request><h3>URI Parameters</h3>
- <ul>
- <li><strong>serviceId</strong>: <em>required (string)</em></li>
- </ul>
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Schema</strong>:<pre><code>{
- "$schema": "http://json-schema.org/draft-03/schema",
- "type": "object",
- "required": false,
- "description": "A service resource.",
- "properties": {
- "kind": {
- "type": "string",
- "required": false
- },
- "id": {
- "type": "string",
- "required": false
- },
- "creationTimestamp": {
- "type": "string",
- "required": false
- },
- "selfLink": {
- "type": "string",
- "required": false
- },
- "name": {
- "type": "string",
- "required": false
- },
- "port": {
- "type": "number",
- "required": false
- },
- "containerPort": {
- "type": "string",
- "required": false
- },
- "labels": {
- "type": "object",
- "required": false
- },
- "selector": {
- "type": "object",
- "required": false
- }
- }
- }
- </code></pre>
- </small>
- </p>
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "kind": "Service",
- "apiVersion": "v1beta1",
- "id": "example",
- "port": 8000,
- "labels": {
- "name": "nginx"
- },
- "selector": {
- "name": "nginx"
- }
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" tabindex=0 id=_services__serviceId__delete>
- <div class=modal-dialog>
- <div class=modal-content>
- <div class=modal-header>
- <button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
- <h4 class=modal-title id=myModalLabel><span class="badge badge_delete">delete</span> <span
- class=parent>/services</span>/{serviceId}</h4></div>
- <div class=modal-body>
- <div class="alert alert-info"><p>Delete a specific service</p></div>
- <ul class="nav nav-tabs">
- <li class=active><a href=#_services__serviceId__delete_request data-toggle=tab>Request</a></li>
- <li><a href=#_services__serviceId__delete_response data-toggle=tab>Response</a></li>
- </ul>
- <div class=tab-content>
- <div class="tab-pane active" id=_services__serviceId__delete_request><h3>URI Parameters</h3>
- <ul>
- <li><strong>serviceId</strong>: <em>required (string)</em></li>
- </ul>
- </div>
- <div class=tab-pane id=_services__serviceId__delete_response><h2>HTTP status code <a
- href=http://httpstatus.es/200 target=_blank>200</a></h2>
-
- <h3>Body</h3>
-
- <p><strong>Type: application/json</strong></p>
-
- <p>
- <small><strong>Example</strong>:<pre><code>{
- "success": true
- }
- </code></pre>
- </small>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class=col-md-3>
- <div id=sidebar class="hidden-print affix" role=complementary>
- <ul class="nav nav-pills nav-stacked">
- <li><a href=#_pods>/pods</a></li>
- <li><a href=#_replicationControllers>/replicationControllers</a></li>
- <li><a href=#_services>/services</a></li>
- </ul>
- </div>
- </div>
- </div>
-</div>
-</body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/kubernetes.raml
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/kubernetes.raml b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/kubernetes.raml
deleted file mode 100644
index 6cf25c4..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/kubernetes.raml
+++ /dev/null
@@ -1,185 +0,0 @@
-#%RAML 0.8
-baseUri: http://server/api/{version}
-title: Kubernetes
-version: v1beta1
-mediaType: application/json
-documentation:
- - title: Overview
- content: |
- The Kubernetes API currently manages 3 main resources: `pods`,
- `replicationControllers`, and `services`. Pods correspond to
- colocated groups of [Docker containers](http://docker.io) with
- shared volumes, as supported by [Google Cloud Platform's
- container-vm
- images](https://developers.google.com/compute/docs/containers).
- Singleton pods can be created directly via the `/pods`
- endpoint. Sets of pods may created, maintained, and scaled using
- replicationControllers. Services create load-balanced targets
- for sets of pods.
-
- - title: Resource identifiers
- content: |
- Each resource has a string `id` and list of key-value
- `labels`. The `id` is generated by the system and is guaranteed
- to be unique in space and time across all resources. `labels`
- is a map of string (key) to string (value). Each resource may
- have at most one label with a particular key. Individual labels
- are used to specify identifying metadata that can be used to
- define sets of resources by specifying required labels. Examples
- of typical pod label keys include `stage`, `service`, `name`,
- `tier`, `partition`, and `track`, but you are free to develop
- your own conventions.
-
- - title: Creation semantics
- content: |
- Creation is currently not idempotent. We plan to add a
- modification token to each resource. A unique value for the token
- should be provided by the user during creation. If the user
- specifies a duplicate token at creation time, the system should
- return an error with a pointer to the existing resource with that
- token. In this way a user can deterministically recover from a
- dropped connection during a resource creation request.
-
- - title: Update semantics
- content: |
- Custom verbs are minimized and are used only for 'edge triggered'
- actions such as a reboot. Resource descriptions are generally set
- up with `desiredState` for the user provided parameters and
- `currentState` for the actual system state. While consistent
- terminology is used across these two stanzas they do not match
- member for member.
-
- When a new version of a resource is PUT the `desiredState` is
- updated and available immediately. Over time the system will work
- to bring the `currentState` into line with the `desiredState`. The
- system will drive toward the most recent `desiredState` regardless
- of previous versions of that stanza. In other words, if a value
- is changed from 2 to 5 in one PUT and then back down to 3 in
- another PUT the system isn't required to 'touch base' at 5 before
- making 3 the `currentState`.
-
- When doing an update, we assume that the entire `desiredState`
- stanza is specified. If a field is omitted it is assumed that the
- user is looking to delete that field. It is viable for a user to
- GET the resource, modify what they like in the `desiredState` or
- labels stanzas and then PUT it back. If the `currentState` is
- included in the PUT it will be silently ignored.
-
- While currently unspecified, it is intended that concurrent
- modification should be accomplished with optimistic locking of
- resources. We plan to add a modification token to each resource. If
- this is included with the PUT operation the system will verify
- that there haven't been other successful mutations to the
- resource during a read/modify/write cycle. The correct client
- action at this point is to GET the resource again, apply the
- changes afresh and try submitting again.
-
- Note that updates currently only work for replicationControllers
- and services, but not for pods. Label updates have not yet been
- implemented, either.
-
-/pods:
- get:
- description: List all pods on this cluster
- responses:
- 200:
- body:
- example: !include examples/pod-list.json
- post:
- description: Create a new pod. currentState is ignored if present.
- body:
- schema: !include doc/pod-schema.json
- example: !include examples/pod.json
-
- /{podId}:
- get:
- description: Get a specific pod
- responses:
- 200:
- body:
- example: !include examples/pod.json
- put:
- description: Update a pod
- body:
- schema: !include doc/pod-schema.json
- example: !include examples/pod.json
- delete:
- description: Delete a specific pod
- responses:
- 200:
- body:
- example: |
- {
- "success": true
- }
-
-/replicationControllers:
- get:
- description: List all replicationControllers on this cluster
- responses:
- 200:
- body:
- example: !include examples/controller-list.json
- post:
- description: Create a new controller. currentState is ignored if present.
- body:
- schema: !include doc/controller-schema.json
- example: !include examples/controller.json
-
- /{controllerId}:
- get:
- description: Get a specific controller
- responses:
- 200:
- body:
- example: !include examples/controller.json
- put:
- description: Update a controller
- body:
- schema: !include doc/controller-schema.json
- example: !include examples/controller.json
- delete:
- description: Delete a specific controller
- responses:
- 200:
- body:
- example: |
- {
- "success": true
- }
-
-/services:
- get:
- description: List all services on this cluster
- responses:
- 200:
- body:
- example: !include examples/service-list.json
- post:
- description: Create a new service
- body:
- schema: !include doc/service-schema.json
- example: !include examples/service.json
-
- /{serviceId}:
- get:
- description: Get a specific service
- responses:
- 200:
- body:
- example: !include examples/service.json
- put:
- description: Update a service
- body:
- schema: !include doc/service-schema.json
- example: !include examples/service.json
- delete:
- description: Delete a specific service
- responses:
- 200:
- body:
- example: |
- {
- "success": true
- }
-
[02/12] stratos git commit: Upgrading fabric8 kubernetes api version
to 2.2.16 and removing forked code
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/resources/schema/kube-schema.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/resources/schema/kube-schema.json b/dependencies/fabric8/kubernetes-model/src/main/resources/schema/kube-schema.json
deleted file mode 100644
index 01fb8c4..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/resources/schema/kube-schema.json
+++ /dev/null
@@ -1,4692 +0,0 @@
-{
- "id": "http://fabric8.io/fabric8/v2/Schema#",
- "$schema": "http://json-schema.org/schema#",
- "definitions": {
- "kubernetes_AWSElasticBlockStoreVolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "fsType": {
- "type": "string",
- "description": "file system type to mount"
- },
- "partition": {
- "type": "integer",
- "description": "partition on the disk to mount (e.g."
- },
- "readOnly": {
- "type": "boolean",
- "description": "read-only if true"
- },
- "volumeID": {
- "type": "string",
- "description": "unique id of the PD resource in AWS"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.AWSElasticBlockStoreVolumeSource"
- },
- "kubernetes_Capabilities": {
- "type": "object",
- "description": "",
- "properties": {
- "add": {
- "type": "array",
- "description": "added capabilities",
- "items": {
- "type": "string",
- "description": "added capabilities"
- }
- },
- "drop": {
- "type": "array",
- "description": "droped capabilities",
- "items": {
- "type": "string",
- "description": "droped capabilities"
- }
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Capabilities"
- },
- "kubernetes_Container": {
- "type": "object",
- "description": "",
- "properties": {
- "args": {
- "type": "array",
- "description": "command array; the docker image's cmd is used if this is not provided; arguments to the entrypoint; cannot be updated",
- "items": {
- "type": "string",
- "description": "command array; the docker image's cmd is used if this is not provided; arguments to the entrypoint; cannot be updated"
- }
- },
- "capabilities": {
- "$ref": "#/definitions/kubernetes_Capabilities",
- "javaType": "io.fabric8.kubernetes.api.model.Capabilities"
- },
- "command": {
- "type": "array",
- "description": "entrypoint array; not executed within a shell; the docker image's entrypoint is used if this is not provided; cannot be updated",
- "items": {
- "type": "string",
- "description": "entrypoint array; not executed within a shell; the docker image's entrypoint is used if this is not provided; cannot be updated"
- }
- },
- "env": {
- "type": "array",
- "description": "list of environment variables to set in the container; cannot be updated",
- "items": {
- "$ref": "#/definitions/kubernetes_EnvVar",
- "javaType": "io.fabric8.kubernetes.api.model.EnvVar"
- }
- },
- "image": {
- "type": "string",
- "description": "Docker image name"
- },
- "imagePullPolicy": {
- "type": "string",
- "description": "image pull policy; one of Always"
- },
- "lifecycle": {
- "$ref": "#/definitions/kubernetes_Lifecycle",
- "javaType": "io.fabric8.kubernetes.api.model.Lifecycle"
- },
- "livenessProbe": {
- "$ref": "#/definitions/kubernetes_Probe",
- "javaType": "io.fabric8.kubernetes.api.model.Probe"
- },
- "name": {
- "type": "string",
- "description": "name of the container; must be a DNS_LABEL and unique within the pod; cannot be updated",
- "maxLength": 63,
- "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
- },
- "ports": {
- "type": "array",
- "description": "list of ports to expose from the container; cannot be updated",
- "items": {
- "$ref": "#/definitions/kubernetes_ContainerPort",
- "javaType": "io.fabric8.kubernetes.api.model.ContainerPort"
- }
- },
- "privileged": {
- "type": "boolean",
- "description": "whether or not the container is granted privileged status; defaults to false; cannot be updated; deprecated; See SecurityContext."
- },
- "readinessProbe": {
- "$ref": "#/definitions/kubernetes_Probe",
- "javaType": "io.fabric8.kubernetes.api.model.Probe"
- },
- "resources": {
- "$ref": "#/definitions/kubernetes_ResourceRequirements",
- "javaType": "io.fabric8.kubernetes.api.model.ResourceRequirements"
- },
- "securityContext": {
- "$ref": "#/definitions/kubernetes_SecurityContext",
- "javaType": "io.fabric8.kubernetes.api.model.SecurityContext"
- },
- "terminationMessagePath": {
- "type": "string",
- "description": "path at which the file to which the container's termination message will be written is mounted into the container's filesystem; message written is intended to be brief final status"
- },
- "volumeMounts": {
- "type": "array",
- "description": "pod volumes to mount into the container's filesyste; cannot be updated",
- "items": {
- "$ref": "#/definitions/kubernetes_VolumeMount",
- "javaType": "io.fabric8.kubernetes.api.model.VolumeMount"
- }
- },
- "workingDir": {
- "type": "string",
- "description": "container's working directory; defaults to image's default; cannot be updated"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Container"
- },
- "kubernetes_ContainerPort": {
- "type": "object",
- "description": "",
- "properties": {
- "containerPort": {
- "type": "integer",
- "description": "number of port to expose on the pod's IP address"
- },
- "hostIP": {
- "type": "string",
- "description": "host IP to bind the port to"
- },
- "hostPort": {
- "type": "integer",
- "description": "number of port to expose on the host; most containers do not need this"
- },
- "name": {
- "type": "string",
- "description": "name for the port that can be referred to by services; must be a DNS_LABEL and unique without the pod"
- },
- "protocol": {
- "type": "string",
- "description": "protocol for port; must be UDP or TCP; TCP if unspecified"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ContainerPort"
- },
- "kubernetes_ContainerState": {
- "type": "object",
- "description": "",
- "properties": {
- "running": {
- "$ref": "#/definitions/kubernetes_ContainerStateRunning",
- "javaType": "io.fabric8.kubernetes.api.model.ContainerStateRunning"
- },
- "termination": {
- "$ref": "#/definitions/kubernetes_ContainerStateTerminated",
- "javaType": "io.fabric8.kubernetes.api.model.ContainerStateTerminated"
- },
- "waiting": {
- "$ref": "#/definitions/kubernetes_ContainerStateWaiting",
- "javaType": "io.fabric8.kubernetes.api.model.ContainerStateWaiting"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ContainerState"
- },
- "kubernetes_ContainerStateRunning": {
- "type": "object",
- "description": "",
- "properties": {
- "startedAt": {
- "type": "string",
- "description": "time at which the container was last (re-)started"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ContainerStateRunning"
- },
- "kubernetes_ContainerStateTerminated": {
- "type": "object",
- "description": "",
- "properties": {
- "containerID": {
- "type": "string",
- "description": "container's ID in the format 'docker://\u003ccontainer_id\u003e'"
- },
- "exitCode": {
- "type": "integer",
- "description": "exit status from the last termination of the container"
- },
- "finishedAt": {
- "type": "string",
- "description": "time at which the container last terminated"
- },
- "message": {
- "type": "string",
- "description": "message regarding the last termination of the container"
- },
- "reason": {
- "type": "string",
- "description": "(brief) reason from the last termination of the container"
- },
- "signal": {
- "type": "integer",
- "description": "signal from the last termination of the container"
- },
- "startedAt": {
- "type": "string",
- "description": "time at which previous execution of the container started"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ContainerStateTerminated"
- },
- "kubernetes_ContainerStateWaiting": {
- "type": "object",
- "description": "",
- "properties": {
- "reason": {
- "type": "string",
- "description": "(brief) reason the container is not yet running"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ContainerStateWaiting"
- },
- "kubernetes_ContainerStatus": {
- "type": "object",
- "description": "",
- "properties": {
- "containerID": {
- "type": "string",
- "description": "container's ID in the format 'docker://\u003ccontainer_id\u003e'"
- },
- "image": {
- "type": "string",
- "description": "image of the container"
- },
- "imageID": {
- "type": "string",
- "description": "ID of the container's image"
- },
- "lastState": {
- "$ref": "#/definitions/kubernetes_ContainerState",
- "javaType": "io.fabric8.kubernetes.api.model.ContainerState"
- },
- "name": {
- "type": "string",
- "description": "name of the container; must be a DNS_LABEL and unique within the pod; cannot be updated",
- "maxLength": 63,
- "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
- },
- "ready": {
- "type": "boolean",
- "description": "specifies whether the container has passed its readiness probe"
- },
- "restartCount": {
- "type": "integer",
- "description": "the number of times the container has been restarted"
- },
- "state": {
- "$ref": "#/definitions/kubernetes_ContainerState",
- "javaType": "io.fabric8.kubernetes.api.model.ContainerState"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ContainerStatus"
- },
- "kubernetes_EmptyDirVolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "medium": {
- "type": "string",
- "description": "type of storage used to back the volume; must be an empty string (default) or Memory"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.EmptyDirVolumeSource"
- },
- "kubernetes_EndpointAddress": {
- "type": "object",
- "description": "",
- "properties": {
- "IP": {
- "type": "string",
- "description": "IP address of the endpoint"
- },
- "targetRef": {
- "$ref": "#/definitions/kubernetes_ObjectReference",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectReference"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.EndpointAddress"
- },
- "kubernetes_EndpointPort": {
- "type": "object",
- "description": "",
- "properties": {
- "name": {
- "type": "string",
- "description": "name of this port",
- "maxLength": 63,
- "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
- },
- "port": {
- "type": "integer",
- "description": "port number of the endpoint"
- },
- "protocol": {
- "type": "string",
- "description": "protocol for this port; must be UDP or TCP; TCP if unspecified"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.EndpointPort"
- },
- "kubernetes_EndpointSubset": {
- "type": "object",
- "description": "",
- "properties": {
- "addresses": {
- "type": "array",
- "description": "IP addresses which offer the related ports",
- "items": {
- "$ref": "#/definitions/kubernetes_EndpointAddress",
- "javaType": "io.fabric8.kubernetes.api.model.EndpointAddress"
- }
- },
- "ports": {
- "type": "array",
- "description": "port numbers available on the related IP addresses",
- "items": {
- "$ref": "#/definitions/kubernetes_EndpointPort",
- "javaType": "io.fabric8.kubernetes.api.model.EndpointPort"
- }
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.EndpointSubset"
- },
- "kubernetes_Endpoints": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "Endpoints",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ObjectMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta"
- },
- "subsets": {
- "type": "array",
- "description": "sets of addresses and ports that comprise a service",
- "items": {
- "$ref": "#/definitions/kubernetes_EndpointSubset",
- "javaType": "io.fabric8.kubernetes.api.model.EndpointSubset"
- }
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Endpoints",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.HasMetadata"
- ]
- },
- "kubernetes_EndpointsList": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "items": {
- "type": "array",
- "description": "list of endpoints",
- "items": {
- "$ref": "#/definitions/kubernetes_Endpoints",
- "javaType": "io.fabric8.kubernetes.api.model.Endpoints"
- }
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "EndpointsList",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ListMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ListMeta"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.EndpointsList",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.KubernetesResource"
- ]
- },
- "kubernetes_EnvVar": {
- "type": "object",
- "description": "",
- "properties": {
- "name": {
- "type": "string",
- "description": "name of the environment variable; must be a C_IDENTIFIER",
- "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
- },
- "value": {
- "type": "string",
- "description": "value of the environment variable; defaults to empty string"
- },
- "valueFrom": {
- "$ref": "#/definitions/kubernetes_EnvVarSource",
- "javaType": "io.fabric8.kubernetes.api.model.EnvVarSource"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.EnvVar"
- },
- "kubernetes_EnvVarSource": {
- "type": "object",
- "description": "",
- "properties": {
- "fieldRef": {
- "$ref": "#/definitions/kubernetes_ObjectFieldSelector",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectFieldSelector"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.EnvVarSource"
- },
- "kubernetes_ExecAction": {
- "type": "object",
- "description": "",
- "properties": {
- "command": {
- "type": "array",
- "description": "command line to execute inside the container; working directory for the command is root ('/') in the container's file system; the command is exec'd",
- "items": {
- "type": "string",
- "description": "command line to execute inside the container; working directory for the command is root ('/') in the container's file system; the command is exec'd"
- }
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ExecAction"
- },
- "kubernetes_GCEPersistentDiskVolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "fsType": {
- "type": "string",
- "description": "file system type to mount"
- },
- "partition": {
- "type": "integer",
- "description": "partition on the disk to mount (e.g."
- },
- "pdName": {
- "type": "string",
- "description": "unique name of the PD resource in GCE"
- },
- "readOnly": {
- "type": "boolean",
- "description": "read-only if true"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.GCEPersistentDiskVolumeSource"
- },
- "kubernetes_GitRepoVolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "repository": {
- "type": "string",
- "description": "repository URL"
- },
- "revision": {
- "type": "string",
- "description": "commit hash for the specified revision"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.GitRepoVolumeSource"
- },
- "kubernetes_GlusterfsVolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "endpoints": {
- "type": "string",
- "description": "gluster hosts endpoints name"
- },
- "path": {
- "type": "string",
- "description": "path to gluster volume"
- },
- "readOnly": {
- "type": "boolean",
- "description": "glusterfs volume to be mounted with read-only permissions"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.GlusterfsVolumeSource"
- },
- "kubernetes_HTTPGetAction": {
- "type": "object",
- "description": "",
- "properties": {
- "host": {
- "type": "string",
- "description": "hostname to connect to; defaults to pod IP"
- },
- "path": {
- "type": "string",
- "description": "path to access on the HTTP server"
- },
- "port": {
- "$ref": "#/definitions/kubernetes_util_IntOrString",
- "javaType": "io.fabric8.kubernetes.api.model.util.IntOrString"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.HTTPGetAction"
- },
- "kubernetes_Handler": {
- "type": "object",
- "description": "",
- "properties": {
- "exec": {
- "$ref": "#/definitions/kubernetes_ExecAction",
- "javaType": "io.fabric8.kubernetes.api.model.ExecAction"
- },
- "httpGet": {
- "$ref": "#/definitions/kubernetes_HTTPGetAction",
- "javaType": "io.fabric8.kubernetes.api.model.HTTPGetAction"
- },
- "tcpSocket": {
- "$ref": "#/definitions/kubernetes_TCPSocketAction",
- "javaType": "io.fabric8.kubernetes.api.model.TCPSocketAction"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Handler"
- },
- "kubernetes_HostPathVolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "path": {
- "type": "string",
- "description": "path of the directory on the host"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.HostPathVolumeSource"
- },
- "kubernetes_ISCSIVolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "fsType": {
- "type": "string",
- "description": "file system type to mount"
- },
- "iqn": {
- "type": "string",
- "description": "iSCSI Qualified Name"
- },
- "lun": {
- "type": "integer",
- "description": "iscsi target lun number"
- },
- "readOnly": {
- "type": "boolean",
- "description": "read-only if true"
- },
- "targetPortal": {
- "type": "string",
- "description": "iSCSI target portal"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ISCSIVolumeSource"
- },
- "kubernetes_Lifecycle": {
- "type": "object",
- "description": "",
- "properties": {
- "postStart": {
- "$ref": "#/definitions/kubernetes_Handler",
- "javaType": "io.fabric8.kubernetes.api.model.Handler"
- },
- "preStop": {
- "$ref": "#/definitions/kubernetes_Handler",
- "javaType": "io.fabric8.kubernetes.api.model.Handler"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Lifecycle"
- },
- "kubernetes_List": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "items": {
- "type": "array",
- "description": "list of objects",
- "items": {
- "$ref": "#/definitions/kubernetes_runtime_RawExtension",
- "javaType": "io.fabric8.kubernetes.api.model.HasMetadata"
- }
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "List",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ListMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ListMeta"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.BaseKubernetesList",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.KubernetesResource"
- ]
- },
- "kubernetes_ListMeta": {
- "type": "object",
- "description": "",
- "properties": {
- "resourceVersion": {
- "type": "string",
- "description": "string that identifies the internal version of this object that can be used by clients to determine when objects have changed; populated by the system"
- },
- "selfLink": {
- "type": "string",
- "description": "URL for the object; populated by the system"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ListMeta"
- },
- "kubernetes_LoadBalancerIngress": {
- "type": "object",
- "description": "",
- "properties": {
- "hostname": {
- "type": "string",
- "description": "hostname of ingress point"
- },
- "ip": {
- "type": "string",
- "description": "IP address of ingress point"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.LoadBalancerIngress"
- },
- "kubernetes_LoadBalancerStatus": {
- "type": "object",
- "description": "",
- "properties": {
- "ingress": {
- "type": "array",
- "description": "load-balancer ingress points",
- "items": {
- "$ref": "#/definitions/kubernetes_LoadBalancerIngress",
- "javaType": "io.fabric8.kubernetes.api.model.LoadBalancerIngress"
- }
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.LoadBalancerStatus"
- },
- "kubernetes_LocalObjectReference": {
- "type": "object",
- "description": "",
- "properties": {
- "name": {
- "type": "string",
- "description": "name of the referent"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.LocalObjectReference"
- },
- "kubernetes_NFSVolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "path": {
- "type": "string",
- "description": "the path that is exported by the NFS server"
- },
- "readOnly": {
- "type": "boolean",
- "description": "forces the NFS export to be mounted with read-only permissions"
- },
- "server": {
- "type": "string",
- "description": "the hostname or IP address of the NFS server"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.NFSVolumeSource"
- },
- "kubernetes_Namespace": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "Namespace",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ObjectMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta"
- },
- "spec": {
- "$ref": "#/definitions/kubernetes_NamespaceSpec",
- "javaType": "io.fabric8.kubernetes.api.model.NamespaceSpec"
- },
- "status": {
- "$ref": "#/definitions/kubernetes_NamespaceStatus",
- "javaType": "io.fabric8.kubernetes.api.model.NamespaceStatus"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Namespace",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.HasMetadata"
- ]
- },
- "kubernetes_NamespaceList": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "items": {
- "type": "array",
- "description": "items is the list of Namespace objects in the list",
- "items": {
- "$ref": "#/definitions/kubernetes_Namespace",
- "javaType": "io.fabric8.kubernetes.api.model.Namespace"
- }
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "NamespaceList",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ListMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ListMeta"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.NamespaceList",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.KubernetesResource"
- ]
- },
- "kubernetes_NamespaceSpec": {
- "type": "object",
- "description": "",
- "properties": {
- "finalizers": {
- "type": "array",
- "description": "an opaque list of values that must be empty to permanently remove object from storage",
- "items": {
- "type": "string",
- "description": "an opaque list of values that must be empty to permanently remove object from storage"
- }
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.NamespaceSpec"
- },
- "kubernetes_NamespaceStatus": {
- "type": "object",
- "description": "",
- "properties": {
- "phase": {
- "type": "string",
- "description": "phase is the current lifecycle phase of the namespace"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.NamespaceStatus"
- },
- "kubernetes_Node": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "Node",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ObjectMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta"
- },
- "spec": {
- "$ref": "#/definitions/kubernetes_NodeSpec",
- "javaType": "io.fabric8.kubernetes.api.model.NodeSpec"
- },
- "status": {
- "$ref": "#/definitions/kubernetes_NodeStatus",
- "javaType": "io.fabric8.kubernetes.api.model.NodeStatus"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Node",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.HasMetadata"
- ]
- },
- "kubernetes_NodeAddress": {
- "type": "object",
- "description": "",
- "properties": {
- "address": {
- "type": "string",
- "description": "the node address"
- },
- "type": {
- "type": "string",
- "description": "node address type"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.NodeAddress"
- },
- "kubernetes_NodeCondition": {
- "type": "object",
- "description": "",
- "properties": {
- "lastHeartbeatTime": {
- "type": "string",
- "description": "last time we got an update on a given condition"
- },
- "lastTransitionTime": {
- "type": "string",
- "description": "last time the condition transit from one status to another"
- },
- "message": {
- "type": "string",
- "description": "human readable message indicating details about last transition"
- },
- "reason": {
- "type": "string",
- "description": "(brief) reason for the condition's last transition"
- },
- "status": {
- "type": "string",
- "description": "status of the condition"
- },
- "type": {
- "type": "string",
- "description": "type of node condition"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.NodeCondition"
- },
- "kubernetes_NodeList": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "items": {
- "type": "array",
- "description": "list of nodes",
- "items": {
- "$ref": "#/definitions/kubernetes_Node",
- "javaType": "io.fabric8.kubernetes.api.model.Node"
- }
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "NodeList",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ListMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ListMeta"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.NodeList",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.KubernetesResource"
- ]
- },
- "kubernetes_NodeSpec": {
- "type": "object",
- "description": "",
- "properties": {
- "externalID": {
- "type": "string",
- "description": "external ID assigned to the node by some machine database (e.g. a cloud provider). Defaults to node name when empty."
- },
- "podCIDR": {
- "type": "string",
- "description": "pod IP range assigned to the node"
- },
- "unschedulable": {
- "type": "boolean",
- "description": "disable pod scheduling on the node"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.NodeSpec"
- },
- "kubernetes_NodeStatus": {
- "type": "object",
- "description": "",
- "properties": {
- "addresses": {
- "type": "array",
- "description": "list of addresses reachable to the node",
- "items": {
- "$ref": "#/definitions/kubernetes_NodeAddress",
- "javaType": "io.fabric8.kubernetes.api.model.NodeAddress"
- }
- },
- "capacity": {
- "type": "object",
- "description": "compute resource capacity of the node; http://docs.k8s.io/resources.md",
- "additionalProperties": {
- "$ref": "#/definitions/kubernetes_resource_Quantity",
- "javaType": "io.fabric8.kubernetes.api.model.resource.Quantity"
- },
- "javaType": "java.util.Map\u003cString,io.fabric8.kubernetes.api.model.resource.Quantity\u003e"
- },
- "conditions": {
- "type": "array",
- "description": "list of node conditions observed",
- "items": {
- "$ref": "#/definitions/kubernetes_NodeCondition",
- "javaType": "io.fabric8.kubernetes.api.model.NodeCondition"
- }
- },
- "nodeInfo": {
- "$ref": "#/definitions/kubernetes_NodeSystemInfo",
- "javaType": "io.fabric8.kubernetes.api.model.NodeSystemInfo"
- },
- "phase": {
- "type": "string",
- "description": "most recently observed lifecycle phase of the node"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.NodeStatus"
- },
- "kubernetes_NodeSystemInfo": {
- "type": "object",
- "description": "",
- "properties": {
- "bootID": {
- "type": "string",
- "description": "boot id is the boot-id reported by the node"
- },
- "containerRuntimeVersion": {
- "type": "string",
- "description": "Container runtime version reported by the node through runtime remote API (e.g. docker://1.5.0)"
- },
- "kernelVersion": {
- "type": "string",
- "description": "Kernel version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64)"
- },
- "kubeProxyVersion": {
- "type": "string",
- "description": "Kube-proxy version reported by the node"
- },
- "kubeletVersion": {
- "type": "string",
- "description": "Kubelet version reported by the node"
- },
- "machineID": {
- "type": "string",
- "description": "machine-id reported by the node"
- },
- "osImage": {
- "type": "string",
- "description": "OS image used reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy))"
- },
- "systemUUID": {
- "type": "string",
- "description": "system-uuid reported by the node"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.NodeSystemInfo"
- },
- "kubernetes_ObjectFieldSelector": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "version of the schema that fieldPath is written in terms of; defaults to v1beta3"
- },
- "fieldPath": {
- "type": "string",
- "description": "path of the field to select in the specified API version"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ObjectFieldSelector"
- },
- "kubernetes_ObjectMeta": {
- "type": "object",
- "description": "",
- "properties": {
- "annotations": {
- "type": "object",
- "description": "map of string keys and values that can be used by external tooling to store and retrieve arbitrary metadata about objects",
- "additionalProperties": {
- "type": "string",
- "description": "map of string keys and values that can be used by external tooling to store and retrieve arbitrary metadata about objects"
- },
- "javaType": "java.util.Map\u003cString,String\u003e"
- },
- "creationTimestamp": {
- "type": "string",
- "description": "RFC 3339 date and time at which the object was created; populated by the system"
- },
- "deletionTimestamp": {
- "type": "string",
- "description": "RFC 3339 date and time at which the object will be deleted; populated by the system when a graceful deletion is requested"
- },
- "generateName": {
- "type": "string",
- "description": "an optional prefix to use to generate a unique name; has the same validation rules as name; optional"
- },
- "labels": {
- "type": "object",
- "description": "map of string keys and values that can be used to organize and categorize objects; may match selectors of replication controllers and services",
- "additionalProperties": {
- "type": "string",
- "description": "map of string keys and values that can be used to organize and categorize objects; may match selectors of replication controllers and services"
- },
- "javaType": "java.util.Map\u003cString,String\u003e"
- },
- "name": {
- "type": "string",
- "description": "string that identifies an object. Must be unique within a namespace; cannot be updated",
- "maxLength": 63,
- "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
- },
- "namespace": {
- "type": "string",
- "description": "namespace of the object; must be a DNS_LABEL; cannot be updated",
- "maxLength": 253,
- "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$"
- },
- "resourceVersion": {
- "type": "string",
- "description": "string that identifies the internal version of this object that can be used by clients to determine when objects have changed; populated by the system"
- },
- "selfLink": {
- "type": "string",
- "description": "URL for the object; populated by the system"
- },
- "uid": {
- "type": "string",
- "description": "unique UUID across space and time; populated by the system; read-only"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta"
- },
- "kubernetes_ObjectReference": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "API version of the referent"
- },
- "fieldPath": {
- "type": "string",
- "description": "if referring to a piece of an object instead of an entire object"
- },
- "kind": {
- "type": "string",
- "description": "kind of the referent"
- },
- "name": {
- "type": "string",
- "description": "name of the referent"
- },
- "namespace": {
- "type": "string",
- "description": "namespace of the referent"
- },
- "resourceVersion": {
- "type": "string",
- "description": "specific resourceVersion to which this reference is made"
- },
- "uid": {
- "type": "string",
- "description": "uid of the referent"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ObjectReference"
- },
- "kubernetes_PersistentVolumeClaimVolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "claimName": {
- "type": "string",
- "description": "the name of the claim in the same namespace to be mounted as a volume"
- },
- "readOnly": {
- "type": "boolean",
- "description": "mount volume as read-only when true; default false"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.PersistentVolumeClaimVolumeSource"
- },
- "kubernetes_Pod": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "Pod",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ObjectMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta"
- },
- "spec": {
- "$ref": "#/definitions/kubernetes_PodSpec",
- "javaType": "io.fabric8.kubernetes.api.model.PodSpec"
- },
- "status": {
- "$ref": "#/definitions/kubernetes_PodStatus",
- "javaType": "io.fabric8.kubernetes.api.model.PodStatus"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Pod",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.HasMetadata"
- ]
- },
- "kubernetes_PodCondition": {
- "type": "object",
- "description": "",
- "properties": {
- "status": {
- "type": "string",
- "description": "status of the condition"
- },
- "type": {
- "type": "string",
- "description": "kind of the condition"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.PodCondition"
- },
- "kubernetes_PodList": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "items": {
- "type": "array",
- "description": "list of pods",
- "items": {
- "$ref": "#/definitions/kubernetes_Pod",
- "javaType": "io.fabric8.kubernetes.api.model.Pod"
- }
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "PodList",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ListMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ListMeta"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.PodList",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.KubernetesResource"
- ]
- },
- "kubernetes_PodSpec": {
- "type": "object",
- "description": "",
- "properties": {
- "activeDeadlineSeconds": {
- "type": "integer",
- "description": "",
- "javaType": "Long"
- },
- "containers": {
- "type": "array",
- "description": "list of containers belonging to the pod; cannot be updated; containers cannot currently be added or removed; there must be at least one container in a Pod",
- "items": {
- "$ref": "#/definitions/kubernetes_Container",
- "javaType": "io.fabric8.kubernetes.api.model.Container"
- }
- },
- "dnsPolicy": {
- "type": "string",
- "description": "DNS policy for containers within the pod; one of 'ClusterFirst' or 'Default'"
- },
- "host": {
- "type": "string",
- "description": "host requested for this pod"
- },
- "hostNetwork": {
- "type": "boolean",
- "description": "host networking requested for this pod"
- },
- "imagePullSecrets": {
- "type": "array",
- "description": "list of references to secrets in the same namespace available for pulling the container images",
- "items": {
- "$ref": "#/definitions/kubernetes_LocalObjectReference",
- "javaType": "io.fabric8.kubernetes.api.model.LocalObjectReference"
- }
- },
- "nodeSelector": {
- "type": "object",
- "description": "selector which must match a node's labels for the pod to be scheduled on that node",
- "additionalProperties": {
- "type": "string",
- "description": "selector which must match a node's labels for the pod to be scheduled on that node"
- },
- "javaType": "java.util.Map\u003cString,String\u003e"
- },
- "restartPolicy": {
- "type": "string",
- "description": "restart policy for all containers within the pod; one of RestartPolicyAlways"
- },
- "serviceAccount": {
- "type": "string",
- "description": "name of the ServiceAccount to use to run this pod"
- },
- "terminationGracePeriodSeconds": {
- "type": "integer",
- "description": "optional duration in seconds the pod needs to terminate gracefully; may be decreased in delete request; value must be non-negative integer; the value zero indicates delete immediately; if this value is not set",
- "javaType": "Long"
- },
- "volumes": {
- "type": "array",
- "description": "list of volumes that can be mounted by containers belonging to the pod",
- "items": {
- "$ref": "#/definitions/kubernetes_Volume",
- "javaType": "io.fabric8.kubernetes.api.model.Volume"
- }
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.PodSpec"
- },
- "kubernetes_PodStatus": {
- "type": "object",
- "description": "",
- "properties": {
- "Condition": {
- "type": "array",
- "description": "current service state of pod",
- "items": {
- "$ref": "#/definitions/kubernetes_PodCondition",
- "javaType": "io.fabric8.kubernetes.api.model.PodCondition"
- }
- },
- "containerStatuses": {
- "type": "array",
- "description": "list of container statuses",
- "items": {
- "$ref": "#/definitions/kubernetes_ContainerStatus",
- "javaType": "io.fabric8.kubernetes.api.model.ContainerStatus"
- }
- },
- "hostIP": {
- "type": "string",
- "description": "IP address of the host to which the pod is assigned; empty if not yet scheduled"
- },
- "message": {
- "type": "string",
- "description": "human readable message indicating details about why the pod is in this condition"
- },
- "phase": {
- "type": "string",
- "description": "current condition of the pod."
- },
- "podIP": {
- "type": "string",
- "description": "IP address allocated to the pod; routable at least within the cluster; empty if not yet allocated"
- },
- "startTime": {
- "type": "string",
- "description": "RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod."
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.PodStatus"
- },
- "kubernetes_PodTemplateSpec": {
- "type": "object",
- "description": "",
- "properties": {
- "metadata": {
- "$ref": "#/definitions/kubernetes_ObjectMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta"
- },
- "spec": {
- "$ref": "#/definitions/kubernetes_PodSpec",
- "javaType": "io.fabric8.kubernetes.api.model.PodSpec"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.PodTemplateSpec"
- },
- "kubernetes_Probe": {
- "type": "object",
- "description": "",
- "properties": {
- "exec": {
- "$ref": "#/definitions/kubernetes_ExecAction",
- "javaType": "io.fabric8.kubernetes.api.model.ExecAction"
- },
- "httpGet": {
- "$ref": "#/definitions/kubernetes_HTTPGetAction",
- "javaType": "io.fabric8.kubernetes.api.model.HTTPGetAction"
- },
- "initialDelaySeconds": {
- "type": "integer",
- "description": "number of seconds after the container has started before liveness probes are initiated",
- "javaType": "Long"
- },
- "tcpSocket": {
- "$ref": "#/definitions/kubernetes_TCPSocketAction",
- "javaType": "io.fabric8.kubernetes.api.model.TCPSocketAction"
- },
- "timeoutSeconds": {
- "type": "integer",
- "description": "number of seconds after which liveness probes timeout; defaults to 1 second",
- "javaType": "Long"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Probe"
- },
- "kubernetes_RBDVolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "fsType": {
- "type": "string",
- "description": "file system type to mount"
- },
- "image": {
- "type": "string",
- "description": "rados image name"
- },
- "keyring": {
- "type": "string",
- "description": "keyring is the path to key ring for rados user; default is /etc/ceph/keyring; optional"
- },
- "monitors": {
- "type": "array",
- "description": "a collection of Ceph monitors",
- "items": {
- "type": "string",
- "description": "a collection of Ceph monitors"
- }
- },
- "pool": {
- "type": "string",
- "description": "rados pool name; default is rbd; optional"
- },
- "readOnly": {
- "type": "boolean",
- "description": "rbd volume to be mounted with read-only permissions"
- },
- "secretRef": {
- "$ref": "#/definitions/kubernetes_LocalObjectReference",
- "javaType": "io.fabric8.kubernetes.api.model.LocalObjectReference"
- },
- "user": {
- "type": "string",
- "description": "rados user name; default is admin; optional"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.RBDVolumeSource"
- },
- "kubernetes_ReplicationController": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "ReplicationController",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ObjectMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta"
- },
- "spec": {
- "$ref": "#/definitions/kubernetes_ReplicationControllerSpec",
- "javaType": "io.fabric8.kubernetes.api.model.ReplicationControllerSpec"
- },
- "status": {
- "$ref": "#/definitions/kubernetes_ReplicationControllerStatus",
- "javaType": "io.fabric8.kubernetes.api.model.ReplicationControllerStatus"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ReplicationController",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.HasMetadata"
- ]
- },
- "kubernetes_ReplicationControllerList": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "items": {
- "type": "array",
- "description": "list of replication controllers",
- "items": {
- "$ref": "#/definitions/kubernetes_ReplicationController",
- "javaType": "io.fabric8.kubernetes.api.model.ReplicationController"
- }
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "ReplicationControllerList",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ListMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ListMeta"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ReplicationControllerList",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.KubernetesResource"
- ]
- },
- "kubernetes_ReplicationControllerSpec": {
- "type": "object",
- "description": "",
- "properties": {
- "replicas": {
- "type": "integer",
- "description": "number of replicas desired"
- },
- "selector": {
- "type": "object",
- "description": "label keys and values that must match in order to be controlled by this replication controller",
- "additionalProperties": {
- "type": "string",
- "description": "label keys and values that must match in order to be controlled by this replication controller"
- },
- "javaType": "java.util.Map\u003cString,String\u003e"
- },
- "template": {
- "$ref": "#/definitions/kubernetes_PodTemplateSpec",
- "javaType": "io.fabric8.kubernetes.api.model.PodTemplateSpec"
- },
- "templateRef": {
- "$ref": "#/definitions/kubernetes_ObjectReference",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectReference"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ReplicationControllerSpec"
- },
- "kubernetes_ReplicationControllerStatus": {
- "type": "object",
- "description": "",
- "properties": {
- "replicas": {
- "type": "integer",
- "description": "most recently oberved number of replicas"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ReplicationControllerStatus"
- },
- "kubernetes_ResourceRequirements": {
- "type": "object",
- "description": "",
- "properties": {
- "limits": {
- "type": "object",
- "description": "Maximum amount of compute resources allowed",
- "additionalProperties": {
- "$ref": "#/definitions/kubernetes_resource_Quantity",
- "javaType": "io.fabric8.kubernetes.api.model.resource.Quantity"
- },
- "javaType": "java.util.Map\u003cString,io.fabric8.kubernetes.api.model.resource.Quantity\u003e"
- },
- "requests": {
- "type": "object",
- "description": "Minimum amount of resources requested; requests are honored only for persistent volumes as of now",
- "additionalProperties": {
- "$ref": "#/definitions/kubernetes_resource_Quantity",
- "javaType": "io.fabric8.kubernetes.api.model.resource.Quantity"
- },
- "javaType": "java.util.Map\u003cString,io.fabric8.kubernetes.api.model.resource.Quantity\u003e"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ResourceRequirements"
- },
- "kubernetes_SELinuxOptions": {
- "type": "object",
- "description": "",
- "properties": {
- "level": {
- "type": "string",
- "description": "the level label to apply to the container"
- },
- "role": {
- "type": "string",
- "description": "the role label to apply to the container"
- },
- "type": {
- "type": "string",
- "description": "the type label to apply to the container"
- },
- "user": {
- "type": "string",
- "description": "the user label to apply to the container"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.SELinuxOptions"
- },
- "kubernetes_Secret": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "data": {
- "type": "object",
- "description": "data contains the secret data. Each key must be a valid DNS_SUBDOMAIN or leading dot followed by valid DNS_SUBDOMAIN. Each value must be a base64 encoded string as described in https://tools.ietf.org/html/rfc4648#section-4",
- "additionalProperties": {
- "type": "array",
- "description": "data contains the secret data. Each key must be a valid DNS_SUBDOMAIN or leading dot followed by valid DNS_SUBDOMAIN. Each value must be a base64 encoded string as described in https://tools.ietf.org/html/rfc4648#section-4",
- "items": {
- "type": "integer",
- "description": "data contains the secret data. Each key must be a valid DNS_SUBDOMAIN or leading dot followed by valid DNS_SUBDOMAIN. Each value must be a base64 encoded string as described in https://tools.ietf.org/html/rfc4648#section-4"
- }
- },
- "javaType": "java.util.Map\u003cString,String\u003e"
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "Secret",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ObjectMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta"
- },
- "type": {
- "type": "string",
- "description": "type facilitates programmatic handling of secret data"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Secret",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.HasMetadata"
- ]
- },
- "kubernetes_SecretList": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "items": {
- "type": "array",
- "description": "items is a list of secret objects",
- "items": {
- "$ref": "#/definitions/kubernetes_Secret",
- "javaType": "io.fabric8.kubernetes.api.model.Secret"
- }
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "SecretList",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ListMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ListMeta"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.SecretList",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.KubernetesResource"
- ]
- },
- "kubernetes_SecretVolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "secretName": {
- "type": "string",
- "description": "secretName is the name of a secret in the pod's namespace"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.SecretVolumeSource"
- },
- "kubernetes_SecurityContext": {
- "type": "object",
- "description": "",
- "properties": {
- "capabilities": {
- "$ref": "#/definitions/kubernetes_Capabilities",
- "javaType": "io.fabric8.kubernetes.api.model.Capabilities"
- },
- "privileged": {
- "type": "boolean",
- "description": "run the container in privileged mode"
- },
- "runAsUser": {
- "type": "integer",
- "description": "the user id that runs the first process in the container",
- "javaType": "Long"
- },
- "seLinuxOptions": {
- "$ref": "#/definitions/kubernetes_SELinuxOptions",
- "javaType": "io.fabric8.kubernetes.api.model.SELinuxOptions"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.SecurityContext"
- },
- "kubernetes_Service": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "Service",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ObjectMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta"
- },
- "spec": {
- "$ref": "#/definitions/kubernetes_ServiceSpec",
- "javaType": "io.fabric8.kubernetes.api.model.ServiceSpec"
- },
- "status": {
- "$ref": "#/definitions/kubernetes_ServiceStatus",
- "javaType": "io.fabric8.kubernetes.api.model.ServiceStatus"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Service",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.HasMetadata"
- ]
- },
- "kubernetes_ServiceAccount": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "ServiceAccount",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ObjectMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta"
- },
- "secrets": {
- "type": "array",
- "description": "list of secrets that can be used by pods running as this service account",
- "items": {
- "$ref": "#/definitions/kubernetes_ObjectReference",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectReference"
- }
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ServiceAccount",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.HasMetadata"
- ]
- },
- "kubernetes_ServiceAccountList": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "items": {
- "type": "array",
- "description": "list of ServiceAccounts",
- "items": {
- "$ref": "#/definitions/kubernetes_ServiceAccount",
- "javaType": "io.fabric8.kubernetes.api.model.ServiceAccount"
- }
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "ServiceAccountList",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ListMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ListMeta"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ServiceAccountList",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.KubernetesResource"
- ]
- },
- "kubernetes_ServiceList": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "items": {
- "type": "array",
- "description": "list of services",
- "items": {
- "$ref": "#/definitions/kubernetes_Service",
- "javaType": "io.fabric8.kubernetes.api.model.Service"
- }
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "ServiceList",
- "required": true
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_ListMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ListMeta"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ServiceList",
- "javaInterfaces": [
- "io.fabric8.kubernetes.api.model.KubernetesResource"
- ]
- },
- "kubernetes_ServicePort": {
- "type": "object",
- "description": "",
- "properties": {
- "name": {
- "type": "string",
- "description": "the name of this port; optional if only one port is defined",
- "maxLength": 63,
- "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
- },
- "nodePort": {
- "type": "integer",
- "description": "the port on each node on which this service is exposed"
- },
- "port": {
- "type": "integer",
- "description": "the port number that is exposed"
- },
- "protocol": {
- "type": "string",
- "description": "the protocol used by this port; must be UDP or TCP; TCP if unspecified"
- },
- "targetPort": {
- "$ref": "#/definitions/kubernetes_util_IntOrString",
- "javaType": "io.fabric8.kubernetes.api.model.util.IntOrString"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ServicePort"
- },
- "kubernetes_ServiceSpec": {
- "type": "object",
- "description": "",
- "properties": {
- "createExternalLoadBalancer": {
- "type": "boolean",
- "description": "set up a cloud-provider-specific load balancer on an external IP"
- },
- "portalIP": {
- "type": "string",
- "description": ""
- },
- "ports": {
- "type": "array",
- "description": "ports exposed by the service",
- "items": {
- "$ref": "#/definitions/kubernetes_ServicePort",
- "javaType": "io.fabric8.kubernetes.api.model.ServicePort"
- }
- },
- "publicIPs": {
- "type": "array",
- "description": "deprecated. externally visible IPs (e.g. load balancers) that should be proxied to this service",
- "items": {
- "type": "string",
- "description": "deprecated. externally visible IPs (e.g. load balancers) that should be proxied to this service"
- }
- },
- "selector": {
- "type": "object",
- "description": "label keys and values that must match in order to receive traffic for this service; if empty",
- "additionalProperties": {
- "type": "string",
- "description": "label keys and values that must match in order to receive traffic for this service; if empty"
- },
- "javaType": "java.util.Map\u003cString,String\u003e"
- },
- "sessionAffinity": {
- "type": "string",
- "description": "enable client IP based session affinity; must be ClientIP or None; defaults to None"
- },
- "type": {
- "type": "string",
- "description": "type of this service; must be ClusterIP"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ServiceSpec"
- },
- "kubernetes_ServiceStatus": {
- "type": "object",
- "description": "",
- "properties": {
- "loadBalancer": {
- "$ref": "#/definitions/kubernetes_LoadBalancerStatus",
- "javaType": "io.fabric8.kubernetes.api.model.LoadBalancerStatus"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.ServiceStatus"
- },
- "kubernetes_TCPSocketAction": {
- "type": "object",
- "description": "",
- "properties": {
- "port": {
- "$ref": "#/definitions/kubernetes_util_IntOrString",
- "javaType": "io.fabric8.kubernetes.api.model.util.IntOrString"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.TCPSocketAction"
- },
- "kubernetes_TypeMeta": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "version of the schema the object should have"
- },
- "kind": {
- "type": "string",
- "description": "kind of object"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.TypeMeta"
- },
- "kubernetes_Volume": {
- "type": "object",
- "description": "",
- "properties": {
- "awsElasticBlockStore": {
- "$ref": "#/definitions/kubernetes_AWSElasticBlockStoreVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.AWSElasticBlockStoreVolumeSource"
- },
- "emptyDir": {
- "$ref": "#/definitions/kubernetes_EmptyDirVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.EmptyDirVolumeSource"
- },
- "gcePersistentDisk": {
- "$ref": "#/definitions/kubernetes_GCEPersistentDiskVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.GCEPersistentDiskVolumeSource"
- },
- "gitRepo": {
- "$ref": "#/definitions/kubernetes_GitRepoVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.GitRepoVolumeSource"
- },
- "glusterfs": {
- "$ref": "#/definitions/kubernetes_GlusterfsVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.GlusterfsVolumeSource"
- },
- "hostPath": {
- "$ref": "#/definitions/kubernetes_HostPathVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.HostPathVolumeSource"
- },
- "iscsi": {
- "$ref": "#/definitions/kubernetes_ISCSIVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.ISCSIVolumeSource"
- },
- "name": {
- "type": "string",
- "description": "volume name; must be a DNS_LABEL and unique within the pod",
- "maxLength": 63,
- "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
- },
- "nfs": {
- "$ref": "#/definitions/kubernetes_NFSVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.NFSVolumeSource"
- },
- "persistentVolumeClaim": {
- "$ref": "#/definitions/kubernetes_PersistentVolumeClaimVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.PersistentVolumeClaimVolumeSource"
- },
- "rbd": {
- "$ref": "#/definitions/kubernetes_RBDVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.RBDVolumeSource"
- },
- "secret": {
- "$ref": "#/definitions/kubernetes_SecretVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.SecretVolumeSource"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.Volume"
- },
- "kubernetes_VolumeMount": {
- "type": "object",
- "description": "",
- "properties": {
- "mountPath": {
- "type": "string",
- "description": "path within the container at which the volume should be mounted"
- },
- "name": {
- "type": "string",
- "description": "name of the volume to mount"
- },
- "readOnly": {
- "type": "boolean",
- "description": "mounted read-only if true"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.VolumeMount"
- },
- "kubernetes_VolumeSource": {
- "type": "object",
- "description": "",
- "properties": {
- "awsElasticBlockStore": {
- "$ref": "#/definitions/kubernetes_AWSElasticBlockStoreVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.AWSElasticBlockStoreVolumeSource"
- },
- "emptyDir": {
- "$ref": "#/definitions/kubernetes_EmptyDirVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.EmptyDirVolumeSource"
- },
- "gcePersistentDisk": {
- "$ref": "#/definitions/kubernetes_GCEPersistentDiskVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.GCEPersistentDiskVolumeSource"
- },
- "gitRepo": {
- "$ref": "#/definitions/kubernetes_GitRepoVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.GitRepoVolumeSource"
- },
- "glusterfs": {
- "$ref": "#/definitions/kubernetes_GlusterfsVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.GlusterfsVolumeSource"
- },
- "hostPath": {
- "$ref": "#/definitions/kubernetes_HostPathVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.HostPathVolumeSource"
- },
- "iscsi": {
- "$ref": "#/definitions/kubernetes_ISCSIVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.ISCSIVolumeSource"
- },
- "nfs": {
- "$ref": "#/definitions/kubernetes_NFSVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.NFSVolumeSource"
- },
- "persistentVolumeClaim": {
- "$ref": "#/definitions/kubernetes_PersistentVolumeClaimVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.PersistentVolumeClaimVolumeSource"
- },
- "rbd": {
- "$ref": "#/definitions/kubernetes_RBDVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.RBDVolumeSource"
- },
- "secret": {
- "$ref": "#/definitions/kubernetes_SecretVolumeSource",
- "javaType": "io.fabric8.kubernetes.api.model.SecretVolumeSource"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.VolumeSource"
- },
- "kubernetes_base_ListMeta": {
- "type": "object",
- "description": "",
- "properties": {
- "resourceVersion": {
- "type": "string",
- "description": ""
- },
- "selfLink": {
- "type": "string",
- "description": ""
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.base.ListMeta"
- },
- "kubernetes_base_Status": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": "",
- "default": "v1beta3",
- "required": true,
- "enum": [
- "v1beta3",
- "v1"
- ]
- },
- "code": {
- "type": "integer",
- "description": ""
- },
- "details": {
- "$ref": "#/definitions/kubernetes_base_StatusDetails",
- "javaType": "io.fabric8.kubernetes.api.model.base.StatusDetails"
- },
- "kind": {
- "type": "string",
- "description": "",
- "default": "Status",
- "required": true
- },
- "message": {
- "type": "string",
- "description": ""
- },
- "metadata": {
- "$ref": "#/definitions/kubernetes_base_ListMeta",
- "javaType": "io.fabric8.kubernetes.api.model.base.ListMeta"
- },
- "reason": {
- "type": "string",
- "description": ""
- },
- "status": {
- "type": "string",
- "description": ""
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.base.Status"
- },
- "kubernetes_base_StatusCause": {
- "type": "object",
- "description": "",
- "properties": {
- "field": {
- "type": "string",
- "description": ""
- },
- "message": {
- "type": "string",
- "description": ""
- },
- "reason": {
- "type": "string",
- "description": ""
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.base.StatusCause"
- },
- "kubernetes_base_StatusDetails": {
- "type": "object",
- "description": "",
- "properties": {
- "causes": {
- "type": "array",
- "description": "",
- "items": {
- "$ref": "#/definitions/kubernetes_base_StatusCause",
- "javaType": "io.fabric8.kubernetes.api.model.base.StatusCause"
- }
- },
- "id": {
- "type": "string",
- "description": ""
- },
- "kind": {
- "type": "string",
- "description": ""
- },
- "retryAfterSeconds": {
- "type": "integer",
- "description": ""
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.base.StatusDetails"
- },
- "kubernetes_base_TypeMeta": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": ""
- },
- "kind": {
- "type": "string",
- "description": ""
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.base.TypeMeta"
- },
- "kubernetes_config_AuthInfo": {
- "type": "object",
- "description": "",
- "properties": {
- "client-certificate": {
- "type": "string",
- "description": ""
- },
- "client-certificate-data": {
- "type": "array",
- "description": "",
- "items": {
- "type": "integer",
- "description": ""
- }
- },
- "client-key": {
- "type": "string",
- "description": ""
- },
- "client-key-data": {
- "type": "array",
- "description": "",
- "items": {
- "type": "integer",
- "description": ""
- }
- },
- "extensions": {
- "type": "array",
- "description": "",
- "items": {
- "$ref": "#/definitions/kubernetes_config_NamedExtension",
- "javaType": "io.fabric8.kubernetes.api.model.config.NamedExtension"
- }
- },
- "password": {
- "type": "string",
- "description": ""
- },
- "token": {
- "type": "string",
- "description": ""
- },
- "username": {
- "type": "string",
- "description": ""
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.config.AuthInfo"
- },
- "kubernetes_config_Cluster": {
- "type": "object",
- "description": "",
- "properties": {
- "api-version": {
- "type": "string",
- "description": ""
- },
- "certificate-authority": {
- "type": "string",
- "description": ""
- },
- "certificate-authority-data": {
- "type": "array",
- "description": "",
- "items": {
- "type": "integer",
- "description": ""
- }
- },
- "extensions": {
- "type": "array",
- "description": "",
- "items": {
- "$ref": "#/definitions/kubernetes_config_NamedExtension",
- "javaType": "io.fabric8.kubernetes.api.model.config.NamedExtension"
- }
- },
- "insecure-skip-tls-verify": {
- "type": "boolean",
- "description": ""
- },
- "server": {
- "type": "string",
- "description": ""
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.config.Cluster"
- },
- "kubernetes_config_Config": {
- "type": "object",
- "description": "",
- "properties": {
- "apiVersion": {
- "type": "string",
- "description": ""
- },
- "clusters": {
- "type": "array",
- "description": "",
- "items": {
- "$ref": "#/definitions/kubernetes_config_NamedCluster",
- "javaType": "io.fabric8.kubernetes.api.model.config.NamedCluster"
- }
- },
- "contexts": {
- "type": "array",
- "description": "",
- "items": {
- "$ref": "#/definitions/kubernetes_config_NamedContext",
- "javaType": "io.fabric8.kubernetes.api.model.config.NamedContext"
- }
- },
- "current-context": {
- "type": "string",
- "description": ""
- },
- "extensions": {
- "type": "array",
- "description": "",
- "items": {
- "$ref": "#/definitions/kubernetes_config_NamedExtension",
- "javaType": "io.fabric8.kubernetes.api.model.config.NamedExtension"
- }
- },
- "kind": {
- "type": "string",
- "description": ""
- },
- "preferences": {
- "$ref": "#/definitions/kubernetes_config_Preferences",
- "javaType": "io.fabric8.kubernetes.api.model.config.Preferences"
- },
- "users": {
- "type": "array",
- "description": "",
- "items": {
- "$ref": "#/definitions/kubernetes_config_NamedAuthInfo",
- "javaType": "io.fabric8.kubernetes.api.model.config.NamedAuthInfo"
- }
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.config.Config"
- },
- "kubernetes_config_Context": {
- "type": "object",
- "description": "",
- "properties": {
- "cluster": {
- "type": "string",
- "description": ""
- },
- "extensions": {
- "type": "array",
- "description": "",
- "items": {
- "$ref": "#/definitions/kubernetes_config_NamedExtension",
- "javaType": "io.fabric8.kubernetes.api.model.config.NamedExtension"
- }
- },
- "namespace": {
- "type": "string",
- "description": ""
- },
- "user": {
- "type": "string",
- "description": ""
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.config.Context"
- },
- "kubernetes_config_NamedAuthInfo": {
- "type": "object",
- "description": "",
- "properties": {
- "name": {
- "type": "string",
- "description": ""
- },
- "user": {
- "$ref": "#/definitions/kubernetes_config_AuthInfo",
- "javaType": "io.fabric8.kubernetes.api.model.config.AuthInfo"
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.config.NamedAuthInfo"
- },
- "kubernetes_config_NamedCluster": {
- "type": "object",
- "description": "",
- "properties": {
- "cluster": {
- "$ref": "#/definitions/kubernetes_config_Cluster",
- "javaType": "io.fabric8.kubernetes.api.model.config.Cluster"
- },
- "name": {
- "type": "string",
- "description": ""
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.config.NamedCluster"
- },
- "kubernetes_config_NamedContext": {
- "type": "object",
- "description": "",
- "properties": {
- "context": {
- "$ref": "#/definitions/kubernetes_config_Context",
- "javaType": "io.fabric8.kubernetes.api.model.config.Context"
- },
- "name": {
- "type": "string",
- "description": ""
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.config.NamedContext"
- },
- "kubernetes_config_NamedExtension": {
- "type": "object",
- "description": "",
- "properties": {
- "extension": {
- "$ref": "#/definitions/kubernetes_runtime_RawExtension",
- "javaType": "io.fabric8.kubernetes.api.model.HasMetadata"
- },
- "name": {
- "type": "string",
- "description": ""
- }
- },
- "additionalProperties": true,
- "javaType": "io.fabric8.kubernetes.api.model.config.NamedExtension"
- },
- "kubernetes_config_Preferences": {
- "type": "object",
- "description": "",
- "properties": {
- "colors": {
- "type": "boolean",
- "description": ""
- },
- "extensions": {
- "type": "array",
- "description": "",
- "items": {
- "$ref": "#/definition
<TRUNCATED>
[11/12] stratos git commit: Fixing kubernetes api bundle's export
packages and port ranges in kubernetes clusters in samples
Posted by ga...@apache.org.
Fixing kubernetes api bundle's export packages and port ranges in kubernetes clusters in samples
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/ff1b1a66
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/ff1b1a66
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/ff1b1a66
Branch: refs/heads/tenant-isolation
Commit: ff1b1a66f7f77e44ac415a9efb15c5409d2e1763
Parents: 247b450
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sun Jul 26 14:50:09 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Thu Aug 27 16:43:25 2015 +0530
----------------------------------------------------------------------
components/org.apache.stratos.kubernetes.client/pom.xml | 1 +
dependencies/fabric8/kubernetes-api/pom.xml | 2 ++
.../org.apache.stratos.event.processor.server.feature/pom.xml | 2 +-
samples/kubernetes-clusters/kubernetes-cluster-1.json | 4 ++--
samples/kubernetes-clusters/kubernetes-cluster-2.json | 4 ++--
samples/kubernetes-clusters/kubernetes-cluster-ec2.json | 4 ++--
6 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/ff1b1a66/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 287688b..4676ee3 100644
--- a/components/org.apache.stratos.kubernetes.client/pom.xml
+++ b/components/org.apache.stratos.kubernetes.client/pom.xml
@@ -72,6 +72,7 @@
</Export-Package>
<Import-Package>
io.fabric8.kubernetes.api.*;version=${kubernetes.api.stratos.version},
+ io.fabric8.kubernetes.api.model.*;version=${kubernetes.api.stratos.version},
*;resolution:=optional
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
http://git-wip-us.apache.org/repos/asf/stratos/blob/ff1b1a66/dependencies/fabric8/kubernetes-api/pom.xml
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/pom.xml b/dependencies/fabric8/kubernetes-api/pom.xml
index 1ecf13e..605d358 100644
--- a/dependencies/fabric8/kubernetes-api/pom.xml
+++ b/dependencies/fabric8/kubernetes-api/pom.xml
@@ -142,6 +142,8 @@
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Export-Package>
io.fabric8.kubernetes.api.*;version=${kubernetes.api.stratos.version},
+ io.fabric8.kubernetes.api.model.*;version=${kubernetes.api.stratos.version},
+ io.fabric8.kubernetes.internal.*,
</Export-Package>
<Import-Package>
!javax.xml.bind.annotation.adapters,
http://git-wip-us.apache.org/repos/asf/stratos/blob/ff1b1a66/features/cep/org.apache.stratos.event.processor.server.feature/pom.xml
----------------------------------------------------------------------
diff --git a/features/cep/org.apache.stratos.event.processor.server.feature/pom.xml b/features/cep/org.apache.stratos.event.processor.server.feature/pom.xml
index 0260e8c..18b26b2 100644
--- a/features/cep/org.apache.stratos.event.processor.server.feature/pom.xml
+++ b/features/cep/org.apache.stratos.event.processor.server.feature/pom.xml
@@ -29,7 +29,7 @@
<version>4.1.0-SNAPSHOT</version>
<artifactId>org.apache.stratos.event.processor.server.feature</artifactId>
<packaging>pom</packaging>
- <name>Apache Stratos - Event Processor Server Feature</name>
+ <name>Apache Stratos - Event Processor Server Feature</name>
<url>http://apache.org</url>
<description>This feature contains the core bundles required for Back-end Event Processor functionality
</description>
http://git-wip-us.apache.org/repos/asf/stratos/blob/ff1b1a66/samples/kubernetes-clusters/kubernetes-cluster-1.json
----------------------------------------------------------------------
diff --git a/samples/kubernetes-clusters/kubernetes-cluster-1.json b/samples/kubernetes-clusters/kubernetes-cluster-1.json
index 4b07b41..399ba83 100644
--- a/samples/kubernetes-clusters/kubernetes-cluster-1.json
+++ b/samples/kubernetes-clusters/kubernetes-cluster-1.json
@@ -10,8 +10,8 @@
]
},
"portRange": {
- "upper": "5000",
- "lower": "4500"
+ "upper": "32767",
+ "lower": "30000"
},
"kubernetesHosts": [
{
http://git-wip-us.apache.org/repos/asf/stratos/blob/ff1b1a66/samples/kubernetes-clusters/kubernetes-cluster-2.json
----------------------------------------------------------------------
diff --git a/samples/kubernetes-clusters/kubernetes-cluster-2.json b/samples/kubernetes-clusters/kubernetes-cluster-2.json
index 6e2ac93..0bd2260 100644
--- a/samples/kubernetes-clusters/kubernetes-cluster-2.json
+++ b/samples/kubernetes-clusters/kubernetes-cluster-2.json
@@ -10,8 +10,8 @@
]
},
"portRange": {
- "upper": "5000",
- "lower": "4500"
+ "upper": "32767",
+ "lower": "30000"
},
"kubernetesHosts": [
{
http://git-wip-us.apache.org/repos/asf/stratos/blob/ff1b1a66/samples/kubernetes-clusters/kubernetes-cluster-ec2.json
----------------------------------------------------------------------
diff --git a/samples/kubernetes-clusters/kubernetes-cluster-ec2.json b/samples/kubernetes-clusters/kubernetes-cluster-ec2.json
index 0affc00..02a26f9 100644
--- a/samples/kubernetes-clusters/kubernetes-cluster-ec2.json
+++ b/samples/kubernetes-clusters/kubernetes-cluster-ec2.json
@@ -10,8 +10,8 @@
]
},
"portRange": {
- "upper": "5000",
- "lower": "4500"
+ "upper": "32767",
+ "lower": "30000"
},
"kubernetesHosts": [
{
[06/12] stratos git commit: Upgrading fabric8 kubernetes api version
to 2.2.16 and removing forked code
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/UserConfigurationCompare.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/UserConfigurationCompare.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/UserConfigurationCompare.java
deleted file mode 100644
index a04c900..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/UserConfigurationCompare.java
+++ /dev/null
@@ -1,201 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.ObjectMeta;
-import io.fabric8.kubernetes.api.support.KindToClassMapping;
-import io.fabric8.utils.Objects;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.validation.constraints.NotNull;
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Helper methods to compare the user configuration on entities
- */
-public class UserConfigurationCompare {
- private static final transient Logger LOG = LoggerFactory.getLogger(UserConfigurationCompare.class);
-
- protected static final Set<String> ignoredProperties = new HashSet<>(Arrays.asList("status"));
-
-
- /**
- * This method detects if the user has changed the configuration of an entity.
- * <p/>
- * It compares the <b>user</b> configuration of 2 object trees ignoring any
- * runtime status or timestamp information.
- *
- * @return true if the configurations are equal.
- */
- public static boolean configEqual(Object entity1, Object entity2) {
- if (entity1 == entity2) {
- return true;
- } else if (entity1 == null || entity2 == null) {
- return false;
- } else if (entity1 instanceof Map) {
- return configEqualMap((Map) entity1, castTo(Map.class, entity2));
- } else if (entity2 instanceof Map) {
- return configEqualMap((Map) entity1, castTo(Map.class, entity2));
- } else if (entity2 instanceof ObjectMeta) {
- return configEqualObjectMeta((ObjectMeta) entity1, castTo(ObjectMeta.class, entity2));
- } else {
- Set<Class<?>> classes = new HashSet<>(KindToClassMapping.getKindToClassMap().values());
- Class<?> aClass = entity1.getClass();
- if (classes.contains(aClass)) {
- Object castEntity2 = castTo(aClass, entity2);
- if (castEntity2 == null) {
- return false;
- } else {
- return configEqualKubernetesDTO(entity1, entity2, aClass);
- }
- } else {
- return Objects.equal(entity1, entity2);
- }
- }
- }
-
-
- /**
- * Compares 2 instances of the given Kubernetes DTO class to see if the user has changed their configuration.
- * <p/>
- * This method will ignore properties {@link #ignoredProperties} such as status or timestamp properties
- */
- protected static boolean configEqualKubernetesDTO(@NotNull Object entity1, @NotNull Object entity2, @NotNull Class<?> clazz) {
- // lets iterate through the objects making sure we've not
- BeanInfo beanInfo = null;
- try {
- beanInfo = Introspector.getBeanInfo(clazz);
- } catch (IntrospectionException e) {
- LOG.warn("Failed to get beanInfo for " + clazz.getName() + ". " + e, e);
- return false;
- }
- try {
- PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
- for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
- String name = propertyDescriptor.getName();
- if (ignoredProperties.contains(name)) {
- continue;
- }
- Method readMethod = propertyDescriptor.getReadMethod();
- if (readMethod != null) {
- Object value1 = invokeMethod(entity1, readMethod);
- Object value2 = invokeMethod(entity2, readMethod);
- if (!configEqual(value1, value2)) {
- return false;
- }
- }
- }
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
- protected static Object invokeMethod(@NotNull Object entity, Method readMethod) throws InvocationTargetException, IllegalAccessException {
- try {
- return readMethod.invoke(entity);
- } catch (Exception e) {
- LOG.warn("Failed to invoke method " + readMethod + " on " + entity + ". " + e, e);
- throw e;
- }
- }
-
- protected static boolean configEqualObjectMeta(ObjectMeta entity1, ObjectMeta entity2) {
- if (entity1 == entity2) {
- return true;
- } else if (entity1 == null || entity2 == null) {
- return false;
- }
- // TODO should we ignore annotations?
- return Objects.equal(entity1.getName(), entity2.getName()) &&
- Objects.equal(entity1.getNamespace(), entity2.getNamespace()) &&
- configEqualMap(entity1.getLabels(), entity2.getLabels()) &&
- configEqualMap(entity1.getAnnotations(), entity2.getAnnotations());
- }
-
- protected static <T> T castTo(Class<T> clazz, Object entity) {
- if (clazz.isInstance(entity)) {
- return clazz.cast(entity);
- } else {
- if (entity != null) {
- LOG.warn("Invalid class " + entity.getClass().getName() + " when expecting " + clazz.getName() + " for instance: " + entity);
- }
- return null;
- }
- }
-
- protected static boolean configEqualMap(Map entity1, Map entity2) {
- if (entity1 == entity2) {
- return true;
- } else if (entity1 == null || entity2 == null) {
- return false;
- }
- int size1 = size(entity1);
- int size2 = size(entity2);
- if (size1 != size2) {
- return false;
- }
- Set<Map.Entry> entries = entity1.entrySet();
- for (Map.Entry entry : entries) {
- Object key = entry.getKey();
- Object value = entry.getValue();
- Object value2 = entity2.get(key);
- if (!configEqual(value, value2)) {
- return false;
- }
- }
- return true;
- }
-
- protected static boolean configEqualList(List v1, List v2) {
- int size1 = size(v1);
- int size2 = size(v2);
- if (size1 != size2) {
- return false;
- }
- int idx = 0;
- for (Object value : v1) {
- Object value2 = v2.get(idx++);
- if (!configEqual(value, value2)) {
- return false;
- }
- }
- return true;
- }
-
-
- protected static int size(Map map) {
- return (map == null) ? 0 : map.size();
- }
-
- protected static int size(Collection coll) {
- return (coll == null) ? 0 : coll.size();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Watcher.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Watcher.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Watcher.java
deleted file mode 100644
index a6447ce..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/Watcher.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.HasMetadata;
-
-public interface Watcher<T extends HasMetadata> {
-
- enum Action {
- ADDED, MODIFIED, DELETED, ERROR
- }
-
- void eventReceived(Action action, T object);
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builders/ListEnvVarBuilder.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builders/ListEnvVarBuilder.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builders/ListEnvVarBuilder.java
deleted file mode 100644
index e97ec01..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builders/ListEnvVarBuilder.java
+++ /dev/null
@@ -1,43 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.builders;
-
-import io.fabric8.kubernetes.api.model.EnvVar;
-import io.fabric8.utils.Strings;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A little helper class to build a <code>List<EnvVar></code> object
- */
-public class ListEnvVarBuilder {
- private List<EnvVar> envVars = new ArrayList<>();
-
- public void withEnvVar(String name, String value) {
- if (Strings.isNotBlank(name) && value != null) {
- EnvVar envVar = new EnvVar();
- envVar.setName(name);
- envVar.setValue(value);
- envVars.add(envVar);
- }
- }
-
- public List<EnvVar> build() {
- return envVars;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildFinishedEvent.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildFinishedEvent.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildFinishedEvent.java
deleted file mode 100644
index 071979c..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildFinishedEvent.java
+++ /dev/null
@@ -1,64 +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.builds;
-
-import io.fabric8.openshift.api.model.Build;
-
-/**
- */
-public class BuildFinishedEvent {
- private final String uid;
- private final Build build;
- private final boolean loading;
- private final String buildLink;
-
- public BuildFinishedEvent(String uid, Build build, boolean loading, String buildLink) {
- this.uid = uid;
- this.build = build;
- this.loading = loading;
- this.buildLink = buildLink;
- }
-
- public String getUid() {
- return uid;
- }
-
- public Build getBuild() {
- return build;
- }
-
- public String getBuildLink() {
- return buildLink;
- }
-
- public boolean isLoading() {
- return loading;
- }
-
- public String getStatus() {
- return build.getStatus().getPhase();
- }
-
- public String getConfigName() {
- return Builds.getBuildConfigName(build);
- }
-
- public String getNamespace() {
- return Builds.getNamespace(build);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildListener.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildListener.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildListener.java
deleted file mode 100644
index 3edf170..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildListener.java
+++ /dev/null
@@ -1,30 +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.builds;
-
-/**
- * A strategy for processing completed builds
- */
-public interface BuildListener {
- /**
- * The build that has completed (successfully or not) and the flag indicating whether or not
- * this is the first time the watcher is being started up (so you should check if you've already
- * received and processed this event before).
- */
- void onBuildFinished(BuildFinishedEvent event);
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildWatcher.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildWatcher.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildWatcher.java
deleted file mode 100644
index 5fb1cf4..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/BuildWatcher.java
+++ /dev/null
@@ -1,121 +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.builds;
-
-import io.fabric8.kubernetes.api.KubernetesClient;
-import io.fabric8.openshift.api.model.Build;
-import io.fabric8.openshift.api.model.BuildList;
-import io.fabric8.utils.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-
-/**
- */
-public class BuildWatcher {
- private static final transient Logger LOG = LoggerFactory.getLogger(BuildWatcher.class);
-
- private final KubernetesClient kubernetes;
- private final BuildListener buildListener;
- private final String namespace;
- private final String fabric8ConsoleLink;
- private boolean loading = true;
- private Set<String> seenBuildIds = Collections.<String>synchronizedSet(new HashSet<String>());
-
- public BuildWatcher(KubernetesClient kubernetes, BuildListener buildListener, String namespace, String fabric8ConsoleLink) {
- this.kubernetes = kubernetes;
- this.buildListener = buildListener;
- this.namespace = namespace;
- this.fabric8ConsoleLink = fabric8ConsoleLink;
- }
-
-
- public TimerTask schedule(long delay) {
- Timer timer = new Timer();
- return schedule(timer, delay);
- }
-
- public TimerTask schedule(Timer timer, long delay) {
- TimerTask task = new TimerTask() {
- @Override
- public void run() {
- poll();
- }
- };
- timer.schedule(task, delay, delay);
- return task;
- }
-
- public void poll() {
- boolean foundBuild = false;
- BuildList buildList = kubernetes.getBuilds(namespace);
- if (buildList != null) {
- List<Build> items = buildList.getItems();
- if (items != null) {
- for (Build build : items) {
- buildPolled(build);
- foundBuild = true;
- }
- }
- }
- if (foundBuild) {
- loading = false;
- }
- }
-
- protected void buildPolled(Build build) {
- String status = build.getStatus().getPhase();
- if (status != null) {
- if (Builds.isFinished(status)) {
- String uid = Builds.getUid(build);
- if (Strings.isNullOrBlank(uid)) {
- LOG.warn("Ignoring bad build which has no UID: " + build);
- } else {
- if (seenBuildIds.add(uid)) {
- String name = Builds.getName(build);
- String buildLink = Builds.createConsoleBuildLink(this.fabric8ConsoleLink, name);
- BuildFinishedEvent event = new BuildFinishedEvent(uid, build, loading, buildLink);
- buildListener.onBuildFinished(event);
- }
- }
- }
- }
- }
-
- /**
- * Waits until this watcher is finished (which by default is forever)
- */
- public void join() {
- Object lock = new Object();
- while (true) {
- synchronized(lock) {
- try {
- lock.wait();
- } catch (InterruptedException e) {
- // ignore
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Builds.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Builds.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Builds.java
deleted file mode 100644
index 61f7330..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Builds.java
+++ /dev/null
@@ -1,199 +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.builds;
-
-import io.fabric8.kubernetes.api.KubernetesHelper;
-import io.fabric8.openshift.api.model.Build;
-import io.fabric8.openshift.api.model.BuildConfig;
-import io.fabric8.utils.Objects;
-import io.fabric8.utils.Strings;
-import io.fabric8.utils.URLUtils;
-
-import java.util.Collections;
-import java.util.Date;
-import java.util.Map;
-
-/**
- */
-public class Builds {
-
- public static class Status {
- public static final String COMPLETE = "Complete";
- public static final String FAIL = "Fail";
- public static final String ERROR = "Error";
- public static final String CANCELLED = "Cancelled";
- }
-
- public static boolean isCompleted(String status) {
- return Objects.equal(Status.COMPLETE, status);
- }
-
- public static boolean isCancelled(String status) {
- return Objects.equal(Status.CANCELLED, status);
- }
-
- public static boolean isFailed(String status) {
- if (status != null) {
- return status.startsWith(Status.FAIL) || status.startsWith(Status.ERROR);
- }
- return false;
- }
-
- public static boolean isFinished(String status) {
- return isCompleted(status) || isFailed(status) || isCancelled(status);
- }
-
- /**
- * Returns a unique UUID for a build
- */
- public static String getUid(Build build) {
- String answer = null;
- if (build != null) {
- answer = build.getMetadata().getUid();
- if (Strings.isNullOrBlank(answer)) {
- Map<String, Object> metadata = getMetadata(build);
- answer = getString(metadata, "uid");
- if (Strings.isNullOrBlank(answer)) {
- answer = getString(metadata, "id");
- }
- if (Strings.isNullOrBlank(answer)) {
- answer = getString(metadata, "name");
- }
- }
- if (Strings.isNullOrBlank(answer)) {
- answer = build.getMetadata().getName();
- }
- }
- return answer;
- }
-
- protected static String getString(Map<String, Object> metadata, String name) {
- Object answer = metadata.get(name);
- if (answer != null) {
- return answer.toString();
- }
- return null;
- }
-
- public static Map<String, Object> getMetadata(Build build) {
- if (build != null) {
- Map<String, Object> additionalProperties = build.getAdditionalProperties();
- if (additionalProperties != null) {
- Object metadata = additionalProperties.get("metadata");
- if (metadata instanceof Map) {
- return (Map<String, Object>) metadata;
- }
- }
- }
- return Collections.EMPTY_MAP;
-
- }
-
- public static Map<String, Object> getMetadata(BuildConfig build) {
- if (build != null) {
- Map<String, Object> additionalProperties = build.getAdditionalProperties();
- if (additionalProperties != null) {
- Object metadata = additionalProperties.get("metadata");
- if (metadata instanceof Map) {
- return (Map<String, Object>) metadata;
- }
- }
- }
- return Collections.EMPTY_MAP;
-
- }
-
- public static String getName(BuildConfig build) {
- String answer = null;
- if (build != null) {
- Map<String, Object> metadata = getMetadata(build);
- answer = getString(metadata, "name");
- if (Strings.isNullOrBlank(answer)) {
- answer = build.getMetadata().getName();
- }
- }
- return answer;
- }
-
- public static String getName(Build build) {
- String answer = null;
- if (build != null) {
- Map<String, Object> metadata = getMetadata(build);
- answer = getString(metadata, "name");
- if (Strings.isNullOrBlank(answer)) {
- answer = build.getMetadata().getName();
- }
- }
- return answer;
- }
-
- public static String getNamespace(Build build) {
- String answer = null;
- if (build != null) {
- Map<String, Object> metadata = getMetadata(build);
- answer = getString(metadata, "namespace");
- if (Strings.isNullOrBlank(answer)) {
- answer = build.getMetadata().getNamespace();
- }
- }
- return answer;
- }
-
-
- public static String getCreationTimestamp(Build build) {
- String answer = null;
- if (build != null) {
- Map<String, Object> metadata = getMetadata(build);
- answer = getString(metadata, "creationTimestamp");
- if (Strings.isNullOrBlank(answer)) {
- answer = build.getMetadata().getCreationTimestamp();
- }
- }
- return answer;
- }
-
- public static Date getCreationTimestampDate(Build build) {
- String text = getCreationTimestamp(build);
- if (Strings.isNullOrBlank(text)) {
- return null;
- } else {
- return KubernetesHelper.parseDate(text);
- }
- }
-
-
- public static String getBuildConfigName(Build build) {
- if (build != null) {
- Map<String, Object> metadata = getMetadata(build);
- Object labels = metadata.get("labels");
- if (labels instanceof Map) {
- Map<String,Object> labelMap = (Map<String,Object>) labels;
- return getString(labelMap, "buildconfig");
- }
- }
- return null;
- }
-
- /**
- * Returns the link to the build page in the console for the given build UUID
- */
- public static String createConsoleBuildLink(String fabricConsoleExternalUrl, String buildName) {
- return URLUtils.pathJoin(fabricConsoleExternalUrl, "kubernetes/builds", buildName);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Links.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Links.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Links.java
deleted file mode 100644
index b7b544d..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/builds/Links.java
+++ /dev/null
@@ -1,35 +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.builds;
-
-import io.fabric8.utils.Strings;
-
-/**
- */
-public class Links {
-
- private static final String DEFAULT_FABRIC8_CONSOLE = "http://fabric8.local/";
-
- public static String getFabric8ConsoleLink() {
- String answer = System.getenv("FABRIC8_CONSOLE");
- if (Strings.isNullOrBlank(answer)) {
- answer = DEFAULT_FABRIC8_CONSOLE;
- }
- return answer;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Configs.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Configs.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Configs.java
deleted file mode 100644
index 11ce41c..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Configs.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.extensions;
-
-import io.fabric8.kubernetes.api.model.config.AuthInfo;
-import io.fabric8.kubernetes.api.model.config.Config;
-import io.fabric8.kubernetes.api.KubernetesHelper;
-import io.fabric8.kubernetes.api.model.config.Context;
-import io.fabric8.kubernetes.api.model.config.NamedAuthInfo;
-import io.fabric8.kubernetes.api.model.config.NamedContext;
-import io.fabric8.utils.Objects;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-/**
- * Helper class for working with the YAML config file thats located in
- * <code>~/.config/openshift/config</code> which is updated when you use commands
- * like <code>osc login</code> and <code>osc project myproject</code>
- */
-public class Configs {
- public static final String OPENSHIFT_CONFIG_FILE_PROPERTY = "openshift.config.file";
- public static final String OPENSHIFT_CONFIG_FILE_ENV_VAR = "OPENSHIFTCONFIG";
- private static final transient Logger LOG = LoggerFactory.getLogger(Configs.class);
-
- public static Config parseConfigs() {
- File file = getOpenShiftConfigFile();
- if (file.exists() && file.isFile()) {
- try {
- return KubernetesHelper.loadYaml(file, Config.class);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- return null;
- }
-
- /**
- * Returns the current context in the given config
- */
- public static Context getCurrentContext(Config config) {
- String contextName = config.getCurrentContext();
- if (contextName != null) {
- List<NamedContext> contexts = config.getContexts();
- if (contexts != null) {
- for (NamedContext context : contexts) {
- if (Objects.equal(contextName, context.getName())) {
- return context.getContext();
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the current user token for the config and current context
- */
- public static String getUserToken(Config config, Context context) {
- AuthInfo authInfo = getUserAuthInfo(config, context);
- if (authInfo != null) {
- return authInfo.getToken();
- }
- return null;
- }
-
- /**
- * Returns the current {@link AuthInfo} for the current context and user
- */
- public static AuthInfo getUserAuthInfo(Config config, Context context) {
- AuthInfo authInfo = null;
- if (config != null && context != null) {
- String user = context.getUser();
- if (user != null) {
- List<NamedAuthInfo> users = config.getUsers();
- if (users != null) {
- for (NamedAuthInfo namedAuthInfo : users) {
- if (Objects.equal(user, namedAuthInfo.getName())) {
- authInfo = namedAuthInfo.getUser();
- }
- }
- }
- }
- }
- return authInfo;
- }
-
- public static File getOpenShiftConfigFile() {
- String file = System.getProperty(OPENSHIFT_CONFIG_FILE_PROPERTY);
- if (file != null) {
- return new File(file);
- }
- file = System.getenv(OPENSHIFT_CONFIG_FILE_ENV_VAR);
- if (file != null) {
- return new File(file);
- }
- String homeDir = System.getProperty("user.home", ".");
- return new File(homeDir, ".config/openshift/config");
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Templates.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Templates.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Templates.java
deleted file mode 100644
index 7ecce66..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/extensions/Templates.java
+++ /dev/null
@@ -1,225 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.extensions;
-
-import io.fabric8.kubernetes.api.KubernetesHelper;
-import io.fabric8.kubernetes.api.model.HasMetadata;
-import io.fabric8.kubernetes.api.model.KubernetesList;
-import io.fabric8.openshift.api.model.template.Parameter;
-import io.fabric8.openshift.api.model.template.Template;
-import io.fabric8.utils.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import static io.fabric8.kubernetes.api.KubernetesFactory.createObjectMapper;
-
-/**
- * Helper class for working with OpenShift Templates
- */
-public class Templates {
- private static final transient Logger LOG = LoggerFactory.getLogger(Templates.class);
-
- /**
- * Allows a list of resources to be combined into a single Template if one or more templates are contained inside the list
- * or just return the unchanged list if no templates are present.
- */
- public static Object combineTemplates(KubernetesList kubernetesList) {
- Template firstTemplate = null;
- List<HasMetadata> items = kubernetesList.getItems();
- for (HasMetadata item : items) {
- if (item instanceof Template) {
- Template template = (Template) item;
- if (firstTemplate == null) {
- firstTemplate = template;
- } else {
- firstTemplate = combineTemplates(firstTemplate, template);
- }
- }
- }
- if (firstTemplate != null) {
- for (HasMetadata object : items) {
- if (!(object instanceof Template)) {
- addTemplateObject(firstTemplate, object);
- }
- }
- }
- return firstTemplate != null ? firstTemplate : kubernetesList;
- }
-
- public static Template combineTemplates(Template firstTemplate, Template template) {
- List<HasMetadata> objects = template.getObjects();
- if (objects != null) {
- for (HasMetadata object : objects) {
- addTemplateObject(firstTemplate, object);
- }
- }
- List<Parameter> parameters = firstTemplate.getParameters();
- if (parameters == null) {
- parameters = new ArrayList<>();
- firstTemplate.setParameters(parameters);
- }
- combineParameters(parameters, template.getParameters());
- String name = KubernetesHelper.getName(template);
- if (Strings.isNotBlank(name)) {
- // lets merge all the fabric8 annotations using the template id qualifier as a postfix
- Map<String, String> annotations = KubernetesHelper.getOrCreateAnnotations(firstTemplate);
- Map<String, String> otherAnnotations = KubernetesHelper.getOrCreateAnnotations(template);
- Set<Map.Entry<String, String>> entries = otherAnnotations.entrySet();
- for (Map.Entry<String, String> entry : entries) {
- String key = entry.getKey();
- String value = entry.getValue();
- if (!annotations.containsKey(key)) {
- annotations.put(key, value);
- }
- }
- }
- return firstTemplate;
- }
-
- protected static void combineParameters(List<Parameter> parameters, List<Parameter> otherParameters) {
- if (otherParameters != null && otherParameters.size() > 0) {
- Map<String, Parameter> map = new HashMap<>();
- for (Parameter parameter : parameters) {
- map.put(parameter.getName(), parameter);
- }
- for (Parameter otherParameter : otherParameters) {
- String name = otherParameter.getName();
- Parameter original = map.get(name);
- if (original == null) {
- parameters.add(otherParameter);
- } else {
- if (Strings.isNotBlank(original.getValue())) {
- original.setValue(otherParameter.getValue());
- }
- }
- }
- }
- }
-
- public static void addTemplateObject(Template template, HasMetadata object) {
- List<HasMetadata> objects = template.getObjects();
- objects.add(object);
- template.setObjects(objects);
- }
-
-
- /**
- * If we have any templates inside the items then lets unpack them and combine any parameters
- * @param kubernetesList
- * @param items
- */
- public static Object combineTemplates(KubernetesList kubernetesList, List<HasMetadata> items) {
- Template template = null;
- for (HasMetadata item : items) {
- if (item instanceof Template) {
- Template aTemplate = (Template) item;
- if (template == null) {
- template = aTemplate;
- } else {
- template = combineTemplates(template, aTemplate);
- }
- }
- }
- if (template != null) {
- // lets move all the content into the template
- for (HasMetadata item : items) {
- if (!(item instanceof Template)) {
- addTemplateObject(template, item);
- }
- }
- List<HasMetadata> objects = template.getObjects();
- return template;
- } else {
- return kubernetesList;
- }
- }
-
-
- /**
- * Lets allow template parameters to be overridden with a Properties object
- */
- public static void overrideTemplateParameters(Template template, Map<String, String> properties, String propertyNamePrefix) {
- List<io.fabric8.openshift.api.model.template.Parameter> parameters = template.getParameters();
- if (parameters != null && properties != null) {
- boolean missingProperty = false;
- for (io.fabric8.openshift.api.model.template.Parameter parameter : parameters) {
- String parameterName = parameter.getName();
- String name = propertyNamePrefix + parameterName;
- String propertyValue = properties.get(name);
- if (Strings.isNotBlank(propertyValue)) {
- LOG.info("Overriding template parameter " + name + " with value: " + propertyValue);
- parameter.setValue(propertyValue);
- } else {
- missingProperty = true;
- LOG.info("No property defined for template parameter: " + name);
- }
- }
- if (missingProperty) {
- LOG.debug("current properties " + new TreeSet<>(properties.keySet()));
- }
- }
- }
-
- /**
- * Lets locally process the templates so that we can process templates on any kubernetes environment
- */
- public static KubernetesList processTemplatesLocally(Template entity) throws IOException {
- List<HasMetadata> objects = null;
- if (entity != null) {
- objects = entity.getObjects();
- if (objects == null || objects.isEmpty()) {
- return null;
- }
- }
- List<Parameter> parameters = entity.getParameters();
- if (parameters != null && !parameters.isEmpty()) {
- String json = "{\"kind\": \"List\", \"apiVersion\": \"" +
- KubernetesHelper.defaultApiVersion + "\",\n" +
- " \"items\": " +
- KubernetesHelper.toJson(objects) +
- " }";
-
- // lets make a few passes in case there's expressions in values
- for (int i = 0; i < 5; i++) {
- for (Parameter parameter : parameters) {
- String name = parameter.getName();
- String regex = "\\$\\{" + name + "\\}";
- String value = parameter.getValue();
-
- // TODO generate random strings for passwords etc!
- if (Strings.isNullOrBlank(value)) {
- throw new IllegalArgumentException("No value available for parameter name: " + name);
- }
- json = Strings.replaceAllWithoutRegex(json, regex, value);
- }
- }
- return createObjectMapper().reader(KubernetesList.class).readValue(json);
- } else {
- KubernetesList answer = new KubernetesList();
- answer.setItems(objects);
- return answer;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/support/KindToClassMapping.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/support/KindToClassMapping.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/support/KindToClassMapping.java
deleted file mode 100644
index f729942..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/support/KindToClassMapping.java
+++ /dev/null
@@ -1,264 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.support;
-
-
-import io.fabric8.kubernetes.api.model.*;
-import io.fabric8.kubernetes.api.model.base.ListMeta;
-import io.fabric8.kubernetes.api.model.base.Status;
-import io.fabric8.kubernetes.api.model.base.StatusCause;
-import io.fabric8.kubernetes.api.model.base.StatusDetails;
-import io.fabric8.kubernetes.api.model.config.AuthInfo;
-import io.fabric8.kubernetes.api.model.config.Cluster;
-import io.fabric8.kubernetes.api.model.config.Config;
-import io.fabric8.kubernetes.api.model.config.Context;
-import io.fabric8.kubernetes.api.model.config.NamedAuthInfo;
-import io.fabric8.kubernetes.api.model.config.NamedCluster;
-import io.fabric8.kubernetes.api.model.config.NamedContext;
-import io.fabric8.kubernetes.api.model.config.NamedExtension;
-import io.fabric8.kubernetes.api.model.config.Preferences;
-import io.fabric8.kubernetes.api.model.errors.StatusError;
-import io.fabric8.kubernetes.api.model.resource.Quantity;
-import io.fabric8.kubernetes.api.model.util.IntOrString;
-import io.fabric8.openshift.api.model.Build;
-import io.fabric8.openshift.api.model.BuildConfig;
-import io.fabric8.openshift.api.model.BuildConfigList;
-import io.fabric8.openshift.api.model.BuildConfigSpec;
-import io.fabric8.openshift.api.model.BuildConfigStatus;
-import io.fabric8.openshift.api.model.BuildList;
-import io.fabric8.openshift.api.model.BuildOutput;
-import io.fabric8.openshift.api.model.BuildSource;
-import io.fabric8.openshift.api.model.BuildSpec;
-import io.fabric8.openshift.api.model.BuildStatus;
-import io.fabric8.openshift.api.model.BuildStrategy;
-import io.fabric8.openshift.api.model.BuildTriggerPolicy;
-import io.fabric8.openshift.api.model.CustomBuildStrategy;
-import io.fabric8.openshift.api.model.CustomDeploymentStrategyParams;
-import io.fabric8.openshift.api.model.DeploymentCause;
-import io.fabric8.openshift.api.model.DeploymentCauseImageTrigger;
-import io.fabric8.openshift.api.model.DeploymentConfig;
-import io.fabric8.openshift.api.model.DeploymentConfigList;
-import io.fabric8.openshift.api.model.DeploymentConfigSpec;
-import io.fabric8.openshift.api.model.DeploymentConfigStatus;
-import io.fabric8.openshift.api.model.DeploymentDetails;
-import io.fabric8.openshift.api.model.DeploymentStrategy;
-import io.fabric8.openshift.api.model.DeploymentTriggerImageChangeParams;
-import io.fabric8.openshift.api.model.DeploymentTriggerPolicy;
-import io.fabric8.openshift.api.model.DockerBuildStrategy;
-import io.fabric8.openshift.api.model.ExecNewPodHook;
-import io.fabric8.openshift.api.model.GitBuildSource;
-import io.fabric8.openshift.api.model.GitSourceRevision;
-import io.fabric8.openshift.api.model.Image;
-import io.fabric8.openshift.api.model.ImageChangeTrigger;
-import io.fabric8.openshift.api.model.ImageList;
-import io.fabric8.openshift.api.model.ImageStream;
-import io.fabric8.openshift.api.model.ImageStreamList;
-import io.fabric8.openshift.api.model.ImageStreamSpec;
-import io.fabric8.openshift.api.model.ImageStreamStatus;
-import io.fabric8.openshift.api.model.LifecycleHook;
-import io.fabric8.openshift.api.model.NamedTagEventList;
-import io.fabric8.openshift.api.model.NamedTagReference;
-import io.fabric8.openshift.api.model.OAuthAccessToken;
-import io.fabric8.openshift.api.model.OAuthAccessTokenList;
-import io.fabric8.openshift.api.model.OAuthAuthorizeToken;
-import io.fabric8.openshift.api.model.OAuthAuthorizeTokenList;
-import io.fabric8.openshift.api.model.OAuthClient;
-import io.fabric8.openshift.api.model.OAuthClientAuthorization;
-import io.fabric8.openshift.api.model.OAuthClientAuthorizationList;
-import io.fabric8.openshift.api.model.OAuthClientList;
-import io.fabric8.openshift.api.model.RecreateDeploymentStrategyParams;
-import io.fabric8.openshift.api.model.RollingDeploymentStrategyParams;
-import io.fabric8.openshift.api.model.Route;
-import io.fabric8.openshift.api.model.RouteList;
-import io.fabric8.openshift.api.model.RouteSpec;
-import io.fabric8.openshift.api.model.RouteStatus;
-import io.fabric8.openshift.api.model.SourceBuildStrategy;
-import io.fabric8.openshift.api.model.SourceControlUser;
-import io.fabric8.openshift.api.model.SourceRevision;
-import io.fabric8.openshift.api.model.TLSConfig;
-import io.fabric8.openshift.api.model.TagEvent;
-import io.fabric8.openshift.api.model.WebHookTrigger;
-import io.fabric8.openshift.api.model.template.Parameter;
-import io.fabric8.openshift.api.model.template.Template;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Maps the Kubernetes kinds to the Jackson DTO classes
- */
-public class KindToClassMapping {
- private static Map<String,Class<?>> map = new HashMap<>();
-
- static {
- map.put("AWSElasticBlockStoreVolumeSource", AWSElasticBlockStoreVolumeSource.class);
- map.put("AuthInfo", AuthInfo.class);
- map.put("BaseKubernetesList", BaseKubernetesList.class);
- map.put("Build", Build.class);
- map.put("BuildConfig", BuildConfig.class);
- map.put("BuildConfigList", BuildConfigList.class);
- map.put("BuildConfigSpec", BuildConfigSpec.class);
- map.put("BuildConfigStatus", BuildConfigStatus.class);
- map.put("BuildList", BuildList.class);
- map.put("BuildOutput", BuildOutput.class);
- map.put("BuildSource", BuildSource.class);
- map.put("BuildSpec", BuildSpec.class);
- map.put("BuildStatus", BuildStatus.class);
- map.put("BuildStrategy", BuildStrategy.class);
- map.put("BuildTriggerPolicy", BuildTriggerPolicy.class);
- map.put("Capabilities", Capabilities.class);
- map.put("Cluster", Cluster.class);
- map.put("Config", Config.class);
- map.put("Container", Container.class);
- map.put("ContainerPort", ContainerPort.class);
- map.put("ContainerState", ContainerState.class);
- map.put("ContainerStateRunning", ContainerStateRunning.class);
- map.put("ContainerStateTerminated", ContainerStateTerminated.class);
- map.put("ContainerStateWaiting", ContainerStateWaiting.class);
- map.put("ContainerStatus", ContainerStatus.class);
- map.put("Context", Context.class);
- map.put("CustomBuildStrategy", CustomBuildStrategy.class);
- map.put("CustomDeploymentStrategyParams", CustomDeploymentStrategyParams.class);
- map.put("DeploymentCause", DeploymentCause.class);
- map.put("DeploymentCauseImageTrigger", DeploymentCauseImageTrigger.class);
- map.put("DeploymentConfig", DeploymentConfig.class);
- map.put("DeploymentConfigList", DeploymentConfigList.class);
- map.put("DeploymentConfigSpec", DeploymentConfigSpec.class);
- map.put("DeploymentConfigStatus", DeploymentConfigStatus.class);
- map.put("DeploymentDetails", DeploymentDetails.class);
- map.put("DeploymentStrategy", DeploymentStrategy.class);
- map.put("DeploymentTriggerImageChangeParams", DeploymentTriggerImageChangeParams.class);
- map.put("DeploymentTriggerPolicy", DeploymentTriggerPolicy.class);
- map.put("DockerBuildStrategy", DockerBuildStrategy.class);
- map.put("EmptyDirVolumeSource", EmptyDirVolumeSource.class);
- map.put("EndpointAddress", EndpointAddress.class);
- map.put("EndpointPort", EndpointPort.class);
- map.put("EndpointSubset", EndpointSubset.class);
- map.put("Endpoints", Endpoints.class);
- map.put("EndpointsList", EndpointsList.class);
- map.put("EnvVar", EnvVar.class);
- map.put("EnvVarSource", EnvVarSource.class);
- map.put("ExecAction", ExecAction.class);
- map.put("ExecNewPodHook", ExecNewPodHook.class);
- map.put("GCEPersistentDiskVolumeSource", GCEPersistentDiskVolumeSource.class);
- map.put("GitBuildSource", GitBuildSource.class);
- map.put("GitRepoVolumeSource", GitRepoVolumeSource.class);
- map.put("GitSourceRevision", GitSourceRevision.class);
- map.put("GlusterfsVolumeSource", GlusterfsVolumeSource.class);
- map.put("HTTPGetAction", HTTPGetAction.class);
- map.put("Handler", Handler.class);
- map.put("HasMetadata", HasMetadata.class);
- map.put("HostPathVolumeSource", HostPathVolumeSource.class);
- map.put("ISCSIVolumeSource", ISCSIVolumeSource.class);
- map.put("Image", Image.class);
- map.put("ImageChangeTrigger", ImageChangeTrigger.class);
- map.put("ImageList", ImageList.class);
- map.put("ImageStream", ImageStream.class);
- map.put("ImageStreamList", ImageStreamList.class);
- map.put("ImageStreamSpec", ImageStreamSpec.class);
- map.put("ImageStreamStatus", ImageStreamStatus.class);
- map.put("IntOrString", IntOrString.class);
- map.put("KubeSchema", KubeSchema.class);
- map.put("KubernetesList", KubernetesList.class);
- map.put("Lifecycle", Lifecycle.class);
- map.put("LifecycleHook", LifecycleHook.class);
- map.put("ListMeta", ListMeta.class);
- map.put("NFSVolumeSource", NFSVolumeSource.class);
- map.put("NamedAuthInfo", NamedAuthInfo.class);
- map.put("NamedCluster", NamedCluster.class);
- map.put("NamedContext", NamedContext.class);
- map.put("NamedExtension", NamedExtension.class);
- map.put("NamedTagEventList", NamedTagEventList.class);
- map.put("NamedTagReference", NamedTagReference.class);
- map.put("Namespace", Namespace.class);
- map.put("NamespaceList", NamespaceList.class);
- map.put("NamespaceSpec", NamespaceSpec.class);
- map.put("NamespaceStatus", NamespaceStatus.class);
- map.put("Node", Node.class);
- map.put("NodeAddress", NodeAddress.class);
- map.put("NodeCondition", NodeCondition.class);
- map.put("NodeList", NodeList.class);
- map.put("NodeSpec", NodeSpec.class);
- map.put("NodeStatus", NodeStatus.class);
- map.put("NodeSystemInfo", NodeSystemInfo.class);
- map.put("OAuthAccessToken", OAuthAccessToken.class);
- map.put("OAuthAccessTokenList", OAuthAccessTokenList.class);
- map.put("OAuthAuthorizeToken", OAuthAuthorizeToken.class);
- map.put("OAuthAuthorizeTokenList", OAuthAuthorizeTokenList.class);
- map.put("OAuthClient", OAuthClient.class);
- map.put("OAuthClientAuthorization", OAuthClientAuthorization.class);
- map.put("OAuthClientAuthorizationList", OAuthClientAuthorizationList.class);
- map.put("OAuthClientList", OAuthClientList.class);
- map.put("ObjectFieldSelector", ObjectFieldSelector.class);
- map.put("ObjectMeta", ObjectMeta.class);
- map.put("ObjectReference", ObjectReference.class);
- map.put("Parameter", Parameter.class);
- map.put("PersistentVolumeClaimVolumeSource", PersistentVolumeClaimVolumeSource.class);
- map.put("Pod", Pod.class);
- map.put("PodCondition", PodCondition.class);
- map.put("PodList", PodList.class);
- map.put("PodSpec", PodSpec.class);
- map.put("PodStatus", PodStatus.class);
- map.put("PodTemplateSpec", PodTemplateSpec.class);
- map.put("Preferences", Preferences.class);
- map.put("Probe", Probe.class);
- map.put("Quantity", Quantity.class);
- map.put("RecreateDeploymentStrategyParams", RecreateDeploymentStrategyParams.class);
- map.put("ReplicationController", ReplicationController.class);
- map.put("ReplicationControllerList", ReplicationControllerList.class);
- map.put("ReplicationControllerSpec", ReplicationControllerSpec.class);
- map.put("ReplicationControllerStatus", ReplicationControllerStatus.class);
- map.put("ResourceRequirements", ResourceRequirements.class);
- map.put("RollingDeploymentStrategyParams", RollingDeploymentStrategyParams.class);
- map.put("Route", Route.class);
- map.put("RouteList", RouteList.class);
- map.put("SourceBuildStrategy", SourceBuildStrategy.class);
- map.put("RouteSpec", RouteSpec.class);
- map.put("RouteStatus", RouteStatus.class);
- map.put("SELinuxOptions", SELinuxOptions.class);
- map.put("Secret", Secret.class);
- map.put("SecretList", SecretList.class);
- map.put("SecretVolumeSource", SecretVolumeSource.class);
- map.put("SecurityContext", SecurityContext.class);
- map.put("Service", Service.class);
- map.put("ServiceAccount", ServiceAccount.class);
- map.put("ServiceAccountList", ServiceAccountList.class);
- map.put("ServiceList", ServiceList.class);
- map.put("ServicePort", ServicePort.class);
- map.put("ServiceSpec", ServiceSpec.class);
- map.put("ServiceStatus", ServiceStatus.class);
- map.put("SourceBuildStrategy", SourceBuildStrategy.class);
- map.put("SourceControlUser", SourceControlUser.class);
- map.put("SourceRevision", SourceRevision.class);
- map.put("Status", Status.class);
- map.put("StatusCause", StatusCause.class);
- map.put("StatusDetails", StatusDetails.class);
- map.put("StatusError", StatusError.class);
- map.put("TCPSocketAction", TCPSocketAction.class);
- map.put("TLSConfig", TLSConfig.class);
- map.put("TagEvent", TagEvent.class);
- map.put("Template", Template.class);
- map.put("Volume", Volume.class);
- map.put("VolumeMount", VolumeMount.class);
- map.put("WebHookTrigger", WebHookTrigger.class);
- }
-
- public static Map<String,Class<?>> getKindToClassMap() {
- return map;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/Dockerfile
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/Dockerfile b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/Dockerfile
deleted file mode 100644
index 78444b3..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/Dockerfile
+++ /dev/null
@@ -1,5 +0,0 @@
-FROM google/nodejs
-RUN npm i -g raml2html
-ADD . /data
-CMD ["-i", "/data/kubernetes.raml", "-o", "/data/kubernetes.html"]
-ENTRYPOINT ["raml2html"]
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller-list.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller-list.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller-list.json
deleted file mode 100644
index 2977476..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller-list.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "kind": "ReplicationControllerList",
- "apiVersion": "v1beta1",
- "items": [
- {
- "id": "testRun",
- "desiredState": {
- "replicas": 2,
- "replicaSelector": {
- "name": "testRun"
- },
- "podTemplate": {
- "desiredState": {
- "manifest": {
- "version": "v1beta1",
- "image": "dockerfile/nginx",
- "networkPorts": [
- {
- "hostPort": 8080,
- "containerPort": 80
- }
- ]
- }
- },
- "labels": {
- "name": "testRun"
- }
- }
- },
- "labels": {
- "name": "testRun"
- }
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller.json
deleted file mode 100644
index 6697ce1..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/controller.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "kind": "ReplicationController",
- "apiVersion": "v1beta3",
- "metadata": {
- "name": "nginx-controller",
- "labels": {"name": "nginx"}
- },
- "spec": {
- "replicas": 2,
- "selector": {"name": "nginx"},
- "template": {
- "metadata": {
- "labels": {"name": "nginx"}
- },
- "spec": {
- "containers": [{
- "name": "nginx",
- "image": "dockerfile/nginx",
- "ports": [{"containerPort": 80}]
- }]
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/external-service.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/external-service.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/external-service.json
deleted file mode 100644
index 00dfa13..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/external-service.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "id": "example",
- "kind": "Service",
- "apiVersion": "v1beta1",
- "port": 8000,
- "labels": {
- "name": "nginx"
- },
- "selector": {
- "name": "nginx"
- },
- "createExternalLoadBalancer": true
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/list.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/list.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/list.json
deleted file mode 100644
index 3c2566f..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/list.json
+++ /dev/null
@@ -1,98 +0,0 @@
-{
- "kind" : "List",
- "apiVersion" : "v1beta3",
- "items" : [ {
- "kind": "Service",
- "apiVersion": "v1beta3",
- "metadata": {
- "name": "fabric8-console-service",
- "namespace": "default",
- "selfLink": "/api/v1beta1/services/fabric8-console-service?namespace=default",
- "uid": "a2dac9a2-f22a-11e4-b882-fa163ee36154",
- "resourceVersion": "61428",
- "creationTimestamp": "2015-05-04T06:56:06Z",
- "labels": {
- "component": "console",
- "provider": "fabric8"
- }
- },
- "spec": {
- "ports": [
- {
- "name": "",
- "protocol": "TCP",
- "port": 80,
- "targetPort": 9090
- }
- ],
- "selector": {
- "component": "console",
- "provider": "fabric8"
- },
- "portalIP": "172.30.129.192",
- "sessionAffinity": "None"
- },
- "status": {}
- }, {
- "kind": "ReplicationController",
- "apiVersion": "v1beta3",
- "metadata": {
- "name": "fabric8-console-controller",
- "namespace": "default",
- "selfLink": "/api/v1beta1/replicationControllers/fabric8-console-controller?namespace=default",
- "uid": "d4253743-f22a-11e4-b882-fa163ee36154",
- "resourceVersion": "61718",
- "creationTimestamp": "2015-05-04T06:57:28Z",
- "labels": {
- "component": "console",
- "provider": "fabric8"
- }
- },
- "spec": {
- "replicas": 1,
- "selector": {
- "component": "console",
- "provider": "fabric8"
- },
- "template": {
- "metadata": {
- "creationTimestamp": null,
- "labels": {
- "component": "console",
- "provider": "fabric8"
- }
- },
- "spec": {
- "volumes": [],
- "containers": [
- {
- "name": "fabric8-console-container",
- "image": "fabric8/hawtio-kubernetes",
- "ports": [
- {
- "name": "http",
- "containerPort": 9090,
- "protocol": "TCP"
- },
- {
- "name": "jolokia",
- "containerPort": 8778,
- "protocol": "TCP"
- }
- ],
- "resources": {},
- "terminationMessagePath": "/dev/termination-log",
- "imagePullPolicy": "Always",
- "capabilities": {}
- }
- ],
- "restartPolicy": "Always",
- "dnsPolicy": "ClusterFirst"
- }
- }
- },
- "status": {
- "replicas": 1
- }
- }]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list-empty-results.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list-empty-results.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list-empty-results.json
deleted file mode 100644
index 2793f49..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list-empty-results.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "kind": "PodList",
- "selfLink": "/api/v1beta1/pods",
- "resourceVersion": 56138,
- "apiVersion": "v1beta3",
- "items": [
- {
- "kind": "Pod",
- "apiVersion": "v1beta3",
- "metadata": {
- },
- "status": {
- "phase": "Running",
- "hostIP": "127.0.0.1",
- "podIP": "172.17.0.180"
- }
- }
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list.json
deleted file mode 100644
index 261a052..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod-list.json
+++ /dev/null
@@ -1,93 +0,0 @@
-{
- "kind": "List",
- "apiVersion": "v1beta3",
- "items": [
- {
- "kind": "Pod",
- "apiVersion": "v1beta3",
- "metadata": {
- "name": "my-pod-1",
- "generateName": "nexus-controller-",
- "namespace": "default",
- "selfLink": "/api/v1beta1/pods/nexus-controller-qq4p9?namespace=default",
- "uid": "2cf18435-f310-11e4-b882-fa163ee36154",
- "resourceVersion": "89638",
- "creationTimestamp": "2015-05-05T10:19:12Z",
- "labels": {
- "component": "nexus",
- "provider": "fabric8"
- }
- },
- "spec": {
- "volumes": [
- {
- "name": "nexus-storage",
- "hostPath": null,
- "emptyDir": {
- "medium": ""
- },
- "gcePersistentDisk": null,
- "gitRepo": null,
- "secret": null,
- "nfs": null,
- "iscsi": null,
- "glusterfs": null
- }
- ],
- "containers": [
- {
- "name": "nginx",
- "image": "dockerfile/nginx",
- "ports": [
- {
- "name": "http",
- "containerPort": 8081,
- "protocol": "TCP"
- }
- ],
- "resources": {},
- "volumeMounts": [
- {
- "name": "nexus-storage",
- "mountPath": "/sonatype-work/storage"
- }
- ],
- "terminationMessagePath": "/dev/termination-log",
- "imagePullPolicy": "IfNotPresent",
- "capabilities": {}
- }
- ],
- "restartPolicy": "Always",
- "dnsPolicy": "ClusterFirst",
- "host": "jimmi-docker-2.osop.rhcloud.com"
- },
- "status": {
- "phase": "Running",
- "Condition": [
- {
- "type": "Ready",
- "status": "True"
- }
- ],
- "hostIP": "fe80::f816:3eff:fee3:6154",
- "podIP": "172.17.0.180",
- "containerStatuses": [
- {
- "name": "nexus-container",
- "state": {
- "running": {
- "startedAt": "2015-05-05T10:19:51Z"
- }
- },
- "lastState": {},
- "ready": true,
- "restartCount": 0,
- "image": "fabric8/nexus",
- "imageID": "docker://0723d5f32ce06d8a72b6c2c3b3df84e4f8369e4ca6b836e312899118f2fe6575",
- "containerID": "docker://65dce1c091f9fac1679ed0c555df58b2f60a17cc5f85922358b28a1fd6b3f1f4"
- }
- ]
- }
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod.json
deleted file mode 100644
index 72d2f40..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/pod.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "kind": "Pod",
- "apiVersion": "v1beta3",
- "metadata": {
- "name": "php",
- "labels": {
- "name": "foo"
- }
- },
- "spec": {
- "containers": [
- {
- "name": "nginx",
- "image": "dockerfile/nginx",
- "ports": [
- {
- "hostPort": 8080,
- "containerPort": 80,
- "protocol": "TCP"
- }
- ],
- "livenessProbe": {
- "httpGet": {
- "path": "/index.html",
- "port": 8080
- },
- "initialDelaySeconds": 30,
- "timeoutSeconds": 1
- },
- "imagePullPolicy": "IfNotPresent"
- }
- ]
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service-list.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service-list.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service-list.json
deleted file mode 100644
index 9f95f67..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service-list.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "kind": "ServiceList",
- "apiVersion": "v1beta1",
- "items": [
- {
- "id": "example1",
- "port": 8000,
- "labels": {
- "name": "nginx"
- },
- "selector": {
- "name": "nginx"
- }
- },
- {
- "id": "example2",
- "port": 8080,
- "labels": {
- "env": "prod",
- "name": "jetty"
- },
- "selector": {
- "env": "prod",
- "name": "jetty"
- }
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service.json
deleted file mode 100644
index 42388e7..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/service.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "kind": "Service",
- "apiVersion": "v1beta3",
- "metadata": {
- "name": "fabric8-console-service",
- "namespace": "default",
- "selfLink": "/api/v1beta1/services/fabric8-console-service?namespace=default",
- "uid": "a2dac9a2-f22a-11e4-b882-fa163ee36154",
- "resourceVersion": "61428",
- "creationTimestamp": "2015-05-04T06:56:06Z",
- "labels": {
- "component": "console",
- "provider": "fabric8"
- }
- },
- "spec": {
- "ports": [
- {
- "name": "",
- "protocol": "TCP",
- "port": 80,
- "targetPort": 9090
- }
- ],
- "selector": {
- "component": "console",
- "provider": "fabric8"
- },
- "portalIP": "172.30.129.192",
- "sessionAffinity": "None"
- },
- "status": {}
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/template.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/template.json b/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/template.json
deleted file mode 100644
index 5e40e67..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/kubernetes/api/examples/template.json
+++ /dev/null
@@ -1,146 +0,0 @@
-{
- "kind": "Template",
- "apiVersion": "v1beta3",
- "metadata": {
- "name": "jenkins",
- "namespace": "default",
- "selfLink": "/osapi/v1beta1/templates/jenkins?namespace=default",
- "uid": "420dc894-f24f-11e4-b882-fa163ee36154",
- "resourceVersion": "66310",
- "creationTimestamp": "2015-05-04T11:18:15Z"
- },
- "objects": [
- {
- "kind": "Service",
- "apiVersion": "v1beta3",
- "metadata": {
- "name": "jenkins",
- "creationTimestamp": null,
- "labels": {
- "component": "jenkins",
- "provider": "fabric8"
- }
- },
- "spec": {
- "ports": [
- {
- "name": "",
- "protocol": "TCP",
- "port": 80,
- "targetPort": 8080
- }
- ],
- "selector": {
- "component": "jenkins",
- "provider": "fabric8"
- },
- "portalIP": "",
- "sessionAffinity": "None"
- },
- "status": {}
- },
- {
- "kind": "ReplicationController",
- "apiVersion": "v1beta3",
- "metadata": {
- "name": "jenkins-controller",
- "creationTimestamp": null,
- "labels": {
- "component": "jenkins",
- "provider": "fabric8"
- }
- },
- "spec": {
- "replicas": 1,
- "selector": {
- "component": "jenkins",
- "provider": "fabric8"
- },
- "template": {
- "metadata": {
- "creationTimestamp": null,
- "labels": {
- "component": "jenkins",
- "provider": "fabric8"
- }
- },
- "spec": {
- "volumes": [
- {
- "name": "docker-socket",
- "hostPath": {
- "path": "/var/run/docker.sock"
- },
- "emptyDir": null,
- "gcePersistentDisk": null,
- "gitRepo": null,
- "secret": null,
- "nfs": null,
- "iscsi": null,
- "glusterfs": null
- },
- {
- "name": "jenkins-workspace",
- "hostPath": null,
- "emptyDir": {
- "medium": ""
- },
- "gcePersistentDisk": null,
- "gitRepo": null,
- "secret": null,
- "nfs": null,
- "iscsi": null,
- "glusterfs": null
- }
- ],
- "containers": [
- {
- "name": "jenkins-container",
- "image": "fabric8/jenkins",
- "ports": [
- {
- "name": "http",
- "containerPort": 8080,
- "protocol": "TCP"
- }
- ],
- "env": [
- {
- "name": "SEED_GIT_URL",
- "value": "${SEED_GIT_URL}"
- }
- ],
- "resources": {},
- "volumeMounts": [
- {
- "name": "jenkins-workspace",
- "mountPath": "/var/jenkins_home/workspace"
- },
- {
- "name": "docker-socket",
- "mountPath": "/var/run/docker.sock"
- }
- ],
- "terminationMessagePath": "/dev/termination-log",
- "imagePullPolicy": "IfNotPresent",
- "capabilities": {}
- }
- ],
- "restartPolicy": "Always",
- "dnsPolicy": "ClusterFirst"
- }
- }
- },
- "status": {
- "replicas": 0
- }
- }
- ],
- "parameters": [
- {
- "name": "SEED_GIT_URL",
- "description": "The git URL of the seed build used to generate builds",
- "value": "https://github.com/fabric8io/jenkins-pipeline-dsl.git"
- }
- ]
-}
[12/12] stratos git commit: Updating kubernetes service port to node
port to be used by the access URLs
Posted by ga...@apache.org.
Updating kubernetes service port to node port to be used by the access URLs
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/573b7038
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/573b7038
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/573b7038
Branch: refs/heads/tenant-isolation
Commit: 573b703801d3127c4afe8e9471140e29db1067d7
Parents: ff1b1a6
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sun Jul 26 14:52:19 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Thu Aug 27 16:43:36 2015 +0530
----------------------------------------------------------------------
.../stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/573b7038/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 4dcc472..23c5514 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
@@ -546,7 +546,7 @@ public class KubernetesIaas extends Iaas {
String[] minionPublicIPArray = minionPublicIPList.toArray(new String[minionPublicIPList.size()]);
kubernetesService.setPublicIPs(minionPublicIPArray);
kubernetesService.setProtocol(clusterPortMapping.getProtocol());
- kubernetesService.setPort(service.getSpec().getPorts().get(0).getPort());
+ kubernetesService.setPort(service.getSpec().getPorts().get(0).getNodePort());
kubernetesService.setContainerPort(containerPort);
kubernetesServices.add(kubernetesService);
[03/12] stratos git commit: Upgrading fabric8 kubernetes api version
to 2.2.16 and removing forked code
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TriggerBuild.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TriggerBuild.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TriggerBuild.java
deleted file mode 100644
index abb0c89..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TriggerBuild.java
+++ /dev/null
@@ -1,45 +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;
-
-/**
- * Triggers a build using the Java API
- */
-public class TriggerBuild {
- public static void main(String... args) {
- if (args.length < 1) {
- System.out.println("Usage: buildConfigName namespace secret type");
- return;
- }
- String name = args[0];
- String namespace = "default";
- if (args.length > 1) {
- namespace = args[1];
- }
-
- KubernetesClient client = new KubernetesClient();
-
- System.out.println("Connecting to kubernetes on: " + client.getAddress());
-
- try {
- String uuid = client.triggerBuildAndGetUuid(name, namespace);
- System.out.println("Build triggered: got UUID: " + uuid);
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- e.printStackTrace();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/UsingBadAddressTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/UsingBadAddressTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/UsingBadAddressTest.java
deleted file mode 100644
index 40b650e..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/UsingBadAddressTest.java
+++ /dev/null
@@ -1,47 +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;
-
-import io.fabric8.utils.Asserts;
-import io.fabric8.utils.Block;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- */
-public class UsingBadAddressTest {
- protected String badAddress = "cheese://does.notexist.redhat.com:666";
-
- @Test
- public void testUseBadAddressFails() throws Exception {
- Asserts.assertException(new Block() {
- @Override
- public void invoke() throws Exception {
- new KubernetesFactory(badAddress);
- }
- });
- }
-
- @Test
- public void testUseBadAddressWithoutValidation() throws Exception {
- KubernetesFactory factory = new KubernetesFactory(badAddress, false);
- assertThat(factory).isNotNull();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewEndpoints.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewEndpoints.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewEndpoints.java
deleted file mode 100644
index 445de7f..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewEndpoints.java
+++ /dev/null
@@ -1,88 +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.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static io.fabric8.utils.Lists.notNullList;
-
-/**
- * Views the endpoints for all services or the given service id and namespace
- */
-public class ViewEndpoints {
- public static void main(String... args) {
- System.out.println("Usage: [serviceId] [namespace]");
- KubernetesClient client = new KubernetesClient();
-
- System.out.println("Connecting to kubernetes on: " + client.getAddress());
-
- try {
- String service = null;
- String namespace = null;
- if (args.length > 0) {
- service = args[0];
- }
- if (args.length > 1) {
- namespace = args[1];
- }
- listEndpoints(client, service, namespace);
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- e.printStackTrace();
- }
- }
-
- protected static void listEndpoints(KubernetesClient client, String service, String namespace) throws Exception {
- if (service != null) {
- Endpoints endpoints = client.endpointsForService(service, namespace);
- display(endpoints);
-
- } else {
- EndpointsList endpointsList = client.getEndpoints();
- if (endpointsList != null) {
- List<Endpoints> items = notNullList(endpointsList.getItems());
- for (Endpoints item : items) {
- display(item);
- }
- }
- }
- }
-
- protected static void display(Endpoints endpoints) {
- if (endpoints != null) {
- String name = endpoints.getMetadata().getName();
- String namespace = endpoints.getMetadata().getNamespace();
- List<String> urls = new ArrayList<>();
- List<EndpointSubset> endpointsSubsets = endpoints.getSubsets();
-
- for (EndpointSubset endpointSubset : endpointsSubsets) {
- for (EndpointAddress endpointAddress : endpointSubset.getAddresses()) {
- for (EndpointPort endpointPort : endpointSubset.getPorts()) {
- urls.add(endpointAddress.getIP() + ":" + endpointPort.getPort());
- }
- }
- }
-
- System.out.println("Service: " + name + " namespace: " + namespace + " urls: " + urls);
- } else {
- System.out.println("null endpoints");
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewNodes.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewNodes.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewNodes.java
deleted file mode 100644
index da577ce..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewNodes.java
+++ /dev/null
@@ -1,61 +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.Node;
-import io.fabric8.kubernetes.api.model.NodeList;
-
-import java.util.List;
-
-import static io.fabric8.utils.Lists.notNullList;
-
-/**
- * Views the minions
- */
-public class ViewNodes {
- public static void main(String... args) {
- KubernetesClient client = new KubernetesClient();
-
- System.out.println("Connecting to kubernetes on: " + client.getAddress());
-
- try {
- listMinions(client);
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- e.printStackTrace();
- }
- }
-
- protected static void listMinions(KubernetesClient client) throws Exception {
- NodeList nodeList = client.getNodes();
- if (nodeList != null) {
- List<Node> items = notNullList(nodeList.getItems());
- for (Node item : items) {
- display(item);
- }
- }
- }
-
- protected static void display(Node node) {
- if (node != null) {
- String id = node.getMetadata().getName();
- System.out.println("Node: " + id + " resources: " + node.getStatus().getCapacity());
- } else {
- System.out.println("null node");
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewServiceIPs.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewServiceIPs.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewServiceIPs.java
deleted file mode 100644
index 0ea2bb6..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ViewServiceIPs.java
+++ /dev/null
@@ -1,45 +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 java.util.Set;
-
-/**
- * Views the endpoints for all services or the given service id and namespace
- */
-public class ViewServiceIPs {
- public static void main(String... args) {
- System.out.println("Usage: [serviceName]");
-
- try {
- String service = null;
- if (args.length > 0) {
- service = args[0];
- }
-
- Set<String> addresses = KubernetesHelper.lookupServiceInDns(service);
- if (addresses != null) {
- System.out.println("addresses: " + addresses);
- } else {
- System.out.println("null addresses");
- }
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- e.printStackTrace();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchBuilds.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchBuilds.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchBuilds.java
deleted file mode 100644
index 40fd5de..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchBuilds.java
+++ /dev/null
@@ -1,52 +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.builds.BuildFinishedEvent;
-import io.fabric8.kubernetes.api.builds.BuildListener;
-import io.fabric8.kubernetes.api.builds.BuildWatcher;
-import io.fabric8.kubernetes.api.builds.Links;
-
-/**
- * Triggers a build using the Java API
- */
-public class WatchBuilds {
- public static void main(String... args) {
- String namespace = null;
- if (args.length > 0) {
- namespace = args[0];
- }
-
- String consoleLink = Links.getFabric8ConsoleLink();
-
- KubernetesClient client = new KubernetesClient();
- BuildListener buildListener = new BuildListener() {
- @Override
- public void onBuildFinished(BuildFinishedEvent event) {
- System.out.println("Build: " + event.getUid()
- + " for config: " + event.getConfigName()
- + " finished. Status: " + event.getStatus()
- + " link: " + event.getBuildLink());
- }
- };
- BuildWatcher watcher = new BuildWatcher(client, buildListener, namespace, consoleLink);
-
- long pollTime = 3000;
- watcher.schedule(pollTime);
-
- watcher.join();
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchBuildsExample.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchBuildsExample.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchBuildsExample.java
deleted file mode 100644
index 2105ba2..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchBuildsExample.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.openshift.api.model.Build;
-import org.eclipse.jetty.websocket.client.WebSocketClient;
-
-public class WatchBuildsExample {
-
- public static void main(String... args) throws Exception {
- KubernetesClient kube = new KubernetesClient();
- System.out.println("Connecting to kubernetes on: " + kube.getAddress());
- WebSocketClient client = kube.watchBuilds(new ExampleWatcher());
- Thread.sleep(10000l);
- client.stop();
- }
-
- static class ExampleWatcher extends AbstractWatcher<Build> {
- @Override
- public void eventReceived(Action action, Build object) {
- System.out.println(action + ": " + object);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchPodsExample.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchPodsExample.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchPodsExample.java
deleted file mode 100644
index ded366d..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchPodsExample.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.Pod;
-import org.eclipse.jetty.websocket.client.WebSocketClient;
-
-public class WatchPodsExample {
-
- public static void main(String... args) throws Exception {
- KubernetesClient kube = new KubernetesClient();
- System.out.println("Connecting to kubernetes on: " + kube.getAddress());
- WebSocketClient client = kube.watchPods("default", null, new ExampleWatcher());
- Thread.sleep(10000l);
- client.stop();
- }
-
- static class ExampleWatcher extends AbstractWatcher<Pod> {
- @Override
- public void eventReceived(Watcher.Action action, Pod object) {
- System.out.println(action + ": " + object);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchServicesExample.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchServicesExample.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchServicesExample.java
deleted file mode 100644
index 13fb9a1..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/WatchServicesExample.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.Service;
-import org.eclipse.jetty.websocket.client.WebSocketClient;
-
-public class WatchServicesExample {
-
- public static void main(String... args) throws Exception {
- KubernetesClient kube = new KubernetesClient();
- System.out.println("Connecting to kubernetes on: " + kube.getAddress());
- WebSocketClient client = kube.watchServices("jimmi", null, new ExampleWatcher());
- Thread.sleep(10000l);
- client.stop();
- }
-
- static class ExampleWatcher extends AbstractWatcher<Service> {
- @Override
- public void eventReceived(Action action, Service object) {
- System.out.println(action + ": " + object);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/resources/config.yml
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/resources/config.yml b/dependencies/fabric8/kubernetes-api/src/test/resources/config.yml
deleted file mode 100644
index dd471d0..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/resources/config.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-apiVersion: v1
-clusters:
-- cluster:
- insecure-skip-tls-verify: true
- server: https://localhost:8443
- name: localhost-8443-0
-- cluster:
- insecure-skip-tls-verify: true
- server: https://localhost:8443
- name: localhost-8443-1
-- cluster:
- insecure-skip-tls-verify: true
- server: https://localhost:8443
- name: 172-28-128-4:8443
-- cluster:
- insecure-skip-tls-verify: true
- server: https://localhost:8443
- name: localhost:8443
-contexts:
-- context:
- cluster: localhost:8443
- namespace: claus
- user: admin/localhost:8443
- name: claus/localhost:8443/admin
-- context:
- cluster: 172-28-128-4:8443
- namespace: jimmi-does-rock
- user: admin/localhost:8443
- name: default/localhost:8443/admin
-- context:
- cluster: localhost:8443
- namespace: james
- user: admin/localhost:8443
- name: james/localhost:8443/admin
-- context:
- cluster: localhost:8443
- namespace: roland
- user: admin/localhost:8443
- name: roland/localhost:8443/admin
-current-context: default/localhost:8443/admin
-kind: Config
-preferences: {}
-users:
-- name: admin/somewhere:8443
- user:
- token: DEF
-- name: admin/somewhere-else:8443
- user:
- token: ABC
-- name: admin/localhost:8443
- user:
- token: ExpectedToken
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/resources/errorexample.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/resources/errorexample.json b/dependencies/fabric8/kubernetes-api/src/test/resources/errorexample.json
deleted file mode 100644
index 3338c5d..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/resources/errorexample.json
+++ /dev/null
@@ -1,77 +0,0 @@
-{
- "id": "nova-compute-controller",
- "apiVersion": "v1beta1",
- "desiredState": {
- "replicas": 6,
- "podTemplate": {
- "desiredState": {
- "manifest": {
- "id": "nova-compute-controller",
- "containers": [
- {
- "ports": [
- {
- "hostPort": 12000,
- "containerPort": 12000
- }
- ],
- "name": "nova-compute",
- "image": "kollaglue/fedora-rdo-nova-compute",
- "env": [
- {
- "name": "DB_ROOT_PASSWORD",
- "value": "password"
- },
- {
- "name": "NOVA_DB_PASSWORD",
- "value": "novadbpassword"
- },
- {
- "name": "KEYSTONE_ADMIN_TOKEN",
- "value": "ADMINTOKEN"
- }
- ],
- "privileged": true
- },
- {
- "ports": [
- {
- "hostPort": 12001,
- "containerPort": 12001
- }
- ],
- "name": "nova-network",
- "image": "kollaglue/fedora-rdo-nova-network",
- "env": [
- {
- "name": "DB_ROOT_PASSWORD",
- "value": "password"
- },
- {
- "name": "NOVA_DB_PASSWORD",
- "value": "novadbpassword"
- },
- {
- "name": "KEYSTONE_ADMIN_TOKEN",
- "value": "ADMINTOKEN"
- }
- ],
- "privileged": true
- }
- ],
- "version": "v1beta1"
- }
- },
- "labels": {
- "name": "nova-compute"
- }
- },
- "replicaSelector": {
- "name": "nova-compute"
- }
- },
- "labels": {
- "name": "nova-compute"
- },
- "kind": "ReplicationController"
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/resources/fmq-service.json
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/resources/fmq-service.json b/dependencies/fabric8/kubernetes-api/src/test/resources/fmq-service.json
deleted file mode 100644
index 4b704ba..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/resources/fmq-service.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "kind": "Service",
- "apiVersion": "v1beta3",
- "metadata": {
- "name": "fabric8-mq-service"
- },
- "spec": {
- "ports": [
- {
- "port": 6163,
- "targetPort": 6162
- }
- ],
- "selector": {
- "container": "java",
- "name": "fabric8MQ",
- "group": "fabric8MQ"
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/resources/glance-api-service.yaml
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/resources/glance-api-service.yaml b/dependencies/fabric8/kubernetes-api/src/test/resources/glance-api-service.yaml
deleted file mode 100644
index 42e8c5c..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/resources/glance-api-service.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-apiVersion: v1beta1
-containerPort: 9292
-id: glance-api
-kind: Service
-port: 9292
-selector:
- name: glance
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/resources/log4j.properties b/dependencies/fabric8/kubernetes-api/src/test/resources/log4j.properties
deleted file mode 100644
index 50114a0..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,25 +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.
-#
-
-log4j.rootLogger=INFO, stdout
-
-#The logging properties used during tests..
-# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%-5p %-30.30c{1} - %m%n
-log4j.appender.stdout.threshold=DEBUG
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/README.md
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/README.md b/dependencies/fabric8/kubernetes-model/README.md
deleted file mode 100644
index 6019aa8..0000000
--- a/dependencies/fabric8/kubernetes-model/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-## Fabric8 Kubernetes Client API Model
-
-Fabric8 Kubernetes Client API Model 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)
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/pom.xml
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/pom.xml b/dependencies/fabric8/kubernetes-model/pom.xml
deleted file mode 100644
index f8edfa5..0000000
--- a/dependencies/fabric8/kubernetes-model/pom.xml
+++ /dev/null
@@ -1,176 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.stratos</groupId>
- <artifactId>stratos-dependencies-fabric8</artifactId>
- <version>4.1.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>kubernetes-model</artifactId>
- <version>2.1.11-stratosv1</version>
- <packaging>bundle</packaging>
-
- <name>Fabric8 :: Kubernetes Generated Model</name>
-
- <properties>
- <clone-kube>true</clone-kube>
- <kube.dir>${basedir}/src/main/resources</kube.dir>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>io.sundr</groupId>
- <artifactId>sundr-annotations</artifactId>
- <version>0.0.16</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-jaxb-annotations</artifactId>
- <version>2.4.0</version>
- </dependency>
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <version>1.1.0.Final</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.6</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.jsonschema2pojo</groupId>
- <artifactId>jsonschema2pojo-maven-plugin</artifactId>
- <version>0.4.10</version>
- <configuration>
- <sourceDirectory>${kube.dir}/schema</sourceDirectory>
- <targetPackage>io.fabric8.kubernetes.api.model</targetPackage>
- <includeConstructors>true</includeConstructors>
- <includeJsr303Annotations>true</includeJsr303Annotations>
- <outputDirectory>${basedir}/target/generated-sources</outputDirectory>
- <customAnnotator>io.fabric8.kubernetes.annotator.KubernetesTypeAnnotator</customAnnotator>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>io.fabric8.schemagenerator</groupId>
- <artifactId>kubernetes-annotator</artifactId>
- <version>0.0.45</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <configuration>
- <target>
- <echo>removing the duplicate generated calss</echo>
- <delete file="${basedir}/target/generated-sources/io/fabric8/kubernetes/api/model/util/IntOrString.java" verbose="true" />
- <delete file="${basedir}/target/generated-sources/io/fabric8/kubernetes/api/model/resource/Quantity.java" verbose="true" />
- <delete file="${basedir}/target/generated-sources/io/fabric8/openshift/api/model/template/Template.java" verbose="true" />
- <delete file="${basedir}/target/generated-sources/io/fabric8/kubernetes/api/model/HasMetadata.java" verbose="true" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <version>2.3.7</version>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
- <Export-Package>
- io.fabric8.kubernetes.api.model
- </Export-Package>
- <Import-Package>
- org.osgi.framework,
- *;resolution:=optional
- </Import-Package>
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.9.1</version>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <phase>package</phase>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <configuration>
- <artifacts>
- <artifact>
- <file>${build.outputDirectory}/schema/kube-schema.json</file>
- <type>json</type>
- <classifier>schema</classifier>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <version>2.5</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-gpg-plugin</artifactId>
- <version>1.5</version>
- <configuration>
- <passphrase>${gpg.passphrase}</passphrase>
- <useAgent>true</useAgent>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/KubernetesBaseConfig.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/KubernetesBaseConfig.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/KubernetesBaseConfig.java
deleted file mode 100644
index b3ad7e7..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/KubernetesBaseConfig.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package io.fabric8.config;
-
-import io.sundr.builder.annotations.ExternalBuildables;
-
-@ExternalBuildables(editableEnabled=false, validationEnabled = true, builderPackage = "io.fabric8.common", value = {
- "io.fabric8.kubernetes.api.model.base.ListMeta",
- "io.fabric8.kubernetes.api.model.base.ObjectMeta",
- "io.fabric8.kubernetes.api.model.base.ObjectReference",
- "io.fabric8.kubernetes.api.model.base.Status",
- "io.fabric8.kubernetes.api.model.base.StatusCause",
- "io.fabric8.kubernetes.api.model.base.StatusDetails"
-})
-public class KubernetesBaseConfig {
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/KubernetesConfig.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/KubernetesConfig.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/KubernetesConfig.java
deleted file mode 100644
index 9422353..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/KubernetesConfig.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package io.fabric8.config;
-
-import io.sundr.builder.annotations.ExternalBuildables;
-
-@ExternalBuildables(editableEnabled=false, validationEnabled = true, builderPackage = "io.fabric8.common", value = {
- "io.fabric8.kubernetes.api.model.BaseKubernetesList",
- "io.fabric8.kubernetes.api.model.KubernetesList",
-
- "io.fabric8.kubernetes.api.model.Capabilities",
- "io.fabric8.kubernetes.api.model.Container",
- "io.fabric8.kubernetes.api.model.ContainerPort",
- "io.fabric8.kubernetes.api.model.ContainerState",
- "io.fabric8.kubernetes.api.model.ContainerStateRunning",
- "io.fabric8.kubernetes.api.model.ContainerStateTerminated",
- "io.fabric8.kubernetes.api.model.ContainerStateWaiting",
- "io.fabric8.kubernetes.api.model.ContainerStatus",
- "io.fabric8.kubernetes.api.model.EmptyDirVolumeSource",
- "io.fabric8.kubernetes.api.model.EndpointAddress",
- "io.fabric8.kubernetes.api.model.EndpointPort",
- "io.fabric8.kubernetes.api.model.EndpointSubset",
- "io.fabric8.kubernetes.api.model.Endpoints",
- "io.fabric8.kubernetes.api.model.EndpointsList",
- "io.fabric8.kubernetes.api.model.EnvVar",
- "io.fabric8.kubernetes.api.model.EnvVarSource",
- "io.fabric8.kubernetes.api.model.ExecAction",
- "io.fabric8.kubernetes.api.model.GCEPersistentDiskVolumeSource",
- "io.fabric8.kubernetes.api.model.GitRepoVolumeSource",
- "io.fabric8.kubernetes.api.model.GlusterfsVolumeSource",
- "io.fabric8.kubernetes.api.model.HTTPGetAction",
- "io.fabric8.kubernetes.api.model.Handler",
- "io.fabric8.kubernetes.api.model.HostPathVolumeSource",
- "io.fabric8.kubernetes.api.model.ISCSIVolumeSource",
- "io.fabric8.kubernetes.api.model.KubeSchema",
- "io.fabric8.kubernetes.api.model.Lifecycle",
- "io.fabric8.kubernetes.api.model.ListMeta",
- "io.fabric8.kubernetes.api.model.NFSVolumeSource",
- "io.fabric8.kubernetes.api.model.Namespace",
- "io.fabric8.kubernetes.api.model.NamespaceList",
- "io.fabric8.kubernetes.api.model.NamespaceSpec",
- "io.fabric8.kubernetes.api.model.NamespaceStatus",
- "io.fabric8.kubernetes.api.model.Node",
- "io.fabric8.kubernetes.api.model.NodeAddress",
- "io.fabric8.kubernetes.api.model.NodeCondition",
- "io.fabric8.kubernetes.api.model.NodeList",
- "io.fabric8.kubernetes.api.model.NodeSpec",
- "io.fabric8.kubernetes.api.model.NodeStatus",
- "io.fabric8.kubernetes.api.model.NodeSystemInfo",
- "io.fabric8.kubernetes.api.model.ObjectFieldSelector",
- "io.fabric8.kubernetes.api.model.ObjectMeta",
- "io.fabric8.kubernetes.api.model.ObjectReference",
- "io.fabric8.kubernetes.api.model.Pod",
- "io.fabric8.kubernetes.api.model.PodCondition",
- "io.fabric8.kubernetes.api.model.PodList",
- "io.fabric8.kubernetes.api.model.PodSpec",
- "io.fabric8.kubernetes.api.model.PodStatus",
- "io.fabric8.kubernetes.api.model.PodTemplateSpec",
- "io.fabric8.kubernetes.api.model.Probe",
- "io.fabric8.kubernetes.api.model.ReplicationController",
- "io.fabric8.kubernetes.api.model.ReplicationControllerList",
- "io.fabric8.kubernetes.api.model.ReplicationControllerSpec",
- "io.fabric8.kubernetes.api.model.ReplicationControllerStatus",
- "io.fabric8.kubernetes.api.model.ResourceRequirements",
- "io.fabric8.kubernetes.api.model.Secret",
- "io.fabric8.kubernetes.api.model.SecretList",
- "io.fabric8.kubernetes.api.model.SecretVolumeSource",
- "io.fabric8.kubernetes.api.model.Service",
- "io.fabric8.kubernetes.api.model.ServiceAccount",
- "io.fabric8.kubernetes.api.model.ServiceAccountList",
- "io.fabric8.kubernetes.api.model.ServiceList",
- "io.fabric8.kubernetes.api.model.ServicePort",
- "io.fabric8.kubernetes.api.model.ServiceSpec",
- "io.fabric8.kubernetes.api.model.ServiceStatus",
- "io.fabric8.kubernetes.api.model.TCPSocketAction",
- "io.fabric8.kubernetes.api.model.Volume",
- "io.fabric8.kubernetes.api.model.VolumeMount",
-
- "io.fabric8.kubernetes.api.model.util.IntOrString",
- "io.fabric8.kubernetes.api.model.resource.Quantity"
-})
-public class KubernetesConfig {
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/OpenshiftConfig.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/OpenshiftConfig.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/OpenshiftConfig.java
deleted file mode 100644
index 8a48f81..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/config/OpenshiftConfig.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package io.fabric8.config;
-
-import io.sundr.builder.annotations.ExternalBuildables;
-
-@ExternalBuildables(editableEnabled=false, validationEnabled = true, builderPackage = "io.fabric8.common", value = {
- "io.fabric8.openshift.api.model.Build",
- "io.fabric8.openshift.api.model.BuildConfig",
- "io.fabric8.openshift.api.model.BuildConfigList",
- "io.fabric8.openshift.api.model.BuildConfigSpec",
- "io.fabric8.openshift.api.model.BuildConfigStatus",
- "io.fabric8.openshift.api.model.BuildList",
- "io.fabric8.openshift.api.model.BuildOutput",
- "io.fabric8.openshift.api.model.BuildSource",
- "io.fabric8.openshift.api.model.BuildSpec",
- "io.fabric8.openshift.api.model.BuildStatus",
- "io.fabric8.openshift.api.model.BuildStrategy",
- "io.fabric8.openshift.api.model.BuildTriggerPolicy",
- "io.fabric8.openshift.api.model.CustomBuildStrategy",
- "io.fabric8.openshift.api.model.CustomDeploymentStrategyParams",
- "io.fabric8.openshift.api.model.DeploymentCause",
- "io.fabric8.openshift.api.model.DeploymentCauseImageTrigger",
- "io.fabric8.openshift.api.model.DeploymentConfig",
- "io.fabric8.openshift.api.model.DeploymentConfigList",
- "io.fabric8.openshift.api.model.DeploymentConfigSpec",
- "io.fabric8.openshift.api.model.DeploymentConfigStatus",
- "io.fabric8.openshift.api.model.DeploymentDetails",
- "io.fabric8.openshift.api.model.DeploymentStrategy",
- "io.fabric8.openshift.api.model.DeploymentTriggerImageChangeParams",
- "io.fabric8.openshift.api.model.DeploymentTriggerPolicy",
- "io.fabric8.openshift.api.model.DockerBuildStrategy",
- "io.fabric8.openshift.api.model.ExecNewPodHook",
- "io.fabric8.openshift.api.model.GitBuildSource",
- "io.fabric8.openshift.api.model.GitSourceRevision",
- "io.fabric8.openshift.api.model.Image",
- "io.fabric8.openshift.api.model.ImageChangeTrigger",
- "io.fabric8.openshift.api.model.ImageList",
- "io.fabric8.openshift.api.model.ImageStream",
- "io.fabric8.openshift.api.model.ImageStreamList",
- "io.fabric8.openshift.api.model.ImageStreamSpec",
- "io.fabric8.openshift.api.model.ImageStreamStatus",
- "io.fabric8.openshift.api.model.LifecycleHook",
- "io.fabric8.openshift.api.model.NamedTagEventList",
- "io.fabric8.openshift.api.model.NamedTagReference",
- "io.fabric8.openshift.api.model.OAuthAccessToken",
- "io.fabric8.openshift.api.model.OAuthAccessTokenList",
- "io.fabric8.openshift.api.model.OAuthAuthorizeToken",
- "io.fabric8.openshift.api.model.OAuthAuthorizeTokenList",
- "io.fabric8.openshift.api.model.OAuthClient",
- "io.fabric8.openshift.api.model.OAuthClientAuthorization",
- "io.fabric8.openshift.api.model.OAuthClientAuthorizationList",
- "io.fabric8.openshift.api.model.OAuthClientList",
- "io.fabric8.openshift.api.model.RecreateDeploymentStrategyParams",
- "io.fabric8.openshift.api.model.Route",
- "io.fabric8.openshift.api.model.RouteList",
- "io.fabric8.openshift.api.model.RouteSpec",
- "io.fabric8.openshift.api.model.RouteStatus",
- "io.fabric8.openshift.api.model.SourceBuildStrategy",
- "io.fabric8.openshift.api.model.SourceControlUser",
- "io.fabric8.openshift.api.model.SourceRevision",
- "io.fabric8.openshift.api.model.TLSConfig",
- "io.fabric8.openshift.api.model.TagEvent",
- "io.fabric8.openshift.api.model.WebHookTrigger",
- "io.fabric8.openshift.api.model.template.Template",
- "io.fabric8.openshift.api.model.template.Parameter"
-})
-public class OpenshiftConfig {
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/HasMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/HasMetadata.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/HasMetadata.java
deleted file mode 100644
index 689791c..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/HasMetadata.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package io.fabric8.kubernetes.api.model;
-
-public interface HasMetadata extends KubernetesResource {
-
- ObjectMeta getMetadata();
- void setMetadata(ObjectMeta metadata);
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesKind.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesKind.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesKind.java
deleted file mode 100644
index bc051bf..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesKind.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package io.fabric8.kubernetes.api.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public enum KubernetesKind {
-
- List(KubernetesList.class),
- ServiceAccount(ServiceAccount.class),
- ServiceAccountList(ServiceAccountList.class),
- Service(Service.class),
- ServiceList(ServiceList.class),
- Pod(Pod.class),
- PodList(PodList.class),
- ReplicationController(ReplicationController.class),
- ReplicationControllerList(ReplicationControllerList.class),
- Namespace(Namespace.class),
- NamespaceList(NamespaceList.class),
- Secret(Secret.class),
- SecretList(SecretList.class),
- Endpoints(Endpoints.class),
- EndpointsList(EndpointsList.class),
- Node(Node.class),
- NodeList(NodeList.class),
- Build(io.fabric8.openshift.api.model.Build.class),
- BuildList(io.fabric8.openshift.api.model.BuildList.class),
- BuildConfig(io.fabric8.openshift.api.model.BuildConfig.class),
- BuildConfigList(io.fabric8.openshift.api.model.BuildConfigList.class),
- DeploymentConfig(io.fabric8.openshift.api.model.DeploymentConfig.class),
- DeploymentConfigList(io.fabric8.openshift.api.model.DeploymentConfigList.class),
- Image(io.fabric8.openshift.api.model.Image.class),
- ImageList(io.fabric8.openshift.api.model.ImageList.class),
- ImageStream(io.fabric8.openshift.api.model.ImageStream.class),
- ImageStreamList(io.fabric8.openshift.api.model.ImageStreamList.class),
- NameTagReference(io.fabric8.openshift.api.model.NamedTagReference.class),
- NameTagEventList(io.fabric8.openshift.api.model.NamedTagEventList.class),
- Route(io.fabric8.openshift.api.model.Route.class),
- RouteList(io.fabric8.openshift.api.model.RouteList.class),
- Template(io.fabric8.openshift.api.model.template.Template.class),
- TemplateList(io.fabric8.openshift.api.model.template.TemplateList.class),
- OAuthClient(io.fabric8.openshift.api.model.OAuthClient.class),
- OAuthClientList(io.fabric8.openshift.api.model.OAuthClientList.class),
- OAuthClientAuthorization(io.fabric8.openshift.api.model.OAuthClientAuthorization.class),
- OAuthClientAuthorizationList(io.fabric8.openshift.api.model.OAuthClientAuthorizationList.class),
- OAuthAuthorizeToken(io.fabric8.openshift.api.model.OAuthAuthorizeToken.class),
- OAuthAuthorizeTokenList(io.fabric8.openshift.api.model.OAuthAuthorizeTokenList.class),
- OAuthAccessToken(io.fabric8.openshift.api.model.OAuthAccessToken.class),
- OAuthAccessTokenList(io.fabric8.openshift.api.model.OAuthAccessTokenList.class);
-
- private static final Map<String, Class<? extends KubernetesResource>> map = new HashMap<String, Class<? extends KubernetesResource>>();
-
- static {
- for (KubernetesKind kind : KubernetesKind.values()) {
- map.put(kind.name(), kind.type);
- }
- }
-
- private final Class<? extends KubernetesResource> type;
-
- KubernetesKind(Class type) {
- this.type = type;
- }
-
- public Class getType() {
- return type;
- }
-
- public static Class<? extends KubernetesResource> getTypeForName(String name) {
- return map.get(name);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesList.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesList.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesList.java
deleted file mode 100644
index 3450a46..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesList.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package io.fabric8.kubernetes.api.model;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import javax.annotation.Generated;
-import java.util.List;
-
-
-/**
- *
- *
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({
- "annotations",
- "apiVersion",
- "creationTimestamp",
- "deletionTimestamp",
- "generateName",
- "id",
- "items",
- "kind",
- "namespace",
- "resourceVersion",
- "selfLink",
- "uid"
-})
-@JsonDeserialize(using = JsonDeserializer.None.class)
-public class KubernetesList extends BaseKubernetesList implements KubernetesResource {
-
- /**
- * No args constructor for use in serialization
- */
- public KubernetesList() {
- super();
- }
-
- public KubernetesList(KubernetesList.ApiVersion apiVersion,
- List<HasMetadata> items,
- String kind,
- ListMeta metadata) {
- super(apiVersion, items, kind, metadata);
- this.setItems(items);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResource.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResource.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResource.java
deleted file mode 100644
index bc2ba3d..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResource.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package io.fabric8.kubernetes.api.model;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import io.fabric8.kubernetes.internal.KubernetesDeserializer;
-
-@JsonDeserialize(using = KubernetesDeserializer.class)
-public interface KubernetesResource {
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/resource/Quantity.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/resource/Quantity.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/resource/Quantity.java
deleted file mode 100644
index b614487..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/resource/Quantity.java
+++ /dev/null
@@ -1,135 +0,0 @@
-
-package io.fabric8.kubernetes.api.model.resource;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.databind.*;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-import javax.annotation.Generated;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- *
- *
- */
-@JsonDeserialize(using = Quantity.Deserializer.class)
-@JsonSerialize(using = Quantity.Serializer.class)
-@Generated("org.jsonschema2pojo")
-public class Quantity {
-
- private String amount;
- private String format;
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- * No args constructor for use in serialization
- *
- */
- public Quantity() {
- }
-
- /**
- *
- * @param Format
- * @param Amount
- */
- public Quantity(String amount) {
- this.amount = amount;
- }
-
- /**
- *
- * @param Format
- * @param Amount
- */
- public Quantity(String amount, String format) {
- this.amount = amount;
- this.format = format;
- }
-
- public String getAmount() {
- return amount;
- }
-
- public void setAmount(String amount) {
- this.amount = amount;
- }
-
- public String getFormat() {
- return format;
- }
-
- public void setFormat(String format) {
- this.format = format;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(amount).append(format).append(additionalProperties).toHashCode();
- }
-
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof Quantity) == false) {
- return false;
- }
- Quantity rhs = ((Quantity) other);
- return new EqualsBuilder().append(amount, rhs.amount).append(format, rhs.format).append(additionalProperties, rhs.additionalProperties).isEquals();
- }
-
- public static class Serializer extends JsonSerializer<Quantity> {
-
- @Override
- public void serialize(Quantity value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
- if (value != null && value.getAmount() != null) {
- jgen.writeNumber(value.getAmount());
- } else {
- jgen.writeNull();
- }
- }
- }
-
- public static class Deserializer extends JsonDeserializer<Quantity> {
-
- @Override
- public Quantity deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException {
- ObjectCodec oc = jsonParser.getCodec();
- JsonNode node = oc.readTree(jsonParser);
- Quantity quantity = new Quantity(node.asText());
- return quantity;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/util/IntOrString.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/util/IntOrString.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/util/IntOrString.java
deleted file mode 100644
index bbf9828..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/api/model/util/IntOrString.java
+++ /dev/null
@@ -1,195 +0,0 @@
-
-package io.fabric8.kubernetes.api.model.util;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-import javax.annotation.Generated;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonDeserialize(using = IntOrString.Deserializer.class)
-@JsonSerialize(using = IntOrString.Serializer.class)
-@JsonPropertyOrder({
- "IntVal",
- "Kind",
- "StrVal"
-})
-public class IntOrString {
-
- @JsonProperty("IntVal")
- private Integer IntVal;
- @JsonProperty("Kind")
- private Integer Kind;
- @JsonProperty("StrVal")
- private String StrVal;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- public IntOrString() {
- }
-
- //Builders are generated for the first non-empty constructor found.
- public IntOrString(Integer intVal, Integer kind, String strVal, Map<String, Object> additionalProperties) {
- IntVal = intVal;
- Kind = kind;
- StrVal = strVal;
- this.additionalProperties = additionalProperties;
- }
-
- public IntOrString(Integer intVal) {
- this(intVal, 0, null, new HashMap<String, Object>());
- }
-
- public IntOrString(String strVal) {
- this(null, 1, strVal, new HashMap<String, Object>());
- }
-
-
- /**
- *
- * @return
- * The IntVal
- */
- @JsonProperty("IntVal")
- public Integer getIntVal() {
- return IntVal;
- }
-
- /**
- *
- * @param IntVal
- * The IntVal
- */
- @JsonProperty("IntVal")
- public void setIntVal(Integer IntVal) {
- this.IntVal = IntVal;
- }
-
- /**
- *
- * @return
- * The Kind
- */
- @JsonProperty("Kind")
- public Integer getKind() {
- return Kind;
- }
-
- /**
- *
- * @param Kind
- * The Kind
- */
- @JsonProperty("Kind")
- public void setKind(Integer Kind) {
- this.Kind = Kind;
- }
-
- /**
- *
- * @return
- * The StrVal
- */
- @JsonProperty("StrVal")
- public String getStrVal() {
- return StrVal;
- }
-
- /**
- *
- * @param StrVal
- * The StrVal
- */
- @JsonProperty("StrVal")
- public void setStrVal(String StrVal) {
- this.StrVal = StrVal;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
-
- @Override
- public boolean equals(Object other) {
- return EqualsBuilder.reflectionEquals(this, other);
- }
-
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- public static class Serializer extends JsonSerializer<IntOrString> {
-
- @Override
- public void serialize(IntOrString value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
- if (value != null) {
- Integer intValue = value.getIntVal();
- if (intValue != null) {
- jgen.writeNumber(intValue);
- } else {
- String stringValue = value.getStrVal();
- if (stringValue != null) {
- jgen.writeString(stringValue);
- } else {
- jgen.writeNull();
- }
- }
- } else {
- jgen.writeNull();
- }
- }
-
- }
-
- public static class Deserializer extends JsonDeserializer<IntOrString> {
-
- @Override
- public IntOrString deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException {
- ObjectCodec oc = jsonParser.getCodec();
- JsonNode node = oc.readTree(jsonParser);
- IntOrString intOrString = new IntOrString();
- int asInt = node.asInt();
- if (asInt != 0) {
- intOrString.setIntVal(asInt);
- } else {
- intOrString.setStrVal(node.asText());
- }
- return intOrString;
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/HasMetadataComparator.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/HasMetadataComparator.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/HasMetadataComparator.java
deleted file mode 100644
index 84469f5..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/HasMetadataComparator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package io.fabric8.kubernetes.internal;
-
-import io.fabric8.kubernetes.api.model.HasMetadata;
-import io.fabric8.kubernetes.api.model.Service;
-
-import java.util.Comparator;
-
-public class HasMetadataComparator implements Comparator<HasMetadata> {
- @Override
- public int compare(HasMetadata a, HasMetadata b) {
- if (a == null || b == null) {
- throw new NullPointerException("Cannot compare null HasMetadata objects");
- }
- if (a == b) {
- return 0;
- }
-
- if (a instanceof Service && !(b instanceof Service)) {
- return -1;
- }
- if (b instanceof Service && !(a instanceof Service)) {
- return 1;
- }
- int classCompare = a.getClass().getSimpleName().compareTo(b.getClass().getSimpleName());
- if (classCompare != 0) {
- return classCompare;
- }
- return a.getMetadata().getName().compareTo(b.getMetadata().getName());
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/HasMetadataSet.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/HasMetadataSet.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/HasMetadataSet.java
deleted file mode 100644
index a6795c3..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/HasMetadataSet.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.fabric8.kubernetes.internal;
-
-import io.fabric8.kubernetes.api.model.HasMetadata;
-
-import java.util.Collection;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-public class HasMetadataSet extends TreeSet<HasMetadata> {
-
- public HasMetadataSet() {
- super(new HasMetadataComparator());
- }
-
- public HasMetadataSet(Collection<? extends HasMetadata> c) {
- super(new HasMetadataComparator());
- addAll(c);
- }
-
- public HasMetadataSet(SortedSet<HasMetadata> s) {
- super(new HasMetadataComparator());
- addAll(s);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/KubernetesDeserializer.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/KubernetesDeserializer.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/KubernetesDeserializer.java
deleted file mode 100644
index bac84ee..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/kubernetes/internal/KubernetesDeserializer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.fabric8.kubernetes.internal;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import io.fabric8.kubernetes.api.model.KubernetesKind;
-import io.fabric8.kubernetes.api.model.KubernetesResource;
-
-import java.io.IOException;
-
-public class KubernetesDeserializer extends JsonDeserializer<KubernetesResource> {
-
- private static final String KIND = "kind";
-
- @Override
- public KubernetesResource deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
- ObjectNode node = jp.readValueAsTree();
- JsonNode kind = node.get(KIND);
- if (kind != null) {
- String value = kind.textValue();
- Class<? extends KubernetesResource> resourceType = KubernetesKind.getTypeForName(value);
- if (resourceType == null) {
- throw ctxt.mappingException("No resource type found for kind:" + value);
- } else {
- return jp.getCodec().treeToValue(node, resourceType);
- }
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/openshift/api/model/template/Template.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/openshift/api/model/template/Template.java b/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/openshift/api/model/template/Template.java
deleted file mode 100644
index 08163ee..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/java/io/fabric8/openshift/api/model/template/Template.java
+++ /dev/null
@@ -1,306 +0,0 @@
-
-package io.fabric8.openshift.api.model.template;
-
-import com.fasterxml.jackson.annotation.*;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import io.fabric8.kubernetes.api.model.*;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-import javax.annotation.Generated;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-import java.util.*;
-
-
-/**
- *
- *
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({
- "apiVersion",
- "kind",
- "labels",
- "metadata",
- "objects",
- "parameters"
-})
-@JsonDeserialize(using = JsonDeserializer.None.class)
-public class Template implements HasMetadata {
-
- /**
- *
- * (Required)
- *
- */
- @JsonProperty("apiVersion")
- @NotNull
- private Template.ApiVersion apiVersion = Template.ApiVersion.fromValue("v1beta3");
- /**
- *
- * (Required)
- *
- */
- @JsonProperty("kind")
- @NotNull
- private java.lang.String kind = "Template";
- /**
- *
- *
- */
- @JsonProperty("labels")
- @Valid
- private Map<String, String> labels;
- /**
- *
- *
- */
- @JsonProperty("metadata")
- @Valid
- private ObjectMeta metadata;
- /**
- *
- *
- */
- @JsonProperty("objects")
- @Valid
- private List<HasMetadata> objects = new ArrayList<HasMetadata>();
- /**
- *
- *
- */
- @JsonProperty("parameters")
- @Valid
- private List<Parameter> parameters = new ArrayList<Parameter>();
- @JsonIgnore
- private Map<java.lang.String, java.lang.Object> additionalProperties = new HashMap<java.lang.String, java.lang.Object>();
-
-
- /**
- * No args constructor for use in serialization
- *
- */
- public Template() {
- }
-
- /**
- *
- * @param apiVersion
- * @param labels
- * @param parameters
- * @param objects
- * @param kind
- * @param metadata
- */
- public Template(Template.ApiVersion apiVersion, java.lang.String kind, Map<String, String> labels, ObjectMeta metadata, List<HasMetadata> objects, List<Parameter> parameters) {
- this.apiVersion = apiVersion;
- this.kind = kind;
- this.labels = labels;
- this.metadata = metadata;
- this.objects = objects;
- this.parameters = parameters;
-
- this.setObjects(objects);
- }
-
- /**
- *
- * (Required)
- *
- * @return
- * The apiVersion
- */
- @JsonProperty("apiVersion")
- public Template.ApiVersion getApiVersion() {
- return apiVersion;
- }
-
- /**
- *
- * (Required)
- *
- * @param apiVersion
- * The apiVersion
- */
- @JsonProperty("apiVersion")
- public void setApiVersion(Template.ApiVersion apiVersion) {
- this.apiVersion = apiVersion;
- }
-
- /**
- *
- * (Required)
- *
- * @return
- * The kind
- */
- @JsonProperty("kind")
- public java.lang.String getKind() {
- return kind;
- }
-
- /**
- *
- * (Required)
- *
- * @param kind
- * The kind
- */
- @JsonProperty("kind")
- public void setKind(java.lang.String kind) {
- this.kind = kind;
- }
-
- /**
- *
- *
- * @return
- * The labels
- */
- @JsonProperty("labels")
- public Map<String, String> getLabels() {
- return labels;
- }
-
- /**
- *
- *
- * @param labels
- * The labels
- */
- @JsonProperty("labels")
- public void setLabels(Map<String, String> labels) {
- this.labels = labels;
- }
-
- /**
- *
- *
- * @return
- * The metadata
- */
- @JsonProperty("metadata")
- public ObjectMeta getMetadata() {
- return metadata;
- }
-
- /**
- *
- *
- * @param metadata
- * The metadata
- */
- @JsonProperty("metadata")
- public void setMetadata(ObjectMeta metadata) {
- this.metadata = metadata;
- }
-
- /**
- *
- *
- * @return
- * The objects
- */
- @JsonProperty("objects")
- public List<HasMetadata> getObjects() {
- return objects;
- }
-
- public void setObjects(List<HasMetadata> objects) {
- this.objects = objects;
- }
-
- /**
- *
- *
- * @return
- * The parameters
- */
- @JsonProperty("parameters")
- public List<Parameter> getParameters() {
- return parameters;
- }
-
- /**
- *
- *
- * @param parameters
- * The parameters
- */
- @JsonProperty("parameters")
- public void setParameters(List<Parameter> parameters) {
- this.parameters = parameters;
- }
-
- @Override
- public java.lang.String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- @JsonAnyGetter
- public Map<java.lang.String, java.lang.Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(java.lang.String name, java.lang.Object value) {
- this.additionalProperties.put(name, value);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(apiVersion).append(kind).append(labels).append(metadata).append(objects).append(parameters).append(additionalProperties).toHashCode();
- }
-
- @Override
- public boolean equals(java.lang.Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof Template) == false) {
- return false;
- }
- Template rhs = ((Template) other);
- return new EqualsBuilder().append(apiVersion, rhs.apiVersion).append(kind, rhs.kind).append(labels, rhs.labels).append(metadata, rhs.metadata).append(objects, rhs.objects).append(parameters, rhs.parameters).append(additionalProperties, rhs.additionalProperties).isEquals();
- }
-
- @Generated("org.jsonschema2pojo")
- public static enum ApiVersion {
-
- V_1_BETA_3("v1beta3"),
- V_1("v1");
- private final java.lang.String value;
- private static Map<java.lang.String, Template.ApiVersion> constants = new HashMap<java.lang.String, Template.ApiVersion>();
-
- static {
- for (Template.ApiVersion c: values()) {
- constants.put(c.value, c);
- }
- }
-
- private ApiVersion(java.lang.String value) {
- this.value = value;
- }
-
- @JsonValue
- @Override
- public java.lang.String toString() {
- return this.value;
- }
-
- @JsonCreator
- public static Template.ApiVersion fromValue(java.lang.String value) {
- Template.ApiVersion constant = constants.get(value);
- if (constant == null) {
- throw new IllegalArgumentException(value);
- } else {
- return constant;
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-model/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-model/src/main/resources/log4j.properties b/dependencies/fabric8/kubernetes-model/src/main/resources/log4j.properties
deleted file mode 100644
index 393e087..0000000
--- a/dependencies/fabric8/kubernetes-model/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-# Root logger option
-log4j.rootLogger=INFO, stdout
-
-# Direct log messages to stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
\ No newline at end of file
[07/12] stratos git commit: Upgrading fabric8 kubernetes api version
to 2.2.16 and removing forked code
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesFactory.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesFactory.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesFactory.java
deleted file mode 100644
index 9877ecb..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesFactory.java
+++ /dev/null
@@ -1,384 +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.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.jaxrs.cfg.Annotations;
-import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
-import io.fabric8.kubernetes.api.extensions.Configs;
-import io.fabric8.kubernetes.api.model.config.Config;
-import io.fabric8.kubernetes.api.model.config.Context;
-import io.fabric8.utils.Strings;
-import io.fabric8.utils.Systems;
-import io.fabric8.utils.cxf.AuthorizationHeaderFilter;
-import io.fabric8.utils.cxf.WebClients;
-import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
-import org.apache.cxf.jaxrs.client.WebClient;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.websocket.client.WebSocketClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.core.MediaType;
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.security.KeyStore;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A simple helper class for creating instances of Kubernetes
- */
-public class KubernetesFactory {
- public static final String KUBERNETES_SCHEMA_JSON = "schema/kube-schema.json";
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- public static final String DEFAULT_KUBERNETES_MASTER = "http://localhost:8080";
-
- public static final String KUBERNETES_TRUST_ALL_CERIFICATES = "KUBERNETES_TRUST_CERT";
-
- public static final String KUBERNETES_SERVICE_HOST_ENV_VAR = "KUBERNETES_SERVICE_HOST";
- public static final String KUBERNETES_SERVICE_PORT_ENV_VAR = "KUBERNETES_SERVICE_PORT";
- public static final String KUBERNETES_MASTER_ENV_VAR = "KUBERNETES_MASTER";
- public static final String KUBERNETES_CA_CERTIFICATE_FILE_ENV_VAR = "KUBERNETES_CA_CERTIFICATE_FILE";
- public static final String KUBERNETES_CLIENT_CERTIFICATE_FILE_ENV_VAR = "KUBERNETES_CLIENT_CERTIFICATE_FILE";
- public static final String KUBERNETES_CLIENT_KEY_FILE_ENV_VAR = "KUBERNETES_CLIENT_KEY_FILE";
- public static final String KUBERNETES_CLIENT_KEY_DATA_ENV_VAR = "KUBERNETES_CLIENT_KEY_DATA";
- public static final String KUBERNETES_CA_CERTIFICATE_DATA_ENV_VAR = "KUBERNETES_CA_CERTIFICATE_DATA";
- public static final String KUBERNETES_CLIENT_CERTIFICATE_DATA_ENV_VAR = "KUBERNETES_CLIENT_CERTIFICATE_DATA";
- public static final String KUBERNETES_CLIENT_KEY_ALGO_ENV_VAR = "KUBERNETES_CLIENT_KEY_ALGO";
- public static final String KUBERNETES_CLIENT_KEY_PASSWORD_ENV_VAR = "KUBERNETES_CLIENT_KEY_PASSWORD";
- public static final String KUBERNETES_MASTER_SYSTEM_PROPERTY = "kubernetes.master";
- public static final String KUBERNETES_VERIFY_SYSTEM_PROPERTY = "kubernetes.verify";
-
- private String address;
- private boolean verifyAddress = true;
- private boolean trustAllCerts = false;
-
- private File caCertFile;
- private File clientCertFile;
- private File clientKeyFile;
- private String caCertData;
- private String clientCertData;
- private String clientKeyData;
- private String clientKeyAlgo = "RSA";
- private char[] clientKeyPassword = new char[]{};
- private String username;
- private String password;
-
- public KubernetesFactory() {
- this(null);
- }
-
- public KubernetesFactory(String address) {
- this(address, Boolean.parseBoolean(System.getProperty(KUBERNETES_VERIFY_SYSTEM_PROPERTY, "true")));
- }
-
- public KubernetesFactory(String address, boolean verifyAddress) {
- this.verifyAddress = verifyAddress;
- init();
- initAddress(address);
- }
-
- protected void initAddress(String address) {
- if (Strings.isNullOrBlank(address)) {
- setAddress(findKubernetesMaster());
- } else {
- setAddress(address);
- }
- }
-
- protected String findKubernetesMaster() {
- return resolveHttpKubernetesMaster();
- }
-
- private void init() {
- if (System.getenv(KUBERNETES_TRUST_ALL_CERIFICATES) != null) {
- this.trustAllCerts = Boolean.valueOf(System.getenv(KUBERNETES_TRUST_ALL_CERIFICATES));
- } else if (System.getenv(KUBERNETES_CA_CERTIFICATE_FILE_ENV_VAR) != null) {
- File candidateCaCertFile = new File(System.getenv(KUBERNETES_CA_CERTIFICATE_FILE_ENV_VAR));
- if (candidateCaCertFile.exists() && candidateCaCertFile.canRead()) {
- this.caCertFile = candidateCaCertFile;
- } else {
- log.error("Specified CA certificate file {} does not exist or is not readable", candidateCaCertFile);
- }
- }
-
- if (System.getenv(KUBERNETES_CA_CERTIFICATE_DATA_ENV_VAR) != null) {
- this.caCertData = System.getenv(KUBERNETES_CA_CERTIFICATE_DATA_ENV_VAR);
- }
-
- if (System.getenv(KUBERNETES_CLIENT_CERTIFICATE_FILE_ENV_VAR) != null) {
- File candidateClientCertFile = new File(System.getenv(KUBERNETES_CLIENT_CERTIFICATE_FILE_ENV_VAR));
- if (candidateClientCertFile.exists() && candidateClientCertFile.canRead()) {
- this.clientCertFile = candidateClientCertFile;
- } else {
- log.error("Specified client certificate file {} does not exist or is not readable", candidateClientCertFile);
- }
- }
-
- if (System.getenv(KUBERNETES_CLIENT_CERTIFICATE_DATA_ENV_VAR) != null) {
- this.clientCertData = System.getenv(KUBERNETES_CLIENT_CERTIFICATE_DATA_ENV_VAR);
- }
-
- if (System.getenv(KUBERNETES_CLIENT_KEY_FILE_ENV_VAR) != null) {
- File candidateClientKeyFile = new File(System.getenv(KUBERNETES_CLIENT_KEY_FILE_ENV_VAR));
- if (candidateClientKeyFile.exists() && candidateClientKeyFile.canRead()) {
- this.clientKeyFile = candidateClientKeyFile;
- } else {
- log.error("Specified client key file {} does not exist or is not readable", candidateClientKeyFile);
- }
- }
-
- if (System.getenv(KUBERNETES_CLIENT_KEY_DATA_ENV_VAR) != null) {
- this.clientKeyData = System.getenv(KUBERNETES_CLIENT_KEY_DATA_ENV_VAR);
- }
-
- if (System.getenv(KUBERNETES_CLIENT_KEY_ALGO_ENV_VAR) != null) {
- this.clientKeyAlgo = System.getenv(KUBERNETES_CLIENT_KEY_ALGO_ENV_VAR);
- }
-
- if (System.getenv(KUBERNETES_CLIENT_KEY_PASSWORD_ENV_VAR) != null) {
- this.clientKeyPassword = System.getenv(KUBERNETES_CLIENT_KEY_PASSWORD_ENV_VAR).toCharArray();
- }
- }
-
- @Override
- public String toString() {
- return "KubernetesFactory{" + address + '}';
- }
-
- public Kubernetes createKubernetes() {
- return createWebClient(Kubernetes.class);
- }
-
- public KubernetesExtensions createKubernetesExtensions() {
- return createWebClient(KubernetesExtensions.class);
- }
-
- public KubernetesGlobalExtensions createKubernetesGlobalExtensions() {
- return createWebClient(KubernetesGlobalExtensions.class);
- }
-
- /**
- * Creates a JAXRS web client for the given JAXRS client
- */
- public <T> T createWebClient(Class<T> clientType) {
- WebClient webClient = createWebClient();
- return JAXRSClientFactory.fromClient(webClient, clientType);
- }
-
- public WebClient createWebClient() {
- return createWebClient(address);
- }
-
- public WebClient createWebClient(String serviceAddress) {
- List<Object> providers = createProviders();
-
- AuthorizationHeaderFilter authorizationHeaderFilter = new AuthorizationHeaderFilter();
- providers.add(authorizationHeaderFilter);
-
- WebClient webClient = WebClient.create(serviceAddress, providers);
- WebClients.configureUserAndPassword(webClient, this.username, this.password);
- boolean registeredCert = false;
- if (trustAllCerts) {
- WebClients.disableSslChecks(webClient);
- } else if (caCertFile != null || caCertData != null) {
- WebClients.configureCaCert(webClient, this.caCertData, this.caCertFile);
- }
- if ((clientCertFile != null || clientCertData != null) && (clientKeyFile != null || clientKeyData != null)) {
- WebClients.configureClientCert(webClient, this.clientCertData, this.clientCertFile, this.clientKeyData, this.clientKeyFile, this.clientKeyAlgo, this.clientKeyPassword);
- registeredCert = true;
- }
- if (!registeredCert) {
- String token = findToken();
- if (Strings.isNotBlank(token)) {
- String authHeader = "Bearer " + token;
- authorizationHeaderFilter.setAuthorizationHeader(authHeader);
- }
- }
- return webClient;
- }
-
- public WebSocketClient createWebSocketClient() throws Exception {
- SslContextFactory sslContextFactory = null;
- if (trustAllCerts) {
- sslContextFactory = new SslContextFactory(trustAllCerts);
- } else if (caCertData != null || caCertFile != null) {
- KeyStore trustStore = WebClients.createTrustStore(caCertData, caCertFile);
- sslContextFactory = new SslContextFactory();
- sslContextFactory.setTrustStore(trustStore);
- }
- if ((clientCertFile != null || clientCertData != null) && (clientKeyFile != null || clientKeyData != null)) {
- if (sslContextFactory == null) {
- sslContextFactory = new SslContextFactory();
- }
- KeyStore keyStore = WebClients.createKeyStore(this.clientCertData, this.clientCertFile, this.clientKeyData, this.clientKeyFile, this.clientKeyAlgo, this.clientKeyPassword);
- sslContextFactory = new SslContextFactory();
- sslContextFactory.setKeyStore(keyStore);
- }
-
- sslContextFactory.setIncludeProtocols("TLSv1", "TLSv1.1", "TLSv1.2");
-
- WebSocketClient client = new WebSocketClient(sslContextFactory);
-
- return client;
- }
-
- public String findToken() {
- String token = getServiceAccountToken();
- if (Strings.isNotBlank(token)) {
- return token;
- }
- return findOpenShiftToken();
- }
-
- public String getServiceAccountToken() {
- try {
- return new String(Files.readAllBytes(Paths.get(Kubernetes.SERVICE_ACCOUNT_TOKEN_FILE)));
- } catch (IOException e) {
- log.debug("Cannot read service account token");
- }
- return null;
- }
-
- public String findOpenShiftToken() {
- Config config = Configs.parseConfigs();
- if (config != null) {
- Context context = Configs.getCurrentContext(config);
- if (context != null) {
- return Configs.getUserToken(config, context);
- }
- }
- return null;
- }
-
- protected List<Object> createProviders() {
- List<Object> providers = new ArrayList<Object>();
- Annotations[] annotationsToUse = JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS;
- ObjectMapper objectMapper = createObjectMapper();
- providers.add(new JacksonJaxbJsonProvider(objectMapper, annotationsToUse));
- providers.add(new PlainTextJacksonProvider(objectMapper, annotationsToUse));
- providers.add(new ExceptionResponseMapper());
- //providers.add(new JacksonIntOrStringConfig(objectMapper));
- return providers;
- }
-
-
- /**
- * Lets accept plain text too as if its JSON to work around some issues with the REST API and remote kube....
- */
- @javax.ws.rs.ext.Provider
- @javax.ws.rs.Consumes({"text/plain"})
- @javax.ws.rs.Produces({"text/plain"})
- public static class PlainTextJacksonProvider extends JacksonJaxbJsonProvider {
- public PlainTextJacksonProvider(ObjectMapper mapper, Annotations[] annotationsToUse) {
- super(mapper, annotationsToUse);
- }
-
- @Override
- protected boolean hasMatchingMediaType(MediaType mediaType) {
- boolean answer = super.hasMatchingMediaType(mediaType);
- String type = mediaType.getType();
- String subtype = mediaType.getSubtype();
- if (!answer && type.equals("text")) {
- answer = super.hasMatchingMediaType(MediaType.APPLICATION_JSON_TYPE);
- }
- return answer;
- }
- }
-
- public String getKubernetesMaster() {
- String answer = address;
- int idx = answer.lastIndexOf(":");
- if (idx > 0) {
- answer = answer.substring(0, idx);
- }
- idx = answer.lastIndexOf(":");
- if (idx > 0) {
- answer = answer.substring(idx + 1);
- }
- idx = answer.lastIndexOf("/");
- if (idx > 0) {
- answer = answer.substring(idx + 1);
- }
- return answer;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- if (Strings.isNullOrBlank(address)) {
- this.address = findKubernetesMaster();
- }
-
- if (verifyAddress) {
- try {
- URL url = new URL(this.address);
- if (KubernetesHelper.isServiceSsl(url.getHost(), url.getPort(), true)) {
- this.address = "https://" + url.getHost() + ":" + url.getPort();
- } else {
- this.address = "http://" + url.getHost() + ":" + url.getPort();
- }
- } catch (MalformedURLException e) {
- throw new IllegalArgumentException("Invalid kubernetes master address", e);
- }
- }
- }
-
- // Helpers
-
- public static String resolveHttpKubernetesMaster() {
- String kubernetesMaster = resolveKubernetesMaster();
- if (kubernetesMaster.startsWith("tcp:")) {
- return "https:" + kubernetesMaster.substring(4);
- }
- return kubernetesMaster;
- }
-
- public static String resolveKubernetesMaster() {
- String hostEnvVar = KUBERNETES_SERVICE_HOST_ENV_VAR;
- String portEnvVar = KUBERNETES_SERVICE_PORT_ENV_VAR;
- String proto = "https";
-
- // First let's check if it's available as a kubernetes service like it should be...
- String kubernetesMaster = System.getenv(hostEnvVar);
- if (Strings.isNotBlank(kubernetesMaster)) {
- kubernetesMaster = proto + "://" + kubernetesMaster + ":" + System.getenv(portEnvVar);
- } else {
- // If not then fall back to KUBERNETES_MASTER env var
- kubernetesMaster = Systems.getSystemPropertyOrEnvVar(KUBERNETES_MASTER_SYSTEM_PROPERTY, KUBERNETES_MASTER_ENV_VAR, DEFAULT_KUBERNETES_MASTER);
- }
- return kubernetesMaster;
- }
-
- /**
- * Creates a configured Jackson object mapper for parsing JSON
- */
- public static ObjectMapper createObjectMapper() {
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationFeature.INDENT_OUTPUT);
- return mapper;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesGlobalExtensions.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesGlobalExtensions.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesGlobalExtensions.java
deleted file mode 100644
index 9ce945f..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesGlobalExtensions.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.openshift.api.model.OAuthClient;
-
-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;
-
-/**
- * Various Kubernetes extensions defined in the OpenShift project which are namespace agnostic
- */
-@Path("osapi/v1beta3")
-@Produces("application/json")
-@Consumes("application/json")
-public interface KubernetesGlobalExtensions {
-
- @POST
- @Path("oauthclients")
- @Consumes("application/json")
- String createOAuthClient(OAuthClient entity) throws Exception;
-
- @GET
- @Path("oauthclients/{name}")
- OAuthClient getOAuthClient(@PathParam("name") @NotNull String name);
-
- @PUT
- @Path("oauthclients/{name}")
- @Consumes("application/json")
- String updateOAuthClient(@PathParam("name") @NotNull String name, OAuthClient entity) throws Exception;
-
- @DELETE
- @Path("oauthclients/{name}")
- String deleteOAuthClient(@PathParam("name") @NotNull String name);
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesHelper.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesHelper.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesHelper.java
deleted file mode 100644
index 360c0a5..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/KubernetesHelper.java
+++ /dev/null
@@ -1,1724 +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 com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
-import io.fabric8.kubernetes.api.model.KubernetesResource;
-import io.fabric8.kubernetes.api.extensions.Templates;
-import io.fabric8.kubernetes.api.model.Container;
-import io.fabric8.kubernetes.api.model.ContainerPort;
-import io.fabric8.kubernetes.api.model.ContainerState;
-import io.fabric8.kubernetes.api.model.ContainerStateRunning;
-import io.fabric8.kubernetes.api.model.ContainerStateTerminated;
-import io.fabric8.kubernetes.api.model.ContainerStateWaiting;
-import io.fabric8.kubernetes.api.model.ContainerStatus;
-import io.fabric8.kubernetes.api.model.HasMetadata;
-import io.fabric8.kubernetes.api.model.KubernetesList;
-import io.fabric8.kubernetes.api.model.ObjectMeta;
-import io.fabric8.kubernetes.api.model.Pod;
-import io.fabric8.kubernetes.api.model.PodList;
-import io.fabric8.kubernetes.api.model.PodSpec;
-import io.fabric8.kubernetes.api.model.PodStatus;
-import io.fabric8.kubernetes.api.model.PodTemplateSpec;
-import io.fabric8.kubernetes.api.model.ReplicationController;
-import io.fabric8.kubernetes.api.model.ReplicationControllerList;
-import io.fabric8.kubernetes.api.model.ReplicationControllerSpec;
-import io.fabric8.kubernetes.api.model.Secret;
-import io.fabric8.kubernetes.api.model.Service;
-import io.fabric8.kubernetes.api.model.ServiceList;
-import io.fabric8.kubernetes.api.model.ServicePort;
-import io.fabric8.kubernetes.api.model.ServiceSpec;
-import io.fabric8.kubernetes.api.model.util.IntOrString;
-import io.fabric8.openshift.api.model.DeploymentConfig;
-import io.fabric8.openshift.api.model.DeploymentConfigSpec;
-import io.fabric8.openshift.api.model.OAuthClient;
-import io.fabric8.openshift.api.model.Route;
-import io.fabric8.openshift.api.model.RouteSpec;
-import io.fabric8.openshift.api.model.template.Parameter;
-import io.fabric8.openshift.api.model.template.Template;
-import io.fabric8.utils.Files;
-import io.fabric8.utils.Filter;
-import io.fabric8.utils.Filters;
-import io.fabric8.utils.Objects;
-import io.fabric8.utils.Strings;
-import io.fabric8.utils.Systems;
-import io.fabric8.utils.cxf.TrustEverythingSSLTrustManager;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xbill.DNS.*;
-
-import javax.net.ssl.SSLException;
-import javax.net.ssl.SSLHandshakeException;
-import javax.net.ssl.SSLKeyException;
-import javax.net.ssl.SSLPeerUnverifiedException;
-import javax.net.ssl.SSLProtocolException;
-import javax.net.ssl.SSLSocketFactory;
-import javax.ws.rs.WebApplicationException;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-import static io.fabric8.utils.Lists.notNullList;
-import static io.fabric8.utils.Strings.isNullOrBlank;
-
-/**
- * Kubernetes utility methods.
- */
-public final class KubernetesHelper {
- public static final int INTORSTRING_KIND_INT = 0;
- public static final int INTORSTRING_KIND_STRING = 1;
- private static final transient Logger LOG = LoggerFactory.getLogger(KubernetesHelper.class);
-
- public static final String DEFAULT_DOCKER_HOST = "tcp://localhost:2375";
- protected static SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
- private static ObjectMapper objectMapper = KubernetesFactory.createObjectMapper();
-
- public static final String defaultApiVersion = "v1beta3";
- public static final String defaultOsApiVersion = "v1beta3";
-
- private static final String HOST_SUFFIX = "_SERVICE_HOST";
- private static final String PORT_SUFFIX = "_SERVICE_PORT";
- private static final String PROTO_SUFFIX = "_TCP_PROTO";
- public static final String DEFAULT_PROTO = "tcp";
-
- /**
- * Returns the ID of the given object
- */
- public static String getObjectId(Object object) {
- if (object instanceof HasMetadata) {
- return getName((HasMetadata) object);
- } else {
- return object != null ? object.toString() : null;
- }
- }
-
- public static ObjectMeta getOrCreateMetadata(HasMetadata entity) {
- ObjectMeta metadata = entity.getMetadata();
- if (metadata == null) {
- metadata = new ObjectMeta();
- entity.setMetadata(metadata);
- }
- return metadata;
- }
-
- /**
- * Returns the resource version for the entity or null if it does not have one
- */
- public static String getResourceVersion(HasMetadata entity) {
- if (entity != null) {
- ObjectMeta metadata = entity.getMetadata();
- if (metadata != null) {
- String resourceVersion = metadata.getResourceVersion();
- if (Strings.isNotBlank(resourceVersion)) {
- return resourceVersion;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns true if this entity has a valid non blank resourceVersion in its metadata
- */
- public static boolean hasResourceVersion(HasMetadata entity) {
- return getResourceVersion(entity) != null;
- }
-
- public static String getName(ObjectMeta entity) {
- if (entity != null) {
- return Strings.firstNonBlank(entity.getName(),
- getAdditionalPropertyText(entity.getAdditionalProperties(), "id"),
- entity.getUid());
- } else {
- return null;
- }
- }
-
-
- /**
- * Returns the kind of the entity
- */
- public static String getKind(HasMetadata entity) {
- if (entity != null) {
- // TODO use reflection to find the kind?
- if (entity instanceof KubernetesList) {
- return "List";
- } else {
- return entity.getClass().getSimpleName();
- }
- } else {
- return null;
- }
- }
-
- public static String getName(HasMetadata entity) {
- if (entity != null) {
- return getName(entity.getMetadata());
- } else {
- return null;
- }
- }
-
- public static void setName(HasMetadata entity, String name) {
- getOrCreateMetadata(entity).setName(name);
- }
-
- public static void setName(HasMetadata entity, String namespace, String name) {
- ObjectMeta metadata = getOrCreateMetadata(entity);
- metadata.setNamespace(namespace);
- metadata.setName(name);
- }
-
- public static void setNamespace(HasMetadata entity, String namespace) {
- getOrCreateMetadata(entity).setNamespace(namespace);
- }
-
- public static String getNamespace(ObjectMeta entity) {
- if (entity != null) {
- return entity.getNamespace();
- } else {
- return null;
- }
- }
-
- public static String getNamespace(HasMetadata entity) {
- if (entity != null) {
- return getNamespace(entity.getMetadata());
- } else {
- return null;
- }
- }
-
- public static Map<String, String> getOrCreateAnnotations(HasMetadata entity) {
- ObjectMeta metadata = getOrCreateMetadata(entity);
- Map<String, String> answer = metadata.getAnnotations();
- if (answer == null) {
- // use linked so the annotations can be in the FIFO order
- answer = new LinkedHashMap<>();
- metadata.setAnnotations(answer);
- }
- return answer;
- }
-
- public static Map<String, String> getOrCreateLabels(HasMetadata entity) {
- ObjectMeta metadata = getOrCreateMetadata(entity);
- Map<String, String> answer = metadata.getLabels();
- if (answer == null) {
- // use linked so the annotations can be in the FIFO order
- answer = new LinkedHashMap<>();
- metadata.setLabels(answer);
- }
- return answer;
- }
-
- /**
- * Returns the labels of the given metadata object or an empty map if the metadata or labels are null
- */
- @SuppressWarnings("unchecked")
- public static Map<String, String> getLabels(ObjectMeta metadata) {
- if (metadata != null) {
- Map<String, String> labels = metadata.getLabels();
- if (labels != null) {
- return labels;
- }
- }
- return Collections.EMPTY_MAP;
- }
-
- @SuppressWarnings("unchecked")
- public static Map<String, String> getLabels(HasMetadata entity) {
- if (entity != null) {
- return getLabels(entity.getMetadata());
- }
- return Collections.EMPTY_MAP;
- }
-
- public static ServiceSpec getOrCreateSpec(Service entity) {
- ServiceSpec spec = entity.getSpec();
- if (spec == null) {
- spec = new ServiceSpec();
- entity.setSpec(spec);
- }
- return spec;
- }
-
- public static String getPortalIP(Service entity) {
- String answer = null;
- if (entity != null) {
- ServiceSpec spec = getOrCreateSpec(entity);
- return spec.getPortalIP();
- }
- return answer;
- }
-
- @SuppressWarnings("unchecked")
- public static Map<String, String> getSelector(Service entity) {
- Map<String, String> answer = null;
- if (entity != null) {
- ServiceSpec spec = getOrCreateSpec(entity);
- answer = spec.getSelector();
- }
- return answer != null ? answer : Collections.EMPTY_MAP;
- }
-
- public static void setSelector(Service entity, Map<String, String> labels) {
- ServiceSpec spec = getOrCreateSpec(entity);
- spec.setSelector(labels);
- }
-
- public static Set<Integer> getPorts(Service entity) {
- Set<Integer> answer = new HashSet<>();
- if (entity != null) {
- ServiceSpec spec = getOrCreateSpec(entity);
- for (ServicePort port : spec.getPorts()) {
- answer.add(port.getPort());
- }
- }
- return answer;
- }
-
- protected static String getAdditionalPropertyText(Map<String, Object> additionalProperties, String name) {
- if (additionalProperties != null) {
- Object value = additionalProperties.get(name);
- if (value != null) {
- return value.toString();
- }
- }
- return null;
- }
-
- protected static Map<String, Object> getMetadata(Map<String, Object> additionalProperties, boolean create) {
- Map<String, Object> answer = getAdditionalPropertyMap(additionalProperties, "metadata");
- if (answer == null) {
- answer = new LinkedHashMap<>();
- if (create) {
- additionalProperties.put("metadata", answer);
- }
- }
- return answer;
- }
-
- @SuppressWarnings("unchecked")
- protected static Map<String, Object> getAdditionalPropertyMap(Map<String, Object> additionalProperties, String name) {
- if (additionalProperties != null) {
- Object value = additionalProperties.get(name);
- if (value instanceof Map) {
- return (Map<String, Object>) value;
- }
- }
- return null;
- }
-
- public static String getDockerIp() {
- String url = resolveDockerHost();
- int idx = url.indexOf("://");
- if (idx > 0) {
- url = url.substring(idx + 3);
- }
- idx = url.indexOf(":");
- if (idx > 0) {
- url = url.substring(0, idx);
- }
- return url;
- }
-
- public static String resolveDockerHost() {
- String dockerHost = System.getenv("DOCKER_HOST");
- if (isNullOrBlank(dockerHost)) {
- dockerHost = System.getProperty("docker.host");
- }
- if (isNullOrBlank(dockerHost)) {
- return DEFAULT_DOCKER_HOST;
- } else {
- return dockerHost;
- }
- }
-
- public static String toJson(Object dto) throws JsonProcessingException {
- Class<?> clazz = dto.getClass();
- return objectMapper.writerWithType(clazz).writeValueAsString(dto);
- }
-
- /**
- * Returns the given json data as a DTO such as
- * {@link Pod}, {@link ReplicationController} or
- * {@link io.fabric8.kubernetes.api.model.Service}
- * from the Kubernetes REST API
- */
- public static Object loadJson(File file) throws IOException {
- byte[] data = Files.readBytes(file);
- return loadJson(data);
- }
-
- /**
- * Returns the given json data as a DTO such as
- * {@link Pod}, {@link ReplicationController} or
- * {@link io.fabric8.kubernetes.api.model.Service}
- * from the Kubernetes REST API
- */
- public static Object loadJson(InputStream in) throws IOException {
- byte[] data = Files.readBytes(in);
- return loadJson(data);
- }
-
- public static Object loadJson(String json) throws IOException {
- byte[] data = json.getBytes();
- return loadJson(data);
- }
-
- /**
- * Returns the given json data as a DTO such as
- * {@link Pod}, {@link ReplicationController} or
- * {@link io.fabric8.kubernetes.api.model.Service}
- * from the Kubernetes REST API
- */
- public static Object loadJson(byte[] json) throws IOException {
- if (json != null && json.length > 0) {
- return objectMapper.reader(KubernetesResource.class).readValue(json);
- }
- return null;
- }
-
- /**
- * Loads the YAML file for the given DTO class
- */
- public static <T> T loadYaml(InputStream in, Class<T> clazz) throws IOException {
- byte[] data = Files.readBytes(in);
- return loadYaml(data, clazz);
- }
-
- /**
- * Loads the YAML file for the given DTO class
- */
- public static <T> T loadYaml(File file, Class<T> clazz) throws IOException {
- byte[] data = Files.readBytes(file);
- return loadYaml(data, clazz);
- }
-
- /**
- * Loads the YAML file for the given DTO class
- */
- public static <T> T loadYaml(byte[] data, Class<T> clazz) throws IOException {
- ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
- return mapper.readValue(data, clazz);
- }
-
- /**
- * Loads the Kubernetes JSON and converts it to a list of entities
- */
- @SuppressWarnings("unchecked")
- public static List<HasMetadata> toItemList(Object entity) throws IOException {
- if (entity instanceof List) {
- return (List<HasMetadata>) entity;
- } else if (entity instanceof HasMetadata[]) {
- HasMetadata[] array = (HasMetadata[]) entity;
- return Arrays.asList(array);
- } else if (entity instanceof KubernetesList) {
- KubernetesList config = (KubernetesList) entity;
- return config.getItems();
- } else if (entity instanceof Template) {
- Template objects = (Template) entity;
- return objects.getObjects();
- } else {
- List<HasMetadata> answer = new ArrayList<>();
- if (entity instanceof HasMetadata) {
- answer.add((HasMetadata) entity);
- }
- return answer;
- }
- }
-
- /**
- * Saves the json object to the given file
- */
- public static void saveJson(File json, Object object) throws IOException {
- objectMapper.writer().writeValue(json, object);
- }
-
- /**
- * Returns a map indexed by pod id of the pods
- */
- public static Map<String, Pod> toPodMap(PodList podSchema) {
- return toFilteredPodMap(podSchema, Filters.<Pod>trueFilter());
- }
-
- protected static Map<String, Pod> toFilteredPodMap(PodList podSchema, Filter<Pod> filter) {
- List<Pod> list = podSchema != null ? podSchema.getItems() : null;
- List<Pod> filteredList = Filters.filter(list, filter);
- return toPodMap(filteredList);
- }
-
- /**
- * Returns a map indexed by pod id of the pods
- */
- public static Map<String, Pod> toPodMap(List<Pod> pods) {
- List<Pod> list = notNullList(pods);
- Map<String, Pod> answer = new HashMap<>();
- for (Pod pod : list) {
- String id = getName(pod);
- if (Strings.isNotBlank(id)) {
- answer.put(id, pod);
- }
- }
- return answer;
- }
-
- /**
- * Returns a map indexed by service id of the services
- */
- public static Map<String, Service> toServiceMap(ServiceList serviceSchema) {
- return toServiceMap(serviceSchema != null ? serviceSchema.getItems() : null);
- }
-
- /**
- * Returns a map indexed by service id of the services
- */
- public static Map<String, Service> toServiceMap(List<Service> services) {
- List<Service> list = notNullList(services);
- Map<String, Service> answer = new HashMap<>();
- for (Service service : list) {
- String id = getName(service);
- if (Strings.isNotBlank(id)) {
- answer.put(id, service);
- }
- }
- return answer;
- }
-
- public static Map<String, Service> toFilteredServiceMap(ServiceList serviceList, Filter<Service> filter) {
- List<Service> list = serviceList != null ? serviceList.getItems() : null;
- List<Service> filteredList = Filters.filter(list, filter);
- return toServiceMap(filteredList);
- }
-
- /**
- * Returns a map indexed by replicationController id of the replicationControllers
- */
- public static Map<String, ReplicationController> toReplicationControllerMap(ReplicationControllerList replicationControllerSchema) {
- Filter<ReplicationController> filter = createReplicationControllerFilter((String) null);
- return toFilteredReplicationControllerMap(replicationControllerSchema, filter);
- }
-
- protected static Map<String, ReplicationController> toFilteredReplicationControllerMap(ReplicationControllerList replicationControllerSchema, Filter<ReplicationController> filter) {
- List<ReplicationController> list = replicationControllerSchema != null ? replicationControllerSchema.getItems() : null;
- List<ReplicationController> filteredList = Filters.filter(list, filter);
- return toReplicationControllerMap(filteredList);
- }
-
- /**
- * Returns a map indexed by replicationController id of the replicationControllers
- */
- public static Map<String, ReplicationController> toReplicationControllerMap(List<ReplicationController> replicationControllers) {
- List<ReplicationController> list = notNullList(replicationControllers);
- Map<String, ReplicationController> answer = new HashMap<>();
- for (ReplicationController replicationControllerSchema : list) {
- String id = getName(replicationControllerSchema);
- if (Strings.isNotBlank(id)) {
- answer.put(id, replicationControllerSchema);
- }
- }
- return answer;
- }
-
- public static Map<String, Pod> getPodMap(Kubernetes kubernetes) {
- return getPodMap(kubernetes, Kubernetes.NAMESPACE_ALL);
- }
-
- public static Map<String, Pod> getPodMap(Kubernetes kubernetes, String namespace) {
- PodList pods = null;
- try {
- pods = kubernetes.getPods(namespace);
- } catch (WebApplicationException e) {
- if (e.getResponse().getStatus() == 404) {
- // ignore not found
- } else {
- throw e;
- }
- }
- return toPodMap(pods);
- }
-
- public static Map<String, Pod> getSelectedPodMap(Kubernetes kubernetes, String selector) {
- return getSelectedPodMap(kubernetes, Kubernetes.NAMESPACE_ALL, selector);
- }
-
- public static Map<String, Pod> getSelectedPodMap(Kubernetes kubernetes, String namespace, String selector) {
- Filter<Pod> filter = createPodFilter(selector);
- return getFilteredPodMap(kubernetes, namespace, filter);
- }
-
- public static Map<String, Pod> getFilteredPodMap(Kubernetes kubernetes, Filter<Pod> filter) {
- return getFilteredPodMap(kubernetes, Kubernetes.NAMESPACE_ALL, filter);
- }
-
- public static Map<String, Pod> getFilteredPodMap(Kubernetes kubernetes, String namespace, Filter<Pod> filter) {
- PodList podSchema = kubernetes.getPods(namespace);
- return toFilteredPodMap(podSchema, filter);
- }
-
- public static Map<String, Service> getServiceMap(Kubernetes kubernetes) {
- return getServiceMap(kubernetes, Kubernetes.NAMESPACE_ALL);
- }
-
- public static Map<String, Service> getServiceMap(Kubernetes kubernetes, String namespace) {
- return toServiceMap(kubernetes.getServices(namespace));
- }
-
- public static Map<String, ReplicationController> getReplicationControllerMap(Kubernetes kubernetes) {
- return getReplicationControllerMap(kubernetes, Kubernetes.NAMESPACE_ALL);
- }
-
- public static Map<String, ReplicationController> getReplicationControllerMap(Kubernetes kubernetes, String namespace) {
- return toReplicationControllerMap(kubernetes.getReplicationControllers(namespace));
- }
-
- public static Map<String, ReplicationController> getSelectedReplicationControllerMap(Kubernetes kubernetes, String selector) {
- return getSelectedReplicationControllerMap(kubernetes, Kubernetes.NAMESPACE_ALL, selector);
- }
-
- public static Map<String, ReplicationController> getSelectedReplicationControllerMap(Kubernetes kubernetes, String namespace, String selector) {
- Filter<ReplicationController> filter = createReplicationControllerFilter(selector);
- return toFilteredReplicationControllerMap(kubernetes.getReplicationControllers(namespace), filter);
- }
-
- /**
- * Removes empty pods returned by Kubernetes
- */
- public static void removeEmptyPods(PodList podSchema) {
- List<Pod> list = notNullList(podSchema.getItems());
-
- List<Pod> removeItems = new ArrayList<Pod>();
-
- for (Pod pod : list) {
- if (StringUtils.isEmpty(getName(pod))) {
- removeItems.add(pod);
-
- }
- }
- list.removeAll(removeItems);
- }
-
- /**
- * Returns the pod id for the given container id
- */
- public static String containerNameToPodId(String containerName) {
- // TODO use prefix?
- return containerName;
- }
-
- /**
- * Returns a string for the labels using "," to separate values
- */
- public static String toLabelsString(Map<String, String> labelMap) {
- StringBuilder buffer = new StringBuilder();
- if (labelMap != null) {
- Set<Map.Entry<String, String>> entries = labelMap.entrySet();
- for (Map.Entry<String, String> entry : entries) {
- if (buffer.length() > 0) {
- buffer.append(",");
- }
- buffer.append(entry.getKey());
- buffer.append("=");
- buffer.append(entry.getValue());
- }
- }
- return buffer.toString();
- }
-
- public static Map<String, String> toLabelsMap(String labels) {
- Map<String, String> map = new HashMap<>();
- if (labels != null && !labels.isEmpty()) {
- String[] elements = labels.split(",");
- if (elements.length > 0) {
- for (String str : elements) {
- String[] keyValue = str.split("=");
- if (keyValue.length == 2) {
- String key = keyValue[0];
- String value = keyValue[1];
- if (key != null && value != null) {
- map.put(key.trim(), value.trim());
- }
- }
- }
- }
- }
- return map;
- }
-
- /**
- * Creates a filter on a pod using the given text string
- */
- public static Filter<Pod> createPodFilter(final String textFilter) {
- if (isNullOrBlank(textFilter)) {
- return Filters.<Pod>trueFilter();
- } else {
- return new Filter<Pod>() {
- public String toString() {
- return "PodFilter(" + textFilter + ")";
- }
-
- public boolean matches(Pod entity) {
- return filterMatchesIdOrLabels(textFilter, getName(entity), entity.getMetadata().getLabels());
- }
- };
- }
- }
-
- /**
- * Creates a filter on a pod using the given set of labels
- */
- public static Filter<Pod> createPodFilter(final Map<String, String> labelSelector) {
- if (labelSelector == null || labelSelector.isEmpty()) {
- return Filters.<Pod>trueFilter();
- } else {
- return new Filter<Pod>() {
- public String toString() {
- return "PodFilter(" + labelSelector + ")";
- }
-
- public boolean matches(Pod entity) {
- return filterLabels(labelSelector, entity.getMetadata().getLabels());
- }
- };
- }
- }
-
- /**
- * Creates a filter on a pod annotations using the given set of attribute values
- */
- public static Filter<Pod> createPodAnnotationFilter(final Map<String, String> annotationSelector) {
- if (annotationSelector == null || annotationSelector.isEmpty()) {
- return Filters.<Pod>trueFilter();
- } else {
- return new Filter<Pod>() {
- public String toString() {
- return "PodAnnotationFilter(" + annotationSelector + ")";
- }
-
- public boolean matches(Pod entity) {
- return filterLabels(annotationSelector, entity.getMetadata().getAnnotations());
- }
- };
- }
- }
-
- /**
- * Creates a filter on a service using the given text string
- */
- public static Filter<Service> createServiceFilter(final String textFilter) {
- if (isNullOrBlank(textFilter)) {
- return Filters.<Service>trueFilter();
- } else {
- return new Filter<Service>() {
- public String toString() {
- return "ServiceFilter(" + textFilter + ")";
- }
-
- public boolean matches(Service entity) {
- return filterMatchesIdOrLabels(textFilter, getName(entity), entity.getMetadata().getLabels());
- }
- };
- }
- }
-
- /**
- * Creates a filter on a service if it matches the given namespace
- */
- public static Filter<Service> createNamespaceServiceFilter(final String namespace) {
- if (isNullOrBlank(namespace)) {
- return Filters.<Service>trueFilter();
- } else {
- return new Filter<Service>() {
- public String toString() {
- return "NamespaceServiceFilter(" + namespace + ")";
- }
-
- public boolean matches(Service entity) {
- return Objects.equal(namespace, getNamespace(entity.getMetadata()));
- }
- };
- }
- }
-
- /**
- * Creates a filter on a service using the given text string
- */
- public static Filter<Service> createServiceFilter(final Map<String, String> labelSelector) {
- if (labelSelector == null || labelSelector.isEmpty()) {
- return Filters.<Service>trueFilter();
- } else {
- return new Filter<Service>() {
- public String toString() {
- return "ServiceFilter(" + labelSelector + ")";
- }
-
- public boolean matches(Service entity) {
- return filterLabels(labelSelector, entity.getMetadata().getLabels());
- }
- };
- }
- }
-
- /**
- * Creates a filter on a replicationController using the given text string
- */
- public static Filter<ReplicationController> createReplicationControllerFilter(final String textFilter) {
- if (isNullOrBlank(textFilter)) {
- return Filters.<ReplicationController>trueFilter();
- } else {
- return new Filter<ReplicationController>() {
- public String toString() {
- return "ReplicationControllerFilter(" + textFilter + ")";
- }
-
- public boolean matches(ReplicationController entity) {
- return filterMatchesIdOrLabels(textFilter, getName(entity), entity.getMetadata().getLabels());
- }
- };
- }
- }
-
- /**
- * Creates a filter on a replicationController using the given text string
- */
- public static Filter<ReplicationController> createReplicationControllerFilter(final Map<String, String> labelSelector) {
- if (labelSelector == null || labelSelector.isEmpty()) {
- return Filters.<ReplicationController>trueFilter();
- } else {
- return new Filter<ReplicationController>() {
- public String toString() {
- return "ReplicationControllerFilter(" + labelSelector + ")";
- }
-
- public boolean matches(ReplicationController entity) {
- return filterLabels(labelSelector, entity.getMetadata().getLabels());
- }
- };
- }
- }
-
- /**
- * Returns true if the given textFilter matches either the id or the labels
- */
- public static boolean filterMatchesIdOrLabels(String textFilter, String id, Map<String, String> labels) {
- String text = toLabelsString(labels);
- boolean result = (text != null && text.contains(textFilter)) || (id != null && id.contains(textFilter));
- if (!result) {
- //labels can be in different order to selector
- Map<String, String> selectorMap = toLabelsMap(textFilter);
-
- if (!selectorMap.isEmpty() && labels != null && !labels.isEmpty()) {
- result = true;
- for (Map.Entry<String, String> entry : selectorMap.entrySet()) {
- String value = labels.get(entry.getKey());
- if (value == null || !value.matches(entry.getValue())) {
- result = false;
- break;
- }
- }
- }
- }
- return result;
- }
-
- /**
- * Returns true if the given filterLabels matches the actual labels
- */
- public static boolean filterLabels(Map<String, String> filterLabels, Map<String, String> labels) {
- if (labels == null) {
- return false;
- }
- Set<Map.Entry<String, String>> entries = filterLabels.entrySet();
- for (Map.Entry<String, String> entry : entries) {
- String key = entry.getKey();
- String expectedValue = entry.getValue();
- String actualValue = labels.get(key);
- if (!Objects.equal(expectedValue, actualValue)) {
- return false;
- }
- }
- return true;
- }
-
-
- /**
- * For positive non-zero values return the text of the number or return blank
- */
- public static String toPositiveNonZeroText(Integer port) {
- if (port != null) {
- int value = port;
- if (value > 0) {
- return "" + value;
- }
- }
- return "";
- }
-
- /**
- * Returns all the containers from the given pod
- */
- @SuppressWarnings("unchecked")
- public static List<Container> getContainers(Pod pod) {
- if (pod != null) {
- PodSpec podSpec = pod.getSpec();
- return getContainers(podSpec);
-
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * Returns all the containers from the given Replication Controller
- */
- @SuppressWarnings("unchecked")
- public static List<Container> getContainers(ReplicationController replicationController) {
- if (replicationController != null) {
- ReplicationControllerSpec replicationControllerSpec = replicationController.getSpec();
- return getContainers(replicationControllerSpec);
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * Returns all the containers from the given Replication Controller's replicationControllerSpec
- */
- @SuppressWarnings("unchecked")
- public static List<Container> getContainers(ReplicationControllerSpec replicationControllerSpec) {
- if (replicationControllerSpec != null) {
- PodTemplateSpec podTemplateSpec = replicationControllerSpec.getTemplate();
- return getContainers(podTemplateSpec);
- }
- return Collections.EMPTY_LIST;
- }
-
- @SuppressWarnings("unchecked")
- public static List<Container> getContainers(PodSpec podSpec) {
- if (podSpec != null) {
- return podSpec.getContainers();
- }
- return Collections.EMPTY_LIST;
- }
-
- @SuppressWarnings("unchecked")
- public static List<Container> getContainers(PodTemplateSpec podTemplateSpec) {
- if (podTemplateSpec != null) {
- return getContainers(podTemplateSpec.getSpec());
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * Returns all the containers from the given Replication Controller
- */
- @SuppressWarnings("unchecked")
- public static List<Container> getCurrentContainers(ReplicationController replicationController) {
- if (replicationController != null) {
- // TODO
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * Returns all the current containers from the given currentState
- */
- @SuppressWarnings("unchecked")
- public static Map<String, ContainerStatus> getCurrentContainers(Pod pod) {
- if (pod != null) {
- PodStatus currentStatus = pod.getStatus();
- return getCurrentContainers(currentStatus);
-
- }
- return Collections.EMPTY_MAP;
- }
-
- /**
- * Returns all the current containers from the given podStatus
- */
- @SuppressWarnings("unchecked")
- public static Map<String, ContainerStatus> getCurrentContainers(PodStatus podStatus) {
- if (podStatus != null) {
- List<ContainerStatus> containerStatuses = podStatus.getContainerStatuses();
- Map<String, ContainerStatus> info = new Hashtable<>(containerStatuses.size());
- for (ContainerStatus status : containerStatuses) {
- info.put(status.getContainerID(), status);
- }
- return info;
- }
- return Collections.EMPTY_MAP;
- }
-
- /**
- * Returns the host of the pod
- */
- public static String getHost(Pod pod) {
- if (pod != null) {
- PodStatus currentState = pod.getStatus();
- if (currentState != null) {
- return currentState.getHostIP();
- }
- }
- return null;
- }
-
- /**
- * Returns the container port number for the given service
- */
- @SuppressWarnings("unchecked")
- public static Set<Integer> getContainerPorts(Service service) {
- Set<Integer> answer = Collections.EMPTY_SET;
- String id = getName(service);
- ServiceSpec spec = service.getSpec();
- if (spec != null) {
- List<ServicePort> servicePorts = spec.getPorts();
- Objects.notNull(servicePorts, "servicePorts for service " + id);
-
- answer = new HashSet<>(servicePorts.size());
- String message = "service " + id;
-
- for (ServicePort port : servicePorts) {
- IntOrString intOrStringValue = port.getTargetPort();
- Integer intValue = intOrStringToInteger(intOrStringValue, message);
- if (intValue != null) {
- answer.add(intValue);
- }
- }
- }
- return answer;
- }
-
- /**
- * Returns the IntOrString converted to an Integer value or throws an exception with the given message
- */
- public static Integer intOrStringToInteger(IntOrString intOrStringValue, String message) {
- Integer intValue = intOrStringValue.getIntVal();
- if (intValue == null) {
- String containerPortText = intOrStringValue.getStrVal();
- if (Strings.isNullOrBlank(containerPortText)) {
- throw new IllegalArgumentException("No port for " +
- message);
- }
- try {
- intValue = Integer.parseInt(containerPortText);
- } catch (NumberFormatException e) {
- throw new IllegalStateException("Invalid servicePorts expression " + containerPortText + " for " +
- message + ". " + e, e);
- }
- }
- return intValue;
- }
-
- /**
- * Returns the container port number for the given service
- */
- @SuppressWarnings("unchecked")
- public static Set<String> getContainerPortsStrings(Service service) {
- Set<String> answer = Collections.EMPTY_SET;
- String id = getName(service);
- ServiceSpec spec = service.getSpec();
- if (spec != null) {
- List<ServicePort> servicePorts = spec.getPorts();
- Objects.notNull(servicePorts, "servicePorts for service " + id);
-
- answer = new HashSet<>(servicePorts.size());
-
- for (ServicePort port : servicePorts) {
- IntOrString intOrStringValue = port.getTargetPort();
- Integer intValue = intOrStringValue.getIntVal();
- if (intValue != null) {
- answer.add(intValue.toString());
- } else {
- String containerPortText = intOrStringValue.getStrVal();
- if (Strings.isNullOrBlank(containerPortText)) {
- throw new IllegalArgumentException("No servicePorts for service " + id);
- }
- answer.add(containerPortText);
- }
- }
- }
- return answer;
- }
-
- /**
- * Combines the JSON objects into a config object
- */
- public static Object combineJson(Object... objects) throws IOException {
- KubernetesList list = findOrCreateList(objects);
- List<HasMetadata> items = list.getItems();
- if (items == null) {
- items = new ArrayList<>();
- list.setItems(items);
- }
- for (Object object : objects) {
- if (object != list) {
- addObjectsToItemArray(items, object);
- }
- }
- moveServicesToFrontOfArray(items);
- removeDuplicates(items);
- Object answer = Templates.combineTemplates(list, items);
- items = toItemList(answer);
- removeDuplicates(items);
- return answer;
- }
-
- /**
- * Lets move all Service resources before any other to avoid ordering issues creating things
- */
- public static void moveServicesToFrontOfArray(List<HasMetadata> list) {
- int size = list.size();
- int lastNonService = -1;
- for (int i = 0; i < size; i++) {
- HasMetadata item = list.get(i);
- if (item instanceof Service) {
- if (lastNonService >= 0) {
- HasMetadata nonService = list.get(lastNonService);
- list.set(i, nonService);
- list.set(lastNonService, item);
- lastNonService++;
- }
- } else if (lastNonService < 0) {
- lastNonService = i;
- }
- }
- }
-
- /**
- * Remove any duplicate resources using the kind and id
- */
- protected static void removeDuplicates(List<HasMetadata> itemArray) {
- int size = itemArray.size();
- int lastNonService = -1;
- Set<String> keys = new HashSet<>();
- for (int i = 0; i < size; i++) {
- HasMetadata item = itemArray.get(i);
- if (item == null) {
- itemArray.remove(i);
- i--;
- size--;
- } else {
- String id = getObjectId(item);
- String kind = item.getClass().getSimpleName();
- if (Strings.isNotBlank(id)) {
- String key = kind + ":" + id;
- if (!keys.add(key)) {
- // lets remove this one
- itemArray.remove(i);
- i--;
- size--;
- }
- }
-
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- protected static void addObjectsToItemArray(List destinationList, Object object) throws IOException {
- if (object instanceof KubernetesList) {
- KubernetesList kubernetesList = (KubernetesList) object;
- List<HasMetadata> items = kubernetesList.getItems();
- if (items != null) {
- destinationList.addAll(items);
- }
- } else if (object instanceof Collection) {
- Collection collection = (Collection) object;
- destinationList.addAll(collection);
- } else {
- destinationList.add(object);
- }
- }
-
- protected static KubernetesList findOrCreateList(Object[] objects) {
- KubernetesList list = null;
- for (Object object : objects) {
- if (object instanceof KubernetesList) {
- list = (KubernetesList) object;
- break;
- }
- }
- if (list == null) {
- list = new KubernetesList();
- }
- return list;
- }
-
- /**
- * Returns the URL to access the service; using the service portalIP and port
- */
- public static String getServiceURL(Service service) {
- if (service != null) {
- ServiceSpec spec = service.getSpec();
- if (spec != null) {
- String portalIP = spec.getPortalIP();
- if (portalIP != null) {
- Integer port = spec.getPorts().iterator().next().getPort();
- if (port != null && port > 0) {
- portalIP += ":" + port;
- }
- String protocol = "http://";
- if (KubernetesHelper.isServiceSsl(spec.getPortalIP(), port, Boolean.valueOf(System.getenv(KubernetesFactory.KUBERNETES_TRUST_ALL_CERIFICATES)))) {
- protocol = "https://";
- }
- return protocol + portalIP;
- }
- }
- }
- return null;
- }
-
- public static String serviceToHost(String id) {
- return Systems.getEnvVarOrSystemProperty(toEnvVariable(id + HOST_SUFFIX), "");
- }
-
- public static String serviceToPort(String id) {
- return Systems.getEnvVarOrSystemProperty(toEnvVariable(id + PORT_SUFFIX), "");
- }
-
- public static String serviceToProtocol(String id, String servicePort) {
- return Systems.getEnvVarOrSystemProperty(toEnvVariable(id + PORT_SUFFIX + "_" + servicePort + PROTO_SUFFIX), DEFAULT_PROTO);
- }
-
- public static String toEnvVariable(String str) {
- return str.toUpperCase().replaceAll("-", "_");
- }
-
- /**
- * Returns the port for the given port number on the pod
- */
- public static ContainerPort findContainerPort(Pod pod, Integer portNumber) {
- List<Container> containers = KubernetesHelper.getContainers(pod);
- for (Container container : containers) {
- List<ContainerPort> ports = container.getPorts();
- for (ContainerPort port : ports) {
- if (Objects.equal(portNumber, port.getContainerPort())) {
- return port;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the port for the given port name
- */
- public static ContainerPort findContainerPortByName(Pod pod, String name) {
- List<Container> containers = KubernetesHelper.getContainers(pod);
- for (Container container : containers) {
- List<ContainerPort> ports = container.getPorts();
- for (ContainerPort port : ports) {
- if (Objects.equal(name, port.getName())) {
- return port;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the port for the given port number or name
- */
- public static ContainerPort findContainerPortByNumberOrName(Pod pod, String numberOrName) {
- Integer portNumber = toOptionalNumber(numberOrName);
- if (portNumber != null) {
- return findContainerPort(pod, portNumber);
- } else {
- return findContainerPortByName(pod, numberOrName);
- }
- }
-
- /**
- * Returns the number if it can be parsed or null
- */
- protected static Integer toOptionalNumber(String text) {
- if (Strings.isNotBlank(text)) {
- try {
- return Integer.parseInt(text);
- } catch (NumberFormatException e) {
- // ignore parse errors
- }
- }
- return null;
- }
-
- public static PodStatusType getPodStatus(Pod pod) {
- String text = getPodStatusText(pod);
- if (Strings.isNotBlank(text)) {
- text = text.toLowerCase();
- if (text.startsWith("run")) {
- return PodStatusType.OK;
- } else if (text.startsWith("wait")) {
- return PodStatusType.WAIT;
- } else {
- return PodStatusType.ERROR;
- }
- }
- return PodStatusType.WAIT;
- }
-
- /**
- * Returns true if the pod is running
- */
- public static boolean isPodRunning(Pod pod) {
- PodStatusType status = getPodStatus(pod);
- return Objects.equal(status, PodStatusType.OK);
- }
-
- public static String getPodStatusText(Pod pod) {
- if (pod != null) {
- PodStatus podStatus = pod.getStatus();
- if (podStatus != null) {
- return podStatus.getPhase();
- }
- }
- return null;
- }
-
- /**
- * Returns the pods for the given replication controller
- */
- @SuppressWarnings("unchecked")
- public static List<Pod> getPodsForReplicationController(ReplicationController replicationController, Iterable<Pod> pods) {
- ReplicationControllerSpec replicationControllerSpec = replicationController.getSpec();
- if (replicationControllerSpec == null) {
- LOG.warn("Cannot instantiate replication controller: " + getName(replicationController) + " due to missing ReplicationController.Spec!");
- } else {
- Map<String, String> replicaSelector = replicationControllerSpec.getSelector();
- Filter<Pod> podFilter = KubernetesHelper.createPodFilter(replicaSelector);
- return Filters.filter(pods, podFilter);
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * Returns the pods for the given service
- */
- public static List<Pod> getPodsForService(Service service, Iterable<Pod> pods) {
- Map<String, String> selector = getSelector(service);
- Filter<Pod> podFilter = KubernetesHelper.createPodFilter(selector);
- return Filters.filter(pods, podFilter);
- }
-
- /**
- * Looks up the service endpoints in DNS.
- *
- * Endpoints are registered as SRV records in DNS so this method returns
- * endpoints in the format "host:port". This is a list as SRV records are ordered
- * by priority & weight before being returned to the client.
- *
- * See https://github.com/GoogleCloudPlatform/kubernetes/blob/master/cluster/addons/dns/README.md
- */
- public static List<String> lookupServiceEndpointsInDns(String serviceName) throws IllegalArgumentException, UnknownHostException {
- try {
- Lookup l = new Lookup(serviceName, Type.SRV);
- Record[] records = l.run();
- if (l.getResult() == Lookup.SUCCESSFUL) {
-
- SRVRecord[] srvRecords = Arrays.copyOf(records, records.length, SRVRecord[].class);
- Arrays.sort(srvRecords, new Comparator<SRVRecord>() {
- @Override
- public int compare(SRVRecord a, SRVRecord b) {
- int ret = Integer.compare(b.getPriority(), a.getPriority());
- if (ret == 0) {
- ret = Integer.compare(b.getWeight(), a.getWeight());
- }
- return ret;
- }
- });
-
- List<String> endpointAddresses = new ArrayList<>(srvRecords.length);
- for (SRVRecord srvRecord : srvRecords) {
- endpointAddresses.add(srvRecord.getTarget().toString(true).concat(":").concat(String.valueOf(srvRecord.getPort())));
- }
- return endpointAddresses;
- } else {
- LOG.warn("Lookup {} result: {}", serviceName, l.getErrorString());
- }
- } catch (TextParseException e) {
- LOG.error("Unparseable service name: {}", serviceName, e);
- } catch (ClassCastException e) {
- LOG.error("Invalid response from DNS server - should have been A records", e);
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * Looks up the service in DNS.
- * If this is a headless service, this call returns the endpoint IPs from DNS.
- * If this is a non-headless service, this call returns the service IP only.
- * <p/>
- * See https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/services.md#headless-services
- */
- public static Set<String> lookupServiceInDns(String serviceName) throws IllegalArgumentException, UnknownHostException {
- try {
- Lookup l = new Lookup(serviceName);
- Record[] records = l.run();
- if (l.getResult() == Lookup.SUCCESSFUL) {
- Set<String> endpointAddresses = new HashSet<>(records.length);
- for (int i = 0; i < records.length; i++) {
- ARecord aRecord = (ARecord) records[i];
- endpointAddresses.add(aRecord.getAddress().getHostAddress());
- }
- return endpointAddresses;
- } else {
- LOG.warn("Lookup {} result: {}", serviceName, l.getErrorString());
- }
- } catch (TextParseException e) {
- LOG.error("Unparseable service name: {}", serviceName, e);
- } catch (ClassCastException e) {
- LOG.error("Invalid response from DNS server - should have been A records", e);
- }
- return Collections.EMPTY_SET;
- }
-
- public static boolean isServiceSsl(String host, int port, boolean trustAllCerts) {
- try {
- SSLSocketFactory sslsocketfactory;
- if (trustAllCerts) {
- sslsocketfactory = TrustEverythingSSLTrustManager.getTrustingSSLSocketFactory();
- } else {
- sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
- }
-
- Socket socket = sslsocketfactory.createSocket();
-
- // Connect, with an explicit timeout value
- socket.connect(new InetSocketAddress(host, port), 1 * 1000);
- try {
-
- InputStream in = socket.getInputStream();
- OutputStream out = socket.getOutputStream();
-
- // Write a test byte to get a reaction :)
- out.write(1);
-
- while (in.available() > 0) {
- System.out.print(in.read());
- }
-
- return true;
- } finally {
- socket.close();
- }
- } catch (SSLHandshakeException e) {
- LOG.error("SSL handshake failed - this probably means that you need to trust the kubernetes root SSL certificate or set the environment variable " + KubernetesFactory.KUBERNETES_TRUST_ALL_CERIFICATES, e);
- } catch (SSLProtocolException e) {
- LOG.error("SSL protocol error", e);
- } catch (SSLKeyException e) {
- LOG.error("Bad SSL key", e);
- } catch (SSLPeerUnverifiedException e) {
- LOG.error("Could not verify server", e);
- } catch (SSLException e) {
- LOG.debug("Address does not appear to be SSL-enabled - falling back to http", e);
- } catch (IOException e) {
- LOG.debug("Failed to validate service", e);
- }
- return false;
- }
-
- /**
- * Validates that the given value is valid according to the kubernetes ID parsing rules, throwing an exception if not.
- */
- public static String validateKubernetesId(String currentValue, String description) throws IllegalArgumentException {
- if (isNullOrBlank(currentValue)) {
- throw new IllegalArgumentException("No " + description + " is specified!");
- }
- int size = currentValue.length();
- for (int i = 0; i < size; i++) {
- char ch = currentValue.charAt(i);
- if (Character.isUpperCase(ch)) {
- throw new IllegalArgumentException("Invalid upper case letter '" + ch + "' at index " + i + " for " + description + " value: " + currentValue);
- }
- }
- return currentValue;
- }
-
- public static Date parseDate(String text) {
- try {
- return dateTimeFormat.parse(text);
- } catch (ParseException e) {
- LOG.warn("Failed to parse date: " + text + ". Reason: " + e);
- return null;
- }
- }
-
- /**
- * Returns a short summary text message for the given kubernetes resource
- */
- public static String summaryText(Object object) {
- if (object instanceof Route) {
- return summaryText((Route) object);
- } else if (object instanceof Service) {
- return summaryText((Service) object);
- } else if (object instanceof ReplicationController) {
- return summaryText((ReplicationController) object);
- } else if (object instanceof Pod) {
- return summaryText((Pod) object);
- } else if (object instanceof Template) {
- return summaryText((Template) object);
- } else if (object instanceof DeploymentConfig) {
- return summaryText((DeploymentConfig) object);
- } else if (object instanceof OAuthClient) {
- return summaryText((OAuthClient) object);
- } else if (object instanceof String) {
- return object.toString();
- }
- return "";
- }
-
- /**
- * Returns a short summary text message for the given kubernetes resource
- */
- public static String summaryText(Route entity) {
- RouteSpec spec = entity.getSpec();
- if (spec == null) {
- return "No spec!";
- }
- return "host: " + spec.getHost();
- }
-
- /**
- * Returns a short summary text message for the given kubernetes resource
- */
- public static String summaryText(ContainerState entity) {
- ContainerStateRunning running = entity.getRunning();
- if (running != null) {
- return "Running";
- }
- ContainerStateWaiting waiting = entity.getWaiting();
- if (waiting != null) {
- return "Waiting";
- }
- ContainerStateTerminated termination = entity.getTermination();
- if (termination != null) {
- return "Terminated";
- }
- return "Unknown";
- }
-
- /**
- * Returns a short summary text message for the given kubernetes resource
- */
- public static String summaryText(Template entity) {
- StringBuilder buffer = new StringBuilder();
- List<Parameter> parameters = entity.getParameters();
- if (parameters != null) {
- for (Parameter parameter : parameters) {
- String name = parameter.getName();
- appendText(buffer, name);
- }
- }
- return "parameters: " + buffer;
- }
-
- /**
- * Returns a short summary text message for the given kubernetes resource
- */
- public static String summaryText(OAuthClient entity) {
- return "redirectURIs: " + entity.getRedirectURIs();
- }
-
- /**
- * Returns a short summary text message for the given kubernetes resource
- */
- public static String summaryText(Service entity) {
- StringBuilder portText = new StringBuilder();
- ServiceSpec spec = entity.getSpec();
- if (spec == null) {
- return "No spec";
- } else {
- List<ServicePort> ports = spec.getPorts();
- if (ports != null) {
- for (ServicePort port : ports) {
- Integer number = port.getPort();
- if (number != null) {
- if (portText.length() > 0) {
- portText.append(", ");
- }
- portText.append("").append(number);
- }
- }
-
- }
- return "selector: " + spec.getSelector() + " ports: " + portText;
- }
- }
-
- /**
- * Returns a short summary text message for the given kubernetes resource
- */
- public static String summaryText(ReplicationController entity) {
- StringBuilder buffer = new StringBuilder();
- ReplicationControllerSpec spec = entity.getSpec();
- if (spec != null) {
- buffer.append("replicas: ").append(spec.getReplicas());
- PodTemplateSpec podTemplateSpec = spec.getTemplate();
- if (podTemplateSpec != null) {
- appendSummaryText(buffer, podTemplateSpec);
- }
- }
- return buffer.toString();
- }
-
- /**
- * Returns a short summary text message for the given kubernetes resource
- */
- public static String summaryText(DeploymentConfig entity) {
- StringBuilder buffer = new StringBuilder();
- DeploymentConfigSpec spec = entity.getSpec();
- if (spec != null) {
- buffer.append("replicas: " + spec.getReplicas());
- PodTemplateSpec podTemplateSpec = spec.getTemplate();
- if (podTemplateSpec != null) {
- appendSummaryText(buffer, podTemplateSpec);
- }
- }
- return buffer.toString();
- }
-
- /**
- * Returns a short summary text message for the given kubernetes resource
- */
- public static String summaryText(Pod entity) {
- StringBuilder buffer = new StringBuilder();
- PodSpec podSpec = entity.getSpec();
- appendSummaryText(buffer, podSpec);
- return buffer.toString();
- }
-
- protected static void appendSummaryText(StringBuilder buffer, PodTemplateSpec podTemplateSpec) {
- if (podTemplateSpec != null) {
- appendSummaryText(buffer, podTemplateSpec.getSpec());
- }
- }
-
- protected static void appendSummaryText(StringBuilder buffer, PodSpec podSpec) {
- if (podSpec != null) {
- List<Container> containers = podSpec.getContainers();
- if (containers != null) {
- for (Container container : containers) {
- String image = container.getImage();
- appendText(buffer, "image: " + image);
- }
- }
- }
- }
-
- protected static void appendText(StringBuilder buffer, String text) {
- if (buffer.length() > 0) {
- buffer.append(", ");
- }
- buffer.append(text);
- }
-
- /**
- * Creates an IntOrString from the given string which could be a number or a name
- */
- public static IntOrString createIntOrString(int intVal) {
- IntOrString answer = new IntOrString();
- answer.setIntVal(intVal);
- answer.setKind(INTORSTRING_KIND_INT);
- return answer;
- }
-
- /**
- * Creates an IntOrString from the given string which could be a number or a name
- */
- public static IntOrString createIntOrString(String nameOrNumber) {
- if (isNullOrBlank(nameOrNumber)) {
- return null;
- } else {
- IntOrString answer = new IntOrString();
- Integer intVal = null;
- try {
- intVal = Integer.parseInt(nameOrNumber);
- } catch (Exception e) {
- // ignore invalid number
- }
- if (intVal != null) {
- answer.setIntVal(intVal);
- answer.setKind(INTORSTRING_KIND_INT);
- } else {
- answer.setStrVal(nameOrNumber);
- answer.setKind(INTORSTRING_KIND_STRING);
- }
- return answer;
- }
- }
-
- public static String getStatusText(PodStatus podStatus) {
- String status;
- List<String> statusList = new ArrayList<>();
- List<ContainerStatus> containerStatuses = podStatus.getContainerStatuses();
- for (ContainerStatus containerStatus : containerStatuses) {
- ContainerState state = containerStatus.getState();
- String statusText = summaryText(state);
- if (statusText != null) {
- statusList.add(statusText);
- }
- }
- if (statusList.size() == 1) {
- status = statusList.get(0);
- } else {
- status = statusList.toString();
- }
- return status;
- }
-
- public static Secret validateSecretExists(KubernetesClient kubernetes, String namespace, String secretName) {
- Secret secret = null;
- try {
- secret = kubernetes.getSecret(secretName, namespace);
- } catch (WebApplicationException e) {
- if (e.getResponse().getStatus() == 404) {
- // does not exist
- } else {
- throw e;
- }
- }
- if (secret == null) {
- throw new IllegalArgumentException("No secret named: " + secretName +
- " for namespace " + namespace + " is available on Kubernetes at address " + kubernetes.getAddress() +
- ". For how to create secrets see: http://fabric8.io/guide/fabric8OnOpenShift.html#requirements ");
- } else {
- return secret;
- }
- }
-
- /**
- * Converts the DTO loaded from JSON to a {@link KubernetesList} assuming its not a {@link Template}
- */
- public static KubernetesList asKubernetesList(Object dto) throws IOException {
- if (dto instanceof KubernetesList) {
- return (KubernetesList) dto;
- } else {
- KubernetesList answer = new KubernetesList();
- List<HasMetadata> items = toItemList(dto);
- answer.setItems(items);
- return answer;
- }
- }
-
-}
\ 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/PodStatusType.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/PodStatusType.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/PodStatusType.java
deleted file mode 100644
index 19a1bd7..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/PodStatusType.java
+++ /dev/null
@@ -1,25 +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;
-
-/**
- * Represents the status of the pod
- */
-public enum PodStatusType {
- WAIT, OK, ERROR
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/ServiceNames.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/ServiceNames.java b/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/ServiceNames.java
deleted file mode 100644
index e453153..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/java/io/fabric8/kubernetes/api/ServiceNames.java
+++ /dev/null
@@ -1,58 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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;
-
-/**
- * Defines some standard service names for common services in fabric8
- */
-public class ServiceNames {
-
- // Management
- //-------------------------------------------------------------------------
-
- /**
- * The fabric8 console
- */
- public static final String FABRIC8_CONSOLE = "fabric8";
-
- public static final String ELASTICSEARCH = "elasticsearch";
- public static final String KIBANA = "kibana";
- public static final String INFLUXDB = "influxdb";
- public static final String GRAFANA = "grafana";
-
- public static final String KEYCLOAK = "keycloak";
-
- // Continuous Delivery
- //-------------------------------------------------------------------------
- public static final String GOGS = "fabric8";
- public static final String JENKINS = "jenkins";
- public static final String NEXUS = "nexus";
- public static final String GERRIT = "gerrit";
- public static final String SONARQUBE = "sonarqube";
-
- /**
- * used for jBPM workflows with CD
- */
- public static final String CDELIVERY_API = "cdelivery";
-
- // Social
- //-------------------------------------------------------------------------
-
- public static final String HUBOT = "hubot";
- public static final String LETSCHAT = "letschat";
- public static final String TAIGA = "taiga";
-}
[10/12] stratos git commit: Removing additional maven property
fabric8-version and reusing kubernetes.api.version
Posted by ga...@apache.org.
Removing additional maven property fabric8-version and reusing kubernetes.api.version
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/247b4504
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/247b4504
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/247b4504
Branch: refs/heads/tenant-isolation
Commit: 247b450424cd1452e4ab7ee499f2369ab5742867
Parents: 12c0ea0
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sun Jul 26 05:51:56 2015 +0530
Committer: gayangunarathne <ga...@wso2.com>
Committed: Thu Aug 27 16:43:12 2015 +0530
----------------------------------------------------------------------
dependencies/fabric8/kubernetes-api/pom.xml | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/247b4504/dependencies/fabric8/kubernetes-api/pom.xml
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/pom.xml b/dependencies/fabric8/kubernetes-api/pom.xml
index feec23b..1ecf13e 100644
--- a/dependencies/fabric8/kubernetes-api/pom.xml
+++ b/dependencies/fabric8/kubernetes-api/pom.xml
@@ -46,7 +46,7 @@
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>cxf-utils</artifactId>
- <version>${fabric8-version}</version>
+ <version>${kubernetes.api.version}</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
@@ -125,7 +125,7 @@
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-codegen</artifactId>
- <version>${fabric8-version}</version>
+ <version>${kubernetes.api.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -177,8 +177,4 @@
</plugin>
</plugins>
</build>
-
- <properties>
- <fabric8-version>2.2.16</fabric8-version>
- </properties>
</project>
[04/12] stratos git commit: Upgrading fabric8 kubernetes api version
to 2.2.16 and removing forked code
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/resources/log4j.properties b/dependencies/fabric8/kubernetes-api/src/main/resources/log4j.properties
deleted file mode 100644
index 393e087..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-# Root logger option
-log4j.rootLogger=INFO, stdout
-
-# Direct log messages to stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Apply.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Apply.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Apply.java
deleted file mode 100644
index 4f19fb7..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Apply.java
+++ /dev/null
@@ -1,48 +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 java.io.File;
-
-/**
- * Applies the given JSON file to the kubernetes environment
- */
-public class Apply {
- public static void main(String... args) {
- if (args.length < 1) {
- System.out.println("Usage jsonFileToApply");
- return;
- }
- try {
- KubernetesClient kube = new KubernetesClient();
- System.out.println("Connecting to kubernetes on: " + kube.getAddress());
-
- File file = new File(args[0]);
- System.out.println("Applying file: " + file);
- if (!file.exists() || !file.isFile()) {
- System.out.println("File does not exist! " + file.getAbsolutePath());
- return;
- }
- Controller controller = new Controller(kube);
- String answer = controller.apply(file);
-
- System.out.println("Applied!: " + answer);
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- e.printStackTrace();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigComparePodTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigComparePodTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigComparePodTest.java
deleted file mode 100644
index 80ae51a..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigComparePodTest.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.Pod;
-import io.fabric8.kubernetes.api.model.PodBuilder;
-import io.fabric8.kubernetes.api.model.PodStatus;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static io.fabric8.kubernetes.api.ConfigCompareServiceTest.assertCompareConfig;
-
-public class ConfigComparePodTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ConfigComparePodTest.class);
-
- @Test
- public void testPodsEqual() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
-
- @Test
- public void testPodsEqualWithDifferentStatus() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- PodStatus status2 = new PodStatus();
- status2.setHostIP("abc");
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- withStatus(status2).
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
-
- @Test
- public void testPodsLabelsNotEqual() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "notSame").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testPodsAnnotationsNotEqual() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "notSame").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testPodsImageEqual() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("notSame").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
- @Test
- public void testPodsContainerEnvEqual() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("notSame").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareReplicationControllerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareReplicationControllerTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareReplicationControllerTest.java
deleted file mode 100644
index 24ef845..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareReplicationControllerTest.java
+++ /dev/null
@@ -1,530 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.ReplicationController;
-import io.fabric8.kubernetes.api.model.ReplicationControllerBuilder;
-import io.fabric8.kubernetes.api.model.ReplicationControllerStatus;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static io.fabric8.kubernetes.api.ConfigCompareServiceTest.assertCompareConfig;
-
-public class ConfigCompareReplicationControllerTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ConfigCompareReplicationControllerTest.class);
-
- @Test
- public void testReplicationControllersEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
-
- @Test
- public void testReplicationControllersEqualWithDifferentStatus() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationControllerStatus status = new ReplicationControllerStatus();
- status.setReplicas(7);
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- withStatus(status).
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
-
- @Test
- public void testReplicationControllersLabelsNotEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("notSame", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersSelectorNotEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "notSame").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersReplicasNotEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(4).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersAnnotationsNotEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "notEqual").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersImageEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("notEqual").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersContainerEnvEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("notEqual").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersAddVolumeNotEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewVolumeMount().withName("cheese").withMountPath("/foo/cheese").endVolumeMount().
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareServiceTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareServiceTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareServiceTest.java
deleted file mode 100644
index 1c90d3d..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareServiceTest.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.Service;
-import io.fabric8.kubernetes.api.model.ServiceBuilder;
-import io.fabric8.kubernetes.api.model.util.IntOrString;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.junit.Assert.assertEquals;
-
-public class ConfigCompareServiceTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ConfigCompareServiceTest.class);
-
- @Test
- public void testServicesEqual() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("label1", "value1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
- @Test
-
- public void testServicesEqualWithStatusdifferences() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- withResourceVersion("1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("label1", "value1").
- withResourceVersion("2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
-
- @Test
- public void testServicesPortNotEqual() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("label1", "value1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(456).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testServicesContainerPortNotEqual() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("label1", "value1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(555)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testServicesLabelsNotEqual() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("notSame", "value1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testServicesSelectorNotEqual() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("label1", "value1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("notSame", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- public static void assertCompareConfig(Object entity1, Object entity2, boolean expected) {
- boolean actual = UserConfigurationCompare.configEqual(entity1, entity2);
- assertEquals("Configuration compare for " + entity1 + " and " + entity2, expected, actual);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigFileParseTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigFileParseTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigFileParseTest.java
deleted file mode 100644
index 07aa012..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigFileParseTest.java
+++ /dev/null
@@ -1,58 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.config.Config;
-import io.fabric8.kubernetes.api.extensions.Configs;
-import io.fabric8.kubernetes.api.model.config.Context;
-import org.junit.Test;
-
-import java.io.File;
-
-import static io.fabric8.kubernetes.api.extensions.Configs.getOpenShiftConfigFile;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ConfigFileParseTest {
- @Test
- public void testParseConfig() throws Exception {
- FindOpenShiftNamespaceTest.setOPenShfitConfigFileProperty();
-
- File file = getOpenShiftConfigFile();
- assertThat(file).isFile().exists();
-
- Config config = Configs.parseConfigs();
- assertThat(config).isNotNull();
-
- String currentContextName = config.getCurrentContext();
- assertThat(currentContextName).describedAs("currentContext").isEqualTo("default/localhost:8443/admin");
- System.out.println("Found current context name: " + currentContextName);
-
- Context context = Configs.getCurrentContext(config);
- assertThat(context).describedAs("currentContext").isNotNull();
-
- assertThat(context.getNamespace()).describedAs("namespace").isEqualTo("jimmi-does-rock");
- assertThat(context.getUser()).describedAs("user").isEqualTo("admin/localhost:8443");
- assertThat(context.getCluster()).describedAs("cluster").isEqualTo("172-28-128-4:8443");
-
- String token = Configs.getUserToken(config, context);
- assertThat(token).describedAs("token").isEqualTo("ExpectedToken");
-
- System.out.println("User " + context.getUser() + " has token: " + token);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Example.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Example.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Example.java
deleted file mode 100644
index 56cbaaa..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Example.java
+++ /dev/null
@@ -1,134 +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.*;
-
-import java.util.*;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.getPorts;
-import static io.fabric8.kubernetes.api.KubernetesHelper.getSelector;
-
-/**
- * A simple example program testing out the REST API
- */
-public class Example {
- public static void main(String... args) {
- KubernetesFactory kubeFactory = new KubernetesFactory();
- if (args.length > 0) {
- kubeFactory.setAddress(args[0]);
- }
- System.out.println("Connecting to kubernetes on: " + kubeFactory.getAddress());
-
- try {
- Kubernetes kube = kubeFactory.createKubernetes();
- listPods(kube);
- listServices(kube);
- listReplicationControllers(kube);
- createPod(kube, kubeFactory);
- listPods(kube);
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- e.printStackTrace();
- }
- }
-
- protected static void createPod(Kubernetes kubernetes, KubernetesFactory kubernetesFactory) throws Exception {
- String name = "console2";
- String image = "fabric8/hawtio";
-
- Pod pod = new Pod();
- pod.getMetadata().setName(name);
-
- Map<String, String> labels = new HashMap<>();
- labels.put("fabric8", "true");
- labels.put("container", name);
-
- pod.getMetadata().setLabels(labels);
- PodSpec podSpec = new PodSpec();
- pod.setSpec(podSpec);
-
- Container manifestContainer = new Container();
- manifestContainer.setName(name);
- manifestContainer.setImage(image);
-
- List<Container> containers = new ArrayList<>();
- containers.add(manifestContainer);
- podSpec.setContainers(containers);
-
- System.out.println("About to create pod on " + kubernetesFactory.getAddress() + " with " + pod);
- kubernetes.createPod(pod, "mynamespace");
- System.out.println("Created pod: " + name);
- System.out.println();
- }
-
- protected static void listPods(Kubernetes kube) {
- System.out.println("Looking up pods");
- PodList pods = kube.getPods(Kubernetes.NAMESPACE_ALL);
- //System.out.println("Got pods: " + pods);
- List<Pod> items = pods.getItems();
- for (Pod item : items) {
- System.out.println("Pod " + KubernetesHelper.getName(item) + " created: " + item.getMetadata().getCreationTimestamp());
- PodSpec spec = item.getSpec();
- if (spec != null) {
- List<Container> containers = spec.getContainers();
- if (containers != null) {
- for (Container container : containers) {
- System.out.println("Container " + container.getImage() + " " + container.getCommand() + " ports: " + container.getPorts());
- }
- }
- }
- Map<String, ContainerStatus> currentContainers = KubernetesHelper.getCurrentContainers(item);
- System.out.println("Has " + currentContainers.size() + " container(s)");
- Set<Map.Entry<String, ContainerStatus>> entries = currentContainers.entrySet();
- for (Map.Entry<String, ContainerStatus> entry : entries) {
- String id = entry.getKey();
- ContainerStatus info = entry.getValue();
- System.out.println("Current container: " + id + " info: " + info);
- }
- }
- System.out.println();
-
- }
-
- protected static void listServices(Kubernetes kube) {
- System.out.println("Looking up services");
- ServiceList services = kube.getServices(Kubernetes.NAMESPACE_ALL);
- List<Service> serviceItems = services.getItems();
- for (Service service : serviceItems) {
- System.out.println("Service " + KubernetesHelper.getName(service) + " labels: " + service.getMetadata().getLabels() + " selector: " + getSelector(service) + " ports: " + getPorts(service));
- }
- System.out.println();
-
- }
-
- protected static void listReplicationControllers(Kubernetes kube) {
- System.out.println("Looking up replicationControllers");
- ReplicationControllerList replicationControllers = kube.getReplicationControllers(Kubernetes.NAMESPACE_ALL);
- List<ReplicationController> items = replicationControllers.getItems();
- for (ReplicationController item : items) {
- ReplicationControllerSpec replicationControllerSpec = item.getSpec();
- if (replicationControllerSpec != null) {
- System.out.println("ReplicationController " + KubernetesHelper.getName(item) + " labels: " + item.getMetadata().getLabels()
- + " replicas: " + replicationControllerSpec.getReplicas() + " replicatorSelector: " + replicationControllerSpec.getSelector() + " podTemplate: " + replicationControllerSpec.getTemplate());
- } else {
- System.out.println("ReplicationController " + KubernetesHelper.getName(item) + " labels: " + item.getMetadata().getLabels() + " no replicationControllerSpec");
- }
- }
- System.out.println();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/FindOpenShiftNamespaceTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/FindOpenShiftNamespaceTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/FindOpenShiftNamespaceTest.java
deleted file mode 100644
index 28abff8..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/FindOpenShiftNamespaceTest.java
+++ /dev/null
@@ -1,41 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.extensions.Configs;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class FindOpenShiftNamespaceTest {
-
- @Test
- public void testFindsCorrectOpenShiftNamespace() throws Exception {
- setOPenShfitConfigFileProperty();
- String namespace = KubernetesClient.findDefaultOpenShiftNamespace();
-
- assertEquals("default namespace", "jimmi-does-rock", namespace);
- }
-
- public static void setOPenShfitConfigFileProperty() {
- String basedir = System.getProperty("basedir", ".");
- String configFile = basedir + "/src/test/resources/config.yml";
-
- System.setProperty(Configs.OPENSHIFT_CONFIG_FILE_PROPERTY, configFile);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/KubernetesHelperTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/KubernetesHelperTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/KubernetesHelperTest.java
deleted file mode 100644
index 4a23a8b..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/KubernetesHelperTest.java
+++ /dev/null
@@ -1,71 +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.ObjectMeta;
-import io.fabric8.kubernetes.api.model.Pod;
-import io.fabric8.kubernetes.api.model.PodList;
-import org.junit.Test;
-
-import java.util.HashMap;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-
-public class KubernetesHelperTest {
-
- @Test
- public void testRemoveEmptyPods() throws Exception {
-
- Pod pod1 = new Pod();
- pod1.setMetadata(new ObjectMeta());
- pod1.getMetadata().setName("test1");
-
- Pod pod2 = new Pod();
- pod2.setMetadata(new ObjectMeta());
-
- PodList podSchema = new PodList();
- podSchema.getItems().add(pod1);
- podSchema.getItems().add(pod2);
-
- KubernetesHelper.removeEmptyPods(podSchema);
-
- assertNotNull(podSchema);
- assertEquals(1, podSchema.getItems().size());
- }
-
- @Test
- public void testfilterMatchesIdOrLabels() throws Exception {
- String text = "container=java,name=foo,food=cheese";
- String id = "foo";
- HashMap<String, String> map = new HashMap<>();
- map.put("container", "java");
- map.put("name", "foo");
- map.put("food", "cheese");
- assertTrue(text + " should = " + map, KubernetesHelper.filterMatchesIdOrLabels(text, id, map));
- }
-
- @Test
- public void testfilterMatchesIdOrLabelsNoLabels() throws Exception {
- String text = "container=java,name=foo,food=cheese";
- String id = "foo";
- HashMap<String, String> map = null;
- assertFalse(text + " should not = " + map, KubernetesHelper.filterMatchesIdOrLabels(text, id, map));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseDateTimeTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseDateTimeTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseDateTimeTest.java
deleted file mode 100644
index b0207bf..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseDateTimeTest.java
+++ /dev/null
@@ -1,36 +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 org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Date;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ParseDateTimeTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ParseDateTimeTest.class);
-
- @Test
- public void testParseDateTime() throws Exception {
- Date date = KubernetesHelper.parseDate("2015-03-26T17:11:55Z");
- assertThat(date).isNotNull();
- System.out.println("Parsed date: " + date);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseExamplesTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseExamplesTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseExamplesTest.java
deleted file mode 100644
index b963c0e..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseExamplesTest.java
+++ /dev/null
@@ -1,128 +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.databind.ObjectMapper;
-import io.fabric8.kubernetes.api.model.*;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.List;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.getContainerPorts;
-import static io.fabric8.utils.Files.assertDirectoryExists;
-import static io.fabric8.utils.Files.assertFileExists;
-import static org.junit.Assert.*;
-
-/**
- * Parses the example JSON
- */
-public class ParseExamplesTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ParseExamplesTest.class);
-
- public static final String SYSTEM_PROPERTY_KUBE_DIR = "kube.dir";
-
- @Test
- public void testParsePodList() throws Exception {
- KubernetesList podList = assertParseExampleFile("pod-list.json", KubernetesList.class);
- List<HasMetadata> items = podList.getItems();
- assertNotEmpty("items", items);
-
- Pod pod = (Pod) items.get(0);
- assertNotNull("pod1", pod);
- assertEquals("pod1.name", "my-pod-1", KubernetesHelper.getName(pod));
- PodSpec podSpec = pod.getSpec();
- assertNotNull("pod1.podSpec", podSpec);
- List<Container> containers = podSpec.getContainers();
- assertNotEmpty("pod1.podSpec.containers", containers);
- Container container = containers.get(0);
- assertNotNull("pod1.podSpec.container[0]", container);
- assertEquals("pod1.podSpec.container[0].name", "nginx", container.getName());
- assertEquals("pod1.podSpec.container[0].image", "dockerfile/nginx", container.getImage());
-
- LOG.info("pod1 container1 " + container);
-
- String json = KubernetesHelper.toJson(podList);
- LOG.info("Got JSON: " + json);
- }
-
- @Test
- public void testParsePodListEmptyResults() throws Exception {
- PodList podList = assertParseExampleFile("pod-list-empty-results.json", PodList.class);
- List<Pod> items = podList.getItems();
- assertNotEmpty("items", items);
-
- Pod pod = items.get(0);
- assertNotNull("pod1", pod);
- assertEquals("127.0.0.1", pod.getStatus().getHostIP());
- }
-
- @Test
- public void testParseService() throws Exception {
- Service service = assertParseExampleFile("service.json", Service.class);
-
- assertEquals("Service", service.getKind());
-
- Integer expectedPort = 9090;
- assertEquals(expectedPort, getContainerPorts(service).iterator().next());
-
- ObjectMapper mapper = KubernetesFactory.createObjectMapper();
-
- //mapper.writer().writeValue(System.out, service);
- }
-
- @Test
- public void testParsePod() throws Exception {
- assertParseExampleFile("pod.json", Pod.class);
- }
-
- public static void assertNotEmpty(String name, Collection collection) {
- assertNotNull(name + " is null!", collection);
- assertFalse(name + " should not be empty!", collection.isEmpty());
- }
-
- public static <T> T assertParseExampleFile(String fileName, Class<T> clazz) throws Exception {
- ObjectMapper mapper = KubernetesFactory.createObjectMapper();
- File exampleFile = new File(getKubernetesExamplesDir(), fileName);
- assertFileExists(exampleFile);
- T answer = mapper.reader(clazz).readValue(exampleFile);
- assertNotNull("Null returned while unmarshalling " + exampleFile, answer);
- LOG.info("Parsed: " + fileName + " as: " + answer);
- return answer;
- }
-
- public static File getKubernetesSourceDir() {
- //String path = System.getProperty(SYSTEM_PROPERTY_KUBE_DIR, "../../../kubernetes");
- String basedir = System.getProperty("basedir", ".");
- String kubeSourceDir = basedir + "/src/main/kubernetes";
- String path = System.getProperty(SYSTEM_PROPERTY_KUBE_DIR, kubeSourceDir);
- File kubeDir = new File(path);
- assertTrue("Kube directory " + kubeDir
- + " does not exist! Please supply the correct value in the " + SYSTEM_PROPERTY_KUBE_DIR + " system property value",
- kubeDir.exists());
- return kubeDir;
- }
-
- public static File getKubernetesExamplesDir() {
- File answer = new File(getKubernetesSourceDir(), "api/examples");
- assertDirectoryExists(answer);
- return answer;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseServiceTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseServiceTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseServiceTest.java
deleted file mode 100644
index 96b99b4..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseServiceTest.java
+++ /dev/null
@@ -1,65 +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.Service;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Set;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.getContainerPorts;
-import static io.fabric8.kubernetes.api.KubernetesHelper.getPorts;
-import static io.fabric8.utils.Files.assertFileExists;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Parses the example JSON
- */
-public class ParseServiceTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ParseServiceTest.class);
-
- @Test
- public void testParseFabric8MQService() throws Exception {
- Service service = assertParseTestFile("fmq-service.json", Service.class);
- Set<Integer> ports = getPorts(service);
- assertNotNull("ports", ports);
- Set<Integer> containerPorts = getContainerPorts(service);
- assertTrue("containerPorts " + containerPorts, containerPorts.iterator().next().intValue() > 0);
-
- String json = KubernetesHelper.toJson(service);
- LOG.info("Got JSON: " + json);
- }
-
- public <T> T assertParseTestFile(String relativePath, Class<T> clazz) throws IOException {
- String baseDirPath = System.getProperty("basedir", ".");
- File baseDir = new File(baseDirPath);
- File json = new File(baseDirPath, "target/test-classes/" + relativePath);
- assertFileExists(json);
-
- Object answer = KubernetesHelper.loadJson(json);
- assertNotNull("Null returned while unmarshalling " + json, answer);
- LOG.info("Parsed: " + json + " as: " + answer);
- assertTrue("Result " + answer + " is not an instance of " + clazz.getName() + " but was " + (answer == null ? "null" : answer.getClass().getName()),
- clazz.isInstance(answer));
- return clazz.cast(answer);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseTest.java
deleted file mode 100644
index 7df3ffc..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseTest.java
+++ /dev/null
@@ -1,157 +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.databind.ObjectMapper;
-import io.fabric8.kubernetes.api.model.*;
-import io.fabric8.openshift.api.model.template.Template;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.util.List;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.getContainerPorts;
-import static io.fabric8.kubernetes.api.KubernetesHelper.toJson;
-import static io.fabric8.kubernetes.api.ParseExamplesTest.assertNotEmpty;
-import static io.fabric8.utils.Files.assertDirectoryExists;
-import static io.fabric8.utils.Files.assertFileExists;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.*;
-
-/**
- * Parses the example JSON
- */
-public class ParseTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ParseTest.class);
-
- public static final String SYSTEM_PROPERTY_KUBE_DIR = "kube.dir";
-
- @Test
- public void testParsePodList() throws Exception {
- KubernetesList podList = assertParseExampleFile("pod-list.json", KubernetesList.class);
- List<HasMetadata> items = podList.getItems();
- assertNotEmpty("items", items);
-
- Pod pod = (Pod) items.get(0);
- assertNotNull("pod1", pod);
- assertEquals("pod1.id", "my-pod-1", KubernetesHelper.getName(pod));
- PodSpec podSpec = pod.getSpec();
- assertNotNull("pod1.podSpec", podSpec);
- List<Container> containers = podSpec.getContainers();
- assertNotEmpty("pod1.podSpec.manifest.containers", containers);
- Container container = containers.get(0);
- assertNotNull("pod1.podSpec.container[0]", container);
- assertEquals("pod1.podSpec.container[0].name", "nginx", container.getName());
- assertEquals("pod1.podSpec.container[0].image", "dockerfile/nginx", container.getImage());
-
- LOG.info("pod1 container1 " + container);
-
- String json = toJson(podList);
- LOG.info("Got JSON: " + json);
- }
-
- @Test
- public void testParsePodListEmptyResults() throws Exception {
- PodList podList = assertParseExampleFile("pod-list-empty-results.json", PodList.class);
- List<Pod> items = podList.getItems();
- assertNotEmpty("items", items);
-
- Pod pod = items.get(0);
- assertNotNull("pod1", pod);
- assertEquals("127.0.0.1", pod.getStatus().getHostIP());
- }
-
- @Test
- public void testParseService() throws Exception {
- Service service = assertParseExampleFile("service.json", Service.class);
-
- assertEquals("Service", service.getKind());
-
- Integer expectedPort = 9090;
- assertEquals(expectedPort, getContainerPorts(service).iterator().next());
-
- ObjectMapper mapper = KubernetesFactory.createObjectMapper();
-
- //mapper.writer().writeValue(System.out, service);
- }
-
- @Test
- public void testParsePod() throws Exception {
- assertParseExampleFile("pod.json", Pod.class);
- }
-
- @Test
- public void testParseTemplate() throws Exception {
- Template template = assertParseExampleFile("template.json", Template.class);
- List<HasMetadata> objects = template.getObjects();
- assertNotEmpty("objects", objects);
- assertTrue("size is " + objects.size(), objects.size() == 2);
- Object service = objects.get(0);
- assertThat(service).isInstanceOf(Service.class);
-
- Object rc = objects.get(1);
- assertThat(rc).isInstanceOf(ReplicationController.class);
-
- System.out.println("Generated JSON: " + toJson(template));
- }
-
- @Test
- public void testParseList() throws Exception {
- KubernetesList list = assertParseExampleFile("list.json", KubernetesList.class);
- List<HasMetadata> objects = list.getItems();
- assertNotEmpty("objects", objects);
- assertEquals("size", 2, objects.size());
- Object service = objects.get(0);
- assertThat(service).isInstanceOf(Service.class);
-
- Object rc = objects.get(1);
- assertThat(rc).isInstanceOf(ReplicationController.class);
-
- System.out.println("Generated JSON: " + toJson(list));
- }
-
- public static <T> T assertParseExampleFile(String fileName, Class<T> clazz) throws Exception {
- ObjectMapper mapper = KubernetesFactory.createObjectMapper();
- File exampleFile = new File(getKubernetesExamplesDir(), fileName);
- assertFileExists(exampleFile);
- Object answer = mapper.reader(clazz).readValue(exampleFile);
- assertNotNull("Null returned while unmarshalling " + exampleFile, answer);
- LOG.info("Parsed: " + fileName + " as: " + answer);
- assertTrue("Is not an instance of " + clazz.getSimpleName() + " was: "+ answer.getClass().getName(), clazz.isInstance(answer));
- return clazz.cast(answer);
- }
-
- public static File getKubernetesSourceDir() {
- //String path = System.getProperty(SYSTEM_PROPERTY_KUBE_DIR, "../../../kubernetes");
- String basedir = System.getProperty("basedir", ".");
- String kubeSourceDir = basedir + "/src/main/kubernetes";
- String path = System.getProperty(SYSTEM_PROPERTY_KUBE_DIR, kubeSourceDir);
- File kubeDir = new File(path);
- assertTrue("Kube directory " + kubeDir
- + " does not exist! Please supply the correct value in the " + SYSTEM_PROPERTY_KUBE_DIR + " system property value",
- kubeDir.exists());
- return kubeDir;
- }
-
- public static File getKubernetesExamplesDir() {
- File answer = new File(getKubernetesSourceDir(), "api/examples");
- assertDirectoryExists(answer);
- return answer;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/PodIdToReplicationControllerIDExample.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/PodIdToReplicationControllerIDExample.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/PodIdToReplicationControllerIDExample.java
deleted file mode 100644
index 45a1d61..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/PodIdToReplicationControllerIDExample.java
+++ /dev/null
@@ -1,42 +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;
-
-import io.fabric8.kubernetes.api.model.ReplicationController;
-
-/**
- */
-public class PodIdToReplicationControllerIDExample {
- public static void main(String[] args) {
- if (args.length < 2) {
- System.out.println("Arguments: kuberneteMasterUrl podID");
- return;
- }
- String kuberneteMasterUrl = args[0];
- String podID = args[1];
- System.out.println("Looking up ReplicationController for pod ID: " + podID);
- KubernetesClient client = new KubernetesClient(kuberneteMasterUrl);
- ReplicationController replicationController = client.getReplicationControllerForPod(podID);
- if (replicationController != null) {
- String id = KubernetesHelper.getName(replicationController);
- System.out.println("Found replication controller: " + id);
- } else {
- System.out.println("Could not find replication controller!");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ProcessTemplateLocallyTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ProcessTemplateLocallyTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ProcessTemplateLocallyTest.java
deleted file mode 100644
index 18c0044..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ProcessTemplateLocallyTest.java
+++ /dev/null
@@ -1,54 +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.extensions.Templates;
-import io.fabric8.kubernetes.api.model.HasMetadata;
-import io.fabric8.kubernetes.api.model.KubernetesList;
-import io.fabric8.openshift.api.model.template.Template;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.toJson;
-import static io.fabric8.kubernetes.api.ParseExamplesTest.assertNotEmpty;
-import static io.fabric8.kubernetes.api.ParseTest.assertParseExampleFile;
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Parses the example JSON
- */
-public class ProcessTemplateLocallyTest {
- private static final transient Logger LOG = LoggerFactory.getLogger(ProcessTemplateLocallyTest.class);
-
- @Test
- public void testProcessTemplateLocally() throws Exception {
- Template template = assertParseExampleFile("template.json", Template.class);
- List<HasMetadata> objects = template.getObjects();
- assertNotEmpty("objects", objects);
-
-
- KubernetesList list = Templates.processTemplatesLocally(template);
- assertThat(list).describedAs("results").isNotNull();
- List<HasMetadata> items = list.getItems();
- assertThat(items).describedAs("items").isNotNull();
-
- System.out.println("Created JSON: " + toJson(list));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TemplatesTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TemplatesTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TemplatesTest.java
deleted file mode 100644
index 8dc8c19..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TemplatesTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.extensions.Templates;
-import io.fabric8.kubernetes.api.model.KubernetesList;
-import io.fabric8.kubernetes.api.model.KubernetesListBuilder;
-import io.fabric8.kubernetes.api.model.Service;
-import io.fabric8.kubernetes.api.model.ServiceBuilder;
-import io.fabric8.openshift.api.model.template.Template;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class TemplatesTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(TemplatesTest.class);
-
- @Test
- public void testCombineResourcesIntoTemplate() throws Exception {
- Service templateService = new ServiceBuilder().withNewMetadata().withName("templateService").endMetadata().build();
-
- KubernetesList list = new KubernetesListBuilder().
- addNewServiceItem().withNewMetadata().withName("service1").endMetadata().endServiceItem().
- addNewTemplateItem().
- addNewParameter().withName("PARAM1").withValue("ABC").endParameter().
- addToObjects(templateService).endTemplateItem().
- addNewServiceItem().withNewMetadata().withName("service2").endMetadata().endServiceItem().build();
-
- Object result = Templates.combineTemplates(list);
- System.out.println("Combined as " + KubernetesHelper.toJson(result));
- assertThat(result).isInstanceOf(Template.class);
-
- }
-}