Updating kubernetes service creation logic to set public IPs and remove host port
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/4862fb9d Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/4862fb9d Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/4862fb9d Branch: refs/heads/master Commit: 4862fb9d60fc9134b98a40a9954560d1c5aa9cf3 Parents: ea6b692 Author: Imesh Gunaratne <[email protected]> Authored: Fri Feb 27 15:33:30 2015 +0530 Committer: Imesh Gunaratne <[email protected]> Committed: Fri Feb 27 15:34:11 2015 +0530 ---------------------------------------------------------------------- .../context/CloudControllerContext.java | 8 +- .../cloud/controller/domain/MemberContext.java | 3 +- .../iaases/kubernetes/KubernetesIaas.java | 41 +- .../README.md | 64 +- .../kubernetes/client/KubernetesApiClient.java | 24 +- .../KubernetesAPIClientInterface.java | 23 +- .../live/KubernetesApiClientLiveTest.java | 269 +-- .../src/main/resources/AutoscalerService.wsdl | 110 +- .../main/resources/CloudControllerService.wsdl | 1975 +++++++++--------- 9 files changed, 1298 insertions(+), 1219 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/4862fb9d/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java index 078c9cf..3a02a1d 100644 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java +++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java @@ -453,8 +453,12 @@ public class CloudControllerContext implements Serializable { public void addKubernetesClusterContext(KubernetesClusterContext kubernetesClusterContext) { kubClusterIdToKubClusterContextMap.put( - kubernetesClusterContext.getKubernetesClusterId(), - kubernetesClusterContext); + kubernetesClusterContext.getKubernetesClusterId(), kubernetesClusterContext); + } + + public void updateKubernetesClusterContext(KubernetesClusterContext kubernetesClusterContext) { + kubClusterIdToKubClusterContextMap.put( + kubernetesClusterContext.getKubernetesClusterId(), kubernetesClusterContext); } /** http://git-wip-us.apache.org/repos/asf/stratos/blob/4862fb9d/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/MemberContext.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/MemberContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/MemberContext.java index b7a3843..d1fe070 100644 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/MemberContext.java +++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/MemberContext.java @@ -24,7 +24,6 @@ import org.apache.stratos.common.domain.NameValuePair; import java.io.Serializable; import java.util.Arrays; -import java.util.List; /** * Holds information about a Member. @@ -271,7 +270,7 @@ public class MemberContext implements Serializable { return kubernetesPodId; } - public void setKubernetesPodName(String kubernetesPodName) { + public void setKubernetesPodLabel(String kubernetesPodName) { this.kubernetesPodName = kubernetesPodName; } http://git-wip-us.apache.org/repos/asf/stratos/blob/4862fb9d/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 7ea0f4a..47e620c 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 @@ -207,12 +207,12 @@ public class KubernetesIaas extends Iaas { // Generate kubernetes service ports and update port mappings in cartridge updateKubernetesServicePorts(kubClusterContext, clusterContext.getClusterId(), cartridge); - // Create pod + // Create kubernetes services for port mappings KubernetesApiClient kubernetesApi = kubClusterContext.getKubApi(); - createPod(clusterContext, memberContext, kubernetesApi); + createKubernetesServices(kubernetesApi, clusterContext, kubernetesCluster); - // Create kubernetes services for port mappings - createKubernetesServices(kubernetesApi, clusterContext, kubClusterContext); + // Create pod + createPod(clusterContext, memberContext, kubernetesApi); // Wait for pod status to be changed to running Pod pod = waitForPodToBeActivated(memberContext, kubernetesApi); @@ -344,6 +344,7 @@ public class KubernetesIaas extends Iaas { String applicationId = memberContext.getApplicationId(); String cartridgeType = memberContext.getCartridgeType(); + String clusterId = memberContext.getClusterId(); String memberId = memberContext.getMemberId(); if (log.isInfoEnabled()) { @@ -379,17 +380,17 @@ public class KubernetesIaas extends Iaas { // Create pod String podId = KubernetesIaasUtil.fixSpecialCharacters(memberId); - String podName = podId; + String podLabel = KubernetesIaasUtil.fixSpecialCharacters(clusterId); String dockerImage = iaasProvider.getImage(); EnvironmentVariable[] environmentVariables = KubernetesIaasUtil.prepareEnvironmentVariables( clusterContext, memberContext); - kubernetesApi.createPod(podId, podName, dockerImage, + kubernetesApi.createPod(podId, podLabel, dockerImage, KubernetesIaasUtil.convertPortMappings(cartridge.getPortMappings()), environmentVariables); // Add pod id to member context and persist memberContext.setKubernetesPodId(podId); - memberContext.setKubernetesPodName(podName); + memberContext.setKubernetesPodLabel(podLabel); CloudControllerContext.getInstance().persist(); if (log.isInfoEnabled()) { @@ -404,11 +405,11 @@ public class KubernetesIaas extends Iaas { * * @param kubernetesApi * @param clusterContext - * @param kubernetesClusterContext + * @param kubernetesCluster * @throws KubernetesClientException */ private void createKubernetesServices(KubernetesApiClient kubernetesApi, ClusterContext clusterContext, - KubernetesClusterContext kubernetesClusterContext) throws KubernetesClientException { + KubernetesCluster kubernetesCluster) throws KubernetesClientException { String clusterId = clusterContext.getClusterId(); String cartridgeType = clusterContext.getCartridgeType(); @@ -426,6 +427,22 @@ public class KubernetesIaas extends Iaas { kubernetesServices = new ArrayList<KubernetesService>(); } + // Prepare minion public IP addresses + List<String> minionPublicIPs = new ArrayList<String>(); + KubernetesHost[] kubernetesHosts = kubernetesCluster.getKubernetesHosts(); + if((kubernetesHosts == null) || (kubernetesHosts.length == 0) || (kubernetesHosts[0] == null)) { + throw new RuntimeException("Hosts not found in kubernetes cluster: [cluster] " + + kubernetesCluster.getClusterId()); + } + for(KubernetesHost host : kubernetesHosts) { + if(host != null) { + minionPublicIPs.add(host.getPublicIPAddress()); + } + } + if(log.isDebugEnabled()) { + log.debug(String.format("Minion public IPs: %s", minionPublicIPs)); + } + int i = kubernetesServices.size(); for (PortMapping portMapping : cartridge.getPortMappings()) { @@ -437,7 +454,7 @@ public class KubernetesIaas extends Iaas { // Service id = cluster id + kubernetes service seq number of cluster String serviceId = KubernetesIaasUtil.fixSpecialCharacters(clusterId + "-" + (++i)); - String serviceName = serviceId; + String serviceLabel = KubernetesIaasUtil.fixSpecialCharacters(clusterId); if (log.isInfoEnabled()) { log.info(String.format("Creating kubernetes service: [cluster] %s [service] %s " + @@ -449,7 +466,8 @@ public class KubernetesIaas extends Iaas { // Create kubernetes service for port mapping int servicePort = portMapping.getKubernetesServicePort(); String containerPortName = KubernetesIaasUtil.preparePortNameFromPortMapping(portMapping); - kubernetesApi.createService(serviceId, serviceName, servicePort, containerPortName); + kubernetesApi.createService(serviceId, serviceLabel, servicePort, containerPortName, + minionPublicIPs.toArray(new String[minionPublicIPs.size()])); try { Thread.sleep(1000); @@ -510,6 +528,7 @@ public class KubernetesIaas extends Iaas { } if(servicePortsUpdated) { // Persist service ports added to port mappings + CloudControllerContext.getInstance().updateKubernetesClusterContext(kubernetesClusterContext); CloudControllerContext.getInstance().persist(); } } http://git-wip-us.apache.org/repos/asf/stratos/blob/4862fb9d/components/org.apache.stratos.kubernetes.client/README.md ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.kubernetes.client/README.md b/components/org.apache.stratos.kubernetes.client/README.md index 61d69a5..dc345e8 100644 --- a/components/org.apache.stratos.kubernetes.client/README.md +++ b/components/org.apache.stratos.kubernetes.client/README.md @@ -1,24 +1,64 @@ -Running Live Tests -================== +Kubernetes API Client Live Tests +================================ + +Kubernetes API client supports running live tests against a Kubernetes cluster. Following parameters are needed to run the tests. + +Parameters +---------- +###kubernetes.api.endpoint +The Kubernetes API endpoint URL, default value: http://172.17.8.101:8080/api/v1beta1 + +###minion.public.ips +The list of public IP addresses of minions in the Kubernetes cluster, default value: 172.17.8.101 + +###docker.image +The name of the docker image to be used by the test, default value: fnichol/uhttpd + +###container.port +A port exposed by the docker image to test Kubernetes services, default value: 6379 + +###test.pod.activation +A boolean property to enable or disable pod activation test, default value: true + +###test.service.socket +A boolean property to enable or disable service socket test, default value: true -Google Kubernetes Java Client component supports running live tests against a Kubernetes API server. Pre-requisites ============== -* Set up a Kubernetes Master node and make sure the API server is running.Please refer to Stratos documentation as to how you could build a setup. Say your Kubernetes API endpoint is ```http://192.168.1.100:8080/api/v1beta1/``` -* Please pull a preferred docker image into the Master node. Say your preferred docker image is ```gurpartap/redis```. +* Setup a Kubernetes cluster with at least one minion. +* Login to the minion host and pull the preferred docker image. How to run the tests ==================== -* Navigate into the folder where you have cloned Stratos. -* Navigate to the Kubernetes Client component; +* Clone Stratos source code: + + ``` + git clone https://git-wip-us.apache.org/repos/asf/stratos.git + ``` + +* Navigate to the Kubernetes API client component: + + ``` + cd <stratos-source-home>/components/org.apache.stratos.kubernetes.client + ``` + +* Run the live tests with proper parameter values: - ```cd components/org.apache.stratos.kubernetes.client``` -* Run the live test profile; + ### Run with default values: + ``` + mvn clean test -Plive + ``` - ```mvn clean install -Plive -Dkubernetes.api.endpoint=http://192.168.1.100:8080/api/v1beta1/ -Ddocker.image=gurpartap/redis -dcontainer.port=8080``` + ### Run with custom values: + ``` + mvn clean test -Plive -Dkubernetes.api.endpoint="http://192.168.1.101:8080/api/v1beta1/" \ + -Dminion.public.ips="192.168.1.102" + -Ddocker.image="gurpartap/redis" \ + -Dcontainer.port=6379 \ + -Dtest.pod.activation="true" \ + -Dtest.service.socket="true" + ``` - -NOTE: Please note that these are the default values and if your setup is equivalent to this, you can simply run ```mvn clean install -Plive``` http://git-wip-us.apache.org/repos/asf/stratos/blob/4862fb9d/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 dcaa871..f8f7c63 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 @@ -51,19 +51,19 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface { /** * Create new pod * @param podId Identifier of the pod - * @param podName Pod name to be used by the pod label + * @param podLabel Pod name to be used by the pod label * @param dockerImage Docker image to be used by the pod * @param ports Ports exposed by the pod * @param environmentVariables Environment variables to be passed to the pod * @throws KubernetesClientException */ @Override - public void createPod(String podId, String podName, String dockerImage, List<Port> ports, + public void createPod(String podId, String podLabel, String dockerImage, List<Port> ports, EnvironmentVariable[] environmentVariables) throws KubernetesClientException { if (log.isDebugEnabled()) { log.debug(String.format("Creating kubernetes pod: [pod-id] %s [pod-name] %s [docker-image] %s [ports] %s", - podId, podName, dockerImage, ports)); + podId, podLabel, dockerImage, ports)); } // Create pod definition @@ -74,7 +74,7 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface { // Set pod labels Labels podLabels = new Labels(); - podLabels.setName(podName); + podLabels.setName(podLabel); pod.setLabels(podLabels); State desiredState = new State(); @@ -84,7 +84,7 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface { // Set container template Container containerTemplate = new Container(); - containerTemplate.setName(podName); + containerTemplate.setName(podLabel); containerTemplate.setImage(dockerImage); containerTemplate.setPorts(ports); containerTemplate.setImagePullPolicy(KubernetesConstants.POLICY_PULL_IF_NOT_PRESENT); @@ -501,19 +501,19 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface { /** * Create kubernetes service * @param serviceId Service id - * @param serviceName Service name to be used by the label name + * @param serviceLabel Service name to be used by the label name * @param servicePort Port to be exposed by the service * @param containerPortName Container port name defined in the port label * @param publicIPs * @throws KubernetesClientException */ @Override - public void createService(String serviceId, String serviceName, int servicePort, + public void createService(String serviceId, String serviceLabel, int servicePort, String containerPortName, String[] publicIPs) 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, serviceName, servicePort, + "[container-port-name] %s", serviceId, serviceLabel, servicePort, containerPortName)); } @@ -528,9 +528,9 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface { // Set service labels Labels serviceLabels = new Labels(); - serviceLabels.setName(serviceName); + serviceLabels.setName(serviceLabel); service.setLabels(serviceLabels); - service.setName(serviceName); + service.setName(serviceLabel); // Set service selector Selector selector = new Selector(); @@ -542,11 +542,11 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface { 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, serviceName, servicePort, containerPortName)); + "[container-port-name] %s", serviceId, serviceLabel, servicePort, containerPortName)); } } 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, serviceName, servicePort, containerPortName); + "[container-port-name] %s", serviceId, serviceLabel, servicePort, containerPortName); log.error(message, e); throw new KubernetesClientException(message, e); } http://git-wip-us.apache.org/repos/asf/stratos/blob/4862fb9d/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 4b20cf4..80d4b52 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 @@ -31,12 +31,12 @@ public interface KubernetesAPIClientInterface { /** * Create pod. * @param podId - * @param podName + * @param podLabel * @param dockerImage * @param ports * @throws KubernetesClientException */ - public void createPod(String podId, String podName, String dockerImage, List<Port> ports, + public void createPod(String podId, String podLabel, String dockerImage, List<Port> ports, EnvironmentVariable[] environmentVariables) throws KubernetesClientException; @@ -80,11 +80,11 @@ public interface KubernetesAPIClientInterface { * @throws KubernetesClientException */ public void createReplicationController(String replicationControllerId, - String replicationControllerName, - String dockerImage, - List<Port> ports, - EnvironmentVariable[] environmentVariables, - int replicas) throws KubernetesClientException; + String replicationControllerName, + String dockerImage, + List<Port> ports, + EnvironmentVariable[] environmentVariables, + int replicas) throws KubernetesClientException; /** * Get a Replication Controller Info @@ -118,13 +118,14 @@ public interface KubernetesAPIClientInterface { /** * Create service. * @param serviceId - * @param serviceName + * @param serviceLabel * @param servicePort * @param containerPortName - * @throws KubernetesClientException + * @param publicIPs + * @throws KubernetesClientException */ - public void createService(String serviceId, String serviceName, int servicePort, - String containerPortName) throws KubernetesClientException; + public void createService(String serviceId, String serviceLabel, int servicePort, + String containerPortName, String[] publicIPs) throws KubernetesClientException; /** * Get the Service with the given id. http://git-wip-us.apache.org/repos/asf/stratos/blob/4862fb9d/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/KubernetesApiClientLiveTest.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/KubernetesApiClientLiveTest.java b/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/KubernetesApiClientLiveTest.java index 2d48724..a7fa5ad 100644 --- a/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/KubernetesApiClientLiveTest.java +++ b/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/KubernetesApiClientLiveTest.java @@ -35,8 +35,8 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; +import java.io.IOException; import java.net.Socket; -import java.net.URL; import java.util.ArrayList; import java.util.List; @@ -45,70 +45,93 @@ import java.util.List; * Please ssh into the kubernetes custer and pull the docker image before running * the live tests. Otherwise tests would fail when running for the first time on a fresh * kubernetes cluster. - * + * <p/> * Caution! * At the end of the tests it will remove all the replication controllers, pods and services * available in the given kubernetes environment. */ @Category(org.apache.stratos.kubernetes.client.LiveTests.class) -public class KubernetesApiClientLiveTest extends TestCase{ +public class KubernetesApiClientLiveTest extends TestCase { private static final Log log = LogFactory.getLog(KubernetesApiClientLiveTest.class); - private static final int DEFAULT_CONTAINER_PORT = 6379; //80; - private static final int SERVICE_PORT = 4500; - private static final String DEFAULT_KUBERNETES_MASTER_IP = "172.17.8.100"; + private static final String DEFAULT_KUBERNETES_MASTER_IP = "172.17.8.101"; private static final int KUBERNETES_API_PORT = 8080; - private static final String DEFAULT_DOCKER_IMAGE = "gurpartap/redis"; //"stratos/php:4.1.0-alpha"; + + private static final String DEFAULT_DOCKER_IMAGE = "fnichol/uhttpd"; + private static final int DEFAULT_CONTAINER_PORT = 80; + private static final int SERVICE_PORT = 4500; private static final int POD_ACTIVATION_WAIT_TIME = 10000; // 10 seconds + private static final String KUBERNETES_API_ENDPOINT = "kubernetes.api.endpoint"; + private static final String MINION_PUBLIC_IPS = "minion.public.ips"; + private static final String DOCKER_IMAGE = "docker.image"; + private static final String CONTAINER_PORT = "container.port"; + private static final String TEST_SERVICE_SOCKET = "test.service.socket"; + private static final String TEST_POD_ACTIVATION = "test.pod.activation"; + private KubernetesApiClient client; private String dockerImage; private String endpoint; private int containerPort; private boolean testPodActivation; - private boolean testProxyServiceSocket; + private boolean testServiceSocket; + private String[] minionPublicIPs = { "172.17.8.102" }; + private List<String> podIdList = new ArrayList<String>(); + private List<String> serviceIdList = new ArrayList<String>(); @BeforeClass public void setUp() { log.info("Setting up live test..."); - endpoint = System.getProperty("kubernetes.api.endpoint"); + endpoint = System.getProperty(KUBERNETES_API_ENDPOINT); if (endpoint == null) { - endpoint = "http://" + DEFAULT_KUBERNETES_MASTER_IP + ":" + KUBERNETES_API_PORT + "/api/" + KubernetesConstants.KUBERNETES_API_VERSION + "/"; + endpoint = "http://" + DEFAULT_KUBERNETES_MASTER_IP + ":" + KUBERNETES_API_PORT + "/api/" + + KubernetesConstants.KUBERNETES_API_VERSION + "/"; } - log.info("Kubernetes endpoint: " + endpoint); + log.info(KUBERNETES_API_ENDPOINT + ": " + endpoint); client = new KubernetesApiClient(endpoint); - dockerImage = System.getProperty("docker.image"); + dockerImage = System.getProperty(DOCKER_IMAGE); if (dockerImage == null) { dockerImage = DEFAULT_DOCKER_IMAGE; } - log.info("Docker image: " + dockerImage); + log.info(DOCKER_IMAGE + ": " + dockerImage); - String containerPortStr = System.getProperty("container.port"); - if(StringUtils.isNotBlank(containerPortStr)) { + String containerPortStr = System.getProperty(CONTAINER_PORT); + if (StringUtils.isNotBlank(containerPortStr)) { containerPort = Integer.parseInt(containerPortStr); } else { containerPort = DEFAULT_CONTAINER_PORT; } + log.info(CONTAINER_PORT + ": " + containerPort); - String testPodActivationStr = System.getProperty("test.pod.activation"); - if(StringUtils.isNotBlank(testPodActivationStr)) { + testPodActivation = false; + String testPodActivationStr = System.getProperty(TEST_POD_ACTIVATION); + if (StringUtils.isNotBlank(testPodActivationStr)) { testPodActivation = Boolean.parseBoolean(testPodActivationStr); } + log.info(TEST_POD_ACTIVATION + ": " + testPodActivation); - String testProxyServiceSocketStr = System.getProperty("test.proxy.service.socket"); - if(StringUtils.isNotBlank(testProxyServiceSocketStr)) { - testProxyServiceSocket = Boolean.parseBoolean(testProxyServiceSocketStr); + testServiceSocket = false; + String testServiceSocketStr = System.getProperty(TEST_SERVICE_SOCKET); + if (StringUtils.isNotBlank(testServiceSocketStr)) { + testServiceSocket = Boolean.parseBoolean(testServiceSocketStr); } - log.info("Live test setup completed"); + log.info(TEST_SERVICE_SOCKET + ": " + testServiceSocket); + + String minionPublicIPsStr = System.getProperty(MINION_PUBLIC_IPS); + if(StringUtils.isNotBlank(minionPublicIPsStr)) { + minionPublicIPs = minionPublicIPsStr.split(","); + } + log.info(MINION_PUBLIC_IPS + ": " + minionPublicIPsStr); + log.info("Kubernetes live test setup completed"); } @AfterClass public void tearDown() { log.info("Cleaning kubernetes resources..."); - deletePods(); deleteServices(); + deletePods(); log.info("Kubernetes resources cleaned"); } @@ -116,42 +139,11 @@ public class KubernetesApiClientLiveTest extends TestCase{ public void testPodCreation() throws Exception { log.info("Testing pod creation..."); - String podId = "stratos-test-pod-1"; - String podName = "stratos-test-pod"; - String containerPortName = "http-1"; - - log.info("Creating pod: [pod-id] " + podId); - List<Port> ports = createPorts(containerPortName); - client.createPod(podId, podName, dockerImage, ports, null); - - Thread.sleep(2000); - Pod pod = client.getPod(podId); - assertNotNull(pod); - log.info("Pod created successfully: [pod-id] " + podId); + createPod("stratos-test-pod-1", "stratos-test-pod", "http-1"); + createPod("stratos-test-pod-2", "stratos-test-pod", "http-1"); - if(testPodActivation) { - log.info("Waiting pod status to be changed to running: [pod-id] " + podId); - Thread.sleep(POD_ACTIVATION_WAIT_TIME); - pod = client.getPod(podId); - assertNotNull(pod); - assertEquals(KubernetesConstants.POD_STATUS_RUNNING, pod.getCurrentState().getStatus()); - log.info("Pod state changed to running: [pod-id]" + pod.getId()); - } - - log.info("Deleting pod: " + pod.getId()); - client.deletePod(pod.getId()); - assertNull(client.getPod(pod.getId())); - log.info("Pod deleted successfully: " + pod.getId()); - } - - private List<Port> createPorts(String containerPortName) { - List<Port> ports = new ArrayList<Port>(); - Port port = new Port(); - port.setName(containerPortName); - port.setContainerPort(containerPort); - port.setHostPort(SERVICE_PORT); - ports.add(port); - return ports; + deletePod("stratos-test-pod-1"); + deletePod("stratos-test-pod-2"); } @Test @@ -167,97 +159,130 @@ public class KubernetesApiClientLiveTest extends TestCase{ public void testServiceCreation() throws Exception { log.info("Testing service creation..."); - String podId = "stratos-test-pod-1"; - String podName = "stratos-test-pod"; - String serviceId = "tomcat-1-tomcat-domain-1"; - String serviceName = serviceId; + String serviceId = "tomcat-domain-1"; + String serviceName = "stratos-test-pod"; String containerPortName = "http-1"; - String masterPublicIp = new URL(endpoint).getHost(); + createService(serviceId, serviceName, SERVICE_PORT, containerPortName, minionPublicIPs); + + createPod("stratos-test-pod-1", serviceName, containerPortName); + createPod("stratos-test-pod-2", serviceName, containerPortName); + + if (testServiceSocket) { + // test service accessibility + log.info(String.format("Connecting to service: [portal] %s:%d", minionPublicIPs[0], SERVICE_PORT)); + sleep(4000); + Socket socket = new Socket(minionPublicIPs[0], SERVICE_PORT); + assertTrue(socket.isConnected()); + log.info(String.format("Connecting to service successful: [portal] %s:%d", minionPublicIPs[0], SERVICE_PORT)); + } - log.info("Creating pod..."); + deleteService(serviceId); + + deletePod("stratos-test-pod-1"); + deletePod("stratos-test-pod-2"); + } + + private void createPod(String podId, String podName, String containerPortName) throws KubernetesClientException { + log.info("Creating pod: [pod] " + podId); List<Port> ports = createPorts(containerPortName); client.createPod(podId, podName, dockerImage, ports, null); + podIdList.add(podId); - Thread.sleep(2000); - Pod podCreated = client.getPod(podId); - assertNotNull(podCreated); - log.info("Pod created successfully"); + sleep(2000); + Pod pod = client.getPod(podId); + assertNotNull(pod); + log.info("Pod created successfully: [pod] " + podId); + + if (testPodActivation) { + boolean activated = false; + long startTime = System.currentTimeMillis(); + while(!activated) { + if((System.currentTimeMillis() - startTime) > POD_ACTIVATION_WAIT_TIME) { + log.info(String.format("Pod did not activate within %d seconds: [pod] %s", + POD_ACTIVATION_WAIT_TIME/1000, podId)); + break; + } - log.info("Creating service..."); - client.createService(serviceId, serviceName, SERVICE_PORT, containerPortName); + log.info("Waiting pod status to be changed to running: [pod] " + podId); + sleep(2000); + pod = client.getPod(podId); + if((pod != null) && (pod.getCurrentState().getStatus().equals(KubernetesConstants.POD_STATUS_RUNNING))) { + activated = true; + log.info("Pod state changed to running: [pod]" + pod.getId()); + } + } - Thread.sleep(2000); - Service service = client.getService(serviceId); - assertNotNull(service); - log.info("Service creation successful"); + assertNotNull(pod); + assertEquals(KubernetesConstants.POD_STATUS_RUNNING, pod.getCurrentState().getStatus()); + } + } - // test recreation using same id - log.info("Creating a service with an existing id..."); - client.createService(serviceId, serviceName, SERVICE_PORT, containerPortName); + private void deletePod(String podId) throws KubernetesClientException { + log.info("Deleting pod: " + podId); + client.deletePod(podId); + podIdList.remove(podId); - Thread.sleep(2000); - service = client.getService(serviceId); - assertNotNull(service); - log.info("Service re-creation with an existing id successful"); + assertNull(client.getPod(podId)); + log.info("Pod deleted successfully: " + podId); + } - if(testProxyServiceSocket) { - // test service proxy is accessibility - log.info("Connecting to service proxy..."); - Socket socket = new Socket(masterPublicIp, SERVICE_PORT); - assertTrue(socket.isConnected()); - log.info("Connecting to service proxy successful"); + public void deletePods() { + try { + for(String podId : podIdList) { + deletePod(podId); + } + } catch (KubernetesClientException e) { + log.error("Could not delete pods", e); } + } + + private void createService(String serviceId, String serviceName, int servicePort, String containerPortName, + String[] publicIPs) throws KubernetesClientException, InterruptedException, IOException { + log.info("Creating service..."); + client.createService(serviceId, serviceName, servicePort, containerPortName, publicIPs); + serviceIdList.add(serviceId); + + sleep(1000); + Service service = client.getService(serviceId); + assertNotNull(service); + log.info("Service creation successful"); + } - log.info("Deleting service..."); + private void deleteService(String serviceId) throws KubernetesClientException { + log.info(String.format("Deleting service: [service] %s", serviceId)); client.deleteService(serviceId); + serviceIdList.remove(serviceId); + + sleep(1000); assertNull(client.getService(serviceId)); - log.info("Service deleted successfully"); + log.info(String.format("Service deleted successfully: [service] %s", serviceId)); } public void deleteServices() { try { - int count = 0; - List<Service> services = client.getServices(); - while((services != null) && (services.size() > 0)) { - for (Service service : services) { - if ((StringUtils.isNotBlank(service.getId())) && (!service.getId().contains("kubernetes"))) { - client.deleteService(service.getId()); - count++; - log.info(String.format("Service deleted: [service] %s", service.getId())); - } - } - services = client.getServices(); - } - - if(count > 0) { - log.info(String.format("%d services deleted", count)); + for(String serviceId : serviceIdList) { + deleteService(serviceId); } } catch (KubernetesClientException e) { log.error("Could not delete services", e); } } - public void deletePods() { + private void sleep(long time) { try { - int count = 0; - List<Pod> pods = client.getPods(); - while ((pods != null) || (pods.size() > 0)) { - for (Pod pod : pods) { - if (StringUtils.isNotBlank(pod.getId())) { - client.deletePod(pod.getId()); - count++; - log.info(String.format("Pod deleted: [pod] %s", pod.getId())); - } - } - pods = client.getPods(); - } - - if(count > 0) { - log.info(String.format("%d pods deleted", count)); - } - } catch (KubernetesClientException e) { - log.error("Could not delete pods", e); + Thread.sleep(time); + } catch (InterruptedException ignore) { } } + + private List<Port> createPorts(String containerPortName) { + List<Port> ports = new ArrayList<Port>(); + Port port = new Port(); + port.setName(containerPortName); + port.setContainerPort(containerPort); + port.setProtocol("tcp"); + ports.add(port); + return ports; + } } http://git-wip-us.apache.org/repos/asf/stratos/blob/4862fb9d/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl ---------------------------------------------------------------------- diff --git a/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl b/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl index c6a8fbd..95bf6a3 100644 --- a/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl +++ b/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ax29="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ns="http://impl.services.autoscaler.stratos.apache.org" xmlns:ax27="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax25="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax21="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:ax217="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ax22="http://common.stratos.apache.org/xsd" xmlns:ax219="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax215="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ax222="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:ax210="http://network.partition.deployment.policy.pojo.autoscale r.stratos.apache.org/xsd" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl.services.autoscaler.stratos.apache.org"> +<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ax29="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ns="http://impl.services.autoscaler.stratos.apache.org" xmlns:ax27="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax25="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax217="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ax21="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ax22="http://common.stratos.apache.org/xsd" xmlns:ax219="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ax212="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax222="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" x mlns:ax211="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl.services.autoscaler.stratos.apache.org"> <wsdl:types> <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd"> <xs:complexType name="AutoscalePolicy"> @@ -8,7 +8,7 @@ <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="instanceRoundingFactor" type="xs:float"/> <xs:element minOccurs="0" name="isPublic" type="xs:boolean"/> - <xs:element minOccurs="0" name="loadThresholds" nillable="true" type="ax27:LoadThresholds"/> + <xs:element minOccurs="0" name="loadThresholds" nillable="true" type="ax29:LoadThresholds"/> <xs:element minOccurs="0" name="tenantId" type="xs:int"/> </xs:sequence> </xs:complexType> @@ -111,8 +111,8 @@ <xs:complexType name="ServiceGroup"> <xs:sequence> <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridges" nillable="true" type="xs:string"/> - <xs:element minOccurs="0" name="dependencies" nillable="true" type="ax25:Dependencies"/> - <xs:element maxOccurs="unbounded" minOccurs="0" name="groups" nillable="true" type="ax25:ServiceGroup"/> + <xs:element minOccurs="0" name="dependencies" nillable="true" type="ax27:Dependencies"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="groups" nillable="true" type="ax27:ServiceGroup"/> <xs:element minOccurs="0" name="groupscalingEnabled" type="xs:boolean"/> <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/> </xs:sequence> @@ -125,28 +125,40 @@ </xs:sequence> </xs:complexType> </xs:schema> - <xs:schema xmlns:ax28="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax26="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax24="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:ax216="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ax218="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax214="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax220="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax221="http://common.stratos.apache.org/xsd" xmlns:ax213="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax223="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.services.autoscaler.stratos.apache.org"> + <xs:schema xmlns:ax28="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax26="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax24="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:ax216="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax218="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ax215="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax220="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax221="http://common.stratos.apache.org/xsd" xmlns:ax223="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax210="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.services.autoscaler.stratos.apache.org"> <xs:import namespace="http://pojo.applications.autoscaler.stratos.apache.org/xsd"/> + <xs:import namespace="http://application.exception.autoscaler.stratos.apache.org/xsd"/> <xs:import namespace="http://pojo.autoscaler.stratos.apache.org/xsd"/> <xs:import namespace="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd"/> <xs:import namespace="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"/> <xs:import namespace="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"/> <xs:import namespace="http://exception.autoscaler.stratos.apache.org/xsd"/> <xs:import namespace="http://policy.exception.autoscaler.stratos.apache.org/xsd"/> - <xs:import namespace="http://application.exception.autoscaler.stratos.apache.org/xsd"/> <xs:import namespace="http://common.stratos.apache.org/xsd"/> <xs:import namespace="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd"/> - <xs:element name="getApplication"> + <xs:element name="getApplications"> + <xs:complexType> + <xs:sequence/> + </xs:complexType> + </xs:element> + <xs:element name="getApplicationsResponse"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax24:ApplicationContext"/> </xs:sequence> </xs:complexType> </xs:element> - <xs:element name="getApplicationResponse"> + <xs:element name="AutoscalerServiceApplicationDefinitionException"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="return" nillable="true" type="ax24:ApplicationContext"/> + <xs:element minOccurs="0" name="ApplicationDefinitionException" nillable="true" type="ax25:ApplicationDefinitionException"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="addApplication"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="applicationContext" nillable="true" type="ax24:ApplicationContext"/> </xs:sequence> </xs:complexType> </xs:element> @@ -160,7 +172,7 @@ <xs:element name="getServiceGroupResponse"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="return" nillable="true" type="ax25:ServiceGroup"/> + <xs:element minOccurs="0" name="return" nillable="true" type="ax27:ServiceGroup"/> </xs:sequence> </xs:complexType> </xs:element> @@ -174,7 +186,7 @@ <xs:element name="getAutoscalingPolicyResponse"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="return" nillable="true" type="ax27:AutoscalePolicy"/> + <xs:element minOccurs="0" name="return" nillable="true" type="ax29:AutoscalePolicy"/> </xs:sequence> </xs:complexType> </xs:element> @@ -188,14 +200,7 @@ <xs:element name="getDeploymentPolicyResponse"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="return" nillable="true" type="ax29:DeploymentPolicy"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="deleteApplication"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/> + <xs:element minOccurs="0" name="return" nillable="true" type="ax215:DeploymentPolicy"/> </xs:sequence> </xs:complexType> </xs:element> @@ -207,7 +212,7 @@ <xs:element name="getNetworkPartitionsResponse"> <xs:complexType> <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax214:NetworkPartition"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax216:NetworkPartition"/> </xs:sequence> </xs:complexType> </xs:element> @@ -221,7 +226,7 @@ <xs:element name="getNetworkPartitionResponse"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="return" nillable="true" type="ax214:NetworkPartition"/> + <xs:element minOccurs="0" name="return" nillable="true" type="ax216:NetworkPartition"/> </xs:sequence> </xs:complexType> </xs:element> @@ -235,7 +240,7 @@ <xs:element name="updateNetworkPartition"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax214:NetworkPartition"/> + <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax216:NetworkPartition"/> </xs:sequence> </xs:complexType> </xs:element> @@ -256,7 +261,7 @@ <xs:element name="AutoscalerServiceAutoScalerException"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="AutoScalerException" nillable="true" type="ax216:AutoScalerException"/> + <xs:element minOccurs="0" name="AutoScalerException" nillable="true" type="ax217:AutoScalerException"/> </xs:sequence> </xs:complexType> </xs:element> @@ -268,7 +273,7 @@ <xs:element name="getServiceGroupsResponse"> <xs:complexType> <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax25:ServiceGroup"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax27:ServiceGroup"/> </xs:sequence> </xs:complexType> </xs:element> @@ -282,14 +287,14 @@ <xs:element name="AutoscalerServiceInvalidPolicyException"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="InvalidPolicyException" nillable="true" type="ax217:InvalidPolicyException"/> + <xs:element minOccurs="0" name="InvalidPolicyException" nillable="true" type="ax219:InvalidPolicyException"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="addAutoScalingPolicy"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax27:AutoscalePolicy"/> + <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax29:AutoscalePolicy"/> </xs:sequence> </xs:complexType> </xs:element> @@ -308,14 +313,14 @@ <xs:element name="getAutoScalingPoliciesResponse"> <xs:complexType> <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax27:AutoscalePolicy"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax29:AutoscalePolicy"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="updateAutoScalingPolicy"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax27:AutoscalePolicy"/> + <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax29:AutoscalePolicy"/> </xs:sequence> </xs:complexType> </xs:element> @@ -340,18 +345,11 @@ </xs:sequence> </xs:complexType> </xs:element> - <xs:element name="AutoscalerServiceApplicationDefinitionException"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="ApplicationDefinitionException" nillable="true" type="ax219:ApplicationDefinitionException"/> - </xs:sequence> - </xs:complexType> - </xs:element> <xs:element name="deployApplication"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/> - <xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="ax29:DeploymentPolicy"/> + <xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="ax215:DeploymentPolicy"/> </xs:sequence> </xs:complexType> </xs:element> @@ -372,7 +370,7 @@ <xs:element name="AutoscalerServiceInvalidArgumentException"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="InvalidArgumentException" nillable="true" type="ax216:InvalidArgumentException"/> + <xs:element minOccurs="0" name="InvalidArgumentException" nillable="true" type="ax217:InvalidArgumentException"/> </xs:sequence> </xs:complexType> </xs:element> @@ -394,14 +392,14 @@ <xs:element name="addServiceGroup"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="servicegroup" nillable="true" type="ax25:ServiceGroup"/> + <xs:element minOccurs="0" name="servicegroup" nillable="true" type="ax27:ServiceGroup"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="addNetworkPartition"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax214:NetworkPartition"/> + <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax216:NetworkPartition"/> </xs:sequence> </xs:complexType> </xs:element> @@ -427,35 +425,37 @@ </xs:sequence> </xs:complexType> </xs:element> - <xs:element name="getApplications"> + <xs:element name="getApplication"> <xs:complexType> - <xs:sequence/> + <xs:sequence> + <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/> + </xs:sequence> </xs:complexType> </xs:element> - <xs:element name="getApplicationsResponse"> + <xs:element name="getApplicationResponse"> <xs:complexType> <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax24:ApplicationContext"/> + <xs:element minOccurs="0" name="return" nillable="true" type="ax24:ApplicationContext"/> </xs:sequence> </xs:complexType> </xs:element> - <xs:element name="addApplication"> + <xs:element name="deleteApplication"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" name="applicationContext" nillable="true" type="ax24:ApplicationContext"/> + <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> - <xs:schema xmlns:ax212="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"> + <xs:schema xmlns:ax214="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"> <xs:import namespace="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"/> <xs:complexType name="DeploymentPolicy"> <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="allPartitions" nillable="true" type="ax212:Partition"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="allPartitions" nillable="true" type="ax214:Partition"/> <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/> - <xs:element maxOccurs="unbounded" minOccurs="0" name="applicationLevelNetworkPartitions" nillable="true" type="ax212:NetworkPartition"/> - <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelNetworkPartitions" nillable="true" type="ax212:ChildLevelNetworkPartition"/> - <xs:element maxOccurs="unbounded" minOccurs="0" name="childPolicies" nillable="true" type="ax29:ChildPolicy"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="applicationLevelNetworkPartitions" nillable="true" type="ax214:NetworkPartition"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelNetworkPartitions" nillable="true" type="ax214:ChildLevelNetworkPartition"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="childPolicies" nillable="true" type="ax211:ChildPolicy"/> <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="isPublic" type="xs:boolean"/> <xs:element minOccurs="0" name="tenantId" type="xs:int"/> @@ -464,7 +464,7 @@ <xs:complexType name="ChildPolicy"> <xs:sequence> <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/> - <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelNetworkPartitions" nillable="true" type="ax212:ChildLevelNetworkPartition"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelNetworkPartitions" nillable="true" type="ax214:ChildLevelNetworkPartition"/> </xs:sequence> </xs:complexType> </xs:schema> @@ -475,7 +475,7 @@ </xs:sequence> </xs:complexType> </xs:schema> - <xs:schema xmlns:ax211="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"> + <xs:schema xmlns:ax213="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"> <xs:import namespace="http://common.stratos.apache.org/xsd"/> <xs:complexType name="Partition"> <xs:sequence> @@ -492,12 +492,12 @@ <xs:element minOccurs="0" name="activeByDefault" type="xs:boolean"/> <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/> - <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true" type="ax210:Partition"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true" type="ax212:Partition"/> </xs:sequence> </xs:complexType> <xs:complexType name="ChildLevelNetworkPartition"> <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelPartitions" nillable="true" type="ax210:ChildLevelPartition"/> + <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelPartitions" nillable="true" type="ax212:ChildLevelPartition"/> <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="min" type="xs:int"/> <xs:element minOccurs="0" name="partitionAlgo" nillable="true" type="xs:string"/>
