stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [2/2] stratos git commit: Changing property.value back to string and adding properties to handle kubernetes services and dynamic payload
Date Sun, 21 Dec 2014 19:48:47 GMT
Changing property.value back to string and adding properties to handle kubernetes services
and dynamic payload


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/69d2f343
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/69d2f343
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/69d2f343

Branch: refs/heads/master
Commit: 69d2f34379eb3dcb27e9efa9c134a0a9f23847c9
Parents: d544a08
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Mon Dec 22 01:18:35 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Mon Dec 22 01:18:35 2014 +0530

----------------------------------------------------------------------
 .../applications/ApplicationUtils.java          |    4 +-
 .../monitor/cluster/ClusterMonitor.java         |    2 +-
 .../stratos/autoscaler/util/AutoscalerUtil.java |    2 +-
 .../context/CloudControllerContext.java         |    8 +-
 .../cloud/controller/domain/ClusterContext.java |   12 +
 .../cloud/controller/domain/MemberContext.java  |   15 +-
 ...inerClusterContextToKubernetesContainer.java |   44 +-
 .../cloud/controller/iaases/KubernetesIaas.java |   37 +-
 .../messaging/topology/TopologyBuilder.java     |   48 +-
 .../org/apache/stratos/common/Property.java     |    8 +-
 .../common/constants/StratosConstants.java      |   15 +-
 .../stratos/kubernetes/client/model/Labels.java |    6 +-
 .../kubernetes/client/model/Selector.java       |   10 +-
 .../kubernetes/client/model/Service.java        |    5 +-
 .../src/main/resources/AutoScalerService.wsdl   |   46 +-
 .../main/resources/CloudControllerService.wsdl  | 1997 +++++++++---------
 16 files changed, 1123 insertions(+), 1136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java
index f48b8a9..d0918e6 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java
@@ -227,7 +227,7 @@ public class ApplicationUtils {
                         if ("DEPLOYMENT".equals(payloadParamSubstring)) {
                             isDeploymentParam = true;
                         }
-                        payloadData.add(payloadParamSubstring, String.valueOf(propertyEntry.getValue()));
+                        payloadData.add(payloadParamSubstring, propertyEntry.getValue());
                     }
                 }
             }
@@ -239,7 +239,7 @@ public class ApplicationUtils {
 				if (property.getName().startsWith("payload_parameter.")) {
                     String payloadParamName = property.getName();
                     String payloadParamSubstring = payloadParamName.substring(payloadParamName.indexOf(".")
+ 1);
-                    payloadData.add(payloadParamSubstring, String.valueOf(property.getValue()));
+                    payloadData.add(payloadParamSubstring, property.getValue());
 				}
 			}
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
index 2211775..27cad51 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
@@ -176,7 +176,7 @@ public class ClusterMonitor extends AbstractClusterMonitor {
         if (props != null && props.getProperties() != null) {
             for (Property prop : props.getProperties()) {
                 if (prop.getName().equals("PRIMARY")) {
-                    if (Boolean.parseBoolean(String.valueOf(prop.getValue()))) {
+                    if (Boolean.parseBoolean(prop.getValue())) {
                         log.debug("Adding member id [" + memberContext.getMemberId() + "]
" +
                                 "member instance id [" + memberContext.getInstanceId() +
"] as a primary member");
                         return true;

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
index ebf5908..144d062 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
@@ -327,7 +327,7 @@ public class AutoscalerUtil {
                 if ((property != null) && (property.getValue() != null)) {
                     org.apache.stratos.cloud.controller.stub.Property newProperty = new org.apache.stratos.cloud.controller.stub.Property();
                     newProperty.setName(property.getName());
-                    newProperty.setValue(String.valueOf(property.getValue()));
+                    newProperty.setValue(property.getValue());
                     stubProps.addProperties(newProperty);
                 }
             }

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/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 5c19218..89e8bf8 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
@@ -407,8 +407,12 @@ public class CloudControllerContext implements Serializable {
         return clusterIdToMemberContextListMap.get(clusterId);
     }
 
-    public void addClusterContext(ClusterContext ctxt) {
-        clusterIdToContextMap.put(ctxt.getClusterId(), ctxt);
+    public void addClusterContext(ClusterContext clusterContext) {
+        clusterIdToContextMap.put(clusterContext.getClusterId(), clusterContext);
+    }
+
+    public void updateClusterContext(ClusterContext clusterContext) {
+        clusterIdToContextMap.put(clusterContext.getClusterId(), clusterContext);
     }
 
     public ClusterContext getClusterContext(String clusterId) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/ClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/ClusterContext.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/ClusterContext.java
index 1652997..147b5d9 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/ClusterContext.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/domain/ClusterContext.java
@@ -19,9 +19,11 @@
 package org.apache.stratos.cloud.controller.domain;
 
 import java.io.Serializable;
+import java.util.List;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.stratos.common.Properties;
+import org.apache.stratos.kubernetes.client.model.Service;
 
 /**
  * Holds runtime data of a Cluster.
@@ -44,6 +46,7 @@ public class ClusterContext implements Serializable{
     // timeout in milliseconds - this would be the per member time that CC waits before forcefully
terminate instances on an unregistration.
     private long timeoutInMillis;
     private Properties properties;
+    private List<Service> kubernetesServices;
 
     public ClusterContext(String clusterId, String cartridgeType, String payload, String
hostName, 
     		boolean isLbCluster, Properties properties) {
@@ -128,6 +131,15 @@ public class ClusterContext implements Serializable{
 	public void setProperties(Properties properties) {
 		this.properties = properties;
 	}
+
+    public List<Service> getKubernetesServices() {
+        return kubernetesServices;
+    }
+
+    public void setKubernetesServices(List<Service> kubernetesServices) {
+        this.kubernetesServices = kubernetesServices;
+    }
+
 	
 	/*public void addProperty(String key, int value) {
 		this.properties.put(key, value);

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/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 f4fc2f3..f579f4d 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
@@ -20,9 +20,11 @@ package org.apache.stratos.cloud.controller.domain;
 
 import org.apache.stratos.common.Properties;
 import org.apache.stratos.common.Property;
+import org.apache.stratos.common.beans.NameValuePair;
 
 import java.io.Serializable;
 import java.util.Arrays;
+import java.util.List;
 
 /**
  * Holds information about a Member.
@@ -69,6 +71,7 @@ public class MemberContext implements Serializable {
     private InstanceMetadata instanceMetadata;
     // Properties
     private Properties properties;
+    private List<NameValuePair> dynamicPayload;
 
     public MemberContext(String id, String clusterId, Partition partition) {
         this.memberId = id;
@@ -269,13 +272,21 @@ public class MemberContext implements Serializable {
         return clusterInstanceId;
     }
 
+    public void setDynamicPayload(List<NameValuePair> dynamicPayload) {
+        this.dynamicPayload = dynamicPayload;
+    }
+
+    public List<NameValuePair> getDynamicPayload() {
+        return dynamicPayload;
+    }
+
     @Override
     public String toString() {
         return "MemberContext [memberId=" + memberId + ", instanceId=" + instanceId
                 + ", clusterId=" + clusterId + ", partition=" + partition
                 + ", cartridgeType=" + cartridgeType + ", defaultPrivateIP=" + defaultPrivateIP
-                + ", defaultPublicIP=" + defaultPublicIP + ", allocatedIPs=" + Arrays.toString(allocatedIPs)

-                + ", publicIPs=" + Arrays.toString(publicIPs) + ", privateIPs=" + Arrays.toString(privateIPs)

+                + ", defaultPublicIP=" + defaultPublicIP + ", allocatedIPs=" + Arrays.toString(allocatedIPs)
+                + ", publicIPs=" + Arrays.toString(publicIPs) + ", privateIPs=" + Arrays.toString(privateIPs)
                 + ", initTime=" + initTime + ", lbClusterId=" + lbClusterId
                 + ", networkPartitionId=" + networkPartitionId + ", instanceMetadata=" +
instanceMetadata +
                 ", properties=" + properties + "]";

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/ContainerClusterContextToKubernetesContainer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/ContainerClusterContextToKubernetesContainer.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/ContainerClusterContextToKubernetesContainer.java
index ba72fec..4db6ea8 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/ContainerClusterContextToKubernetesContainer.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/ContainerClusterContextToKubernetesContainer.java
@@ -71,10 +71,10 @@ public class ContainerClusterContextToKubernetesContainer implements Function<Me
 
         for (PortMapping portMapping : cartridge.getPortMappings()) {
             Port p = new Port();
-            p.setContainerPort(Integer.parseInt(portMapping.getPort()));
+            p.setName(p.getProtocol() + p.getContainerPort());
             // In kubernetes transport protocol always be 'tcp'
             p.setProtocol("tcp");
-            p.setName(p.getProtocol() + p.getContainerPort());
+            p.setContainerPort(Integer.parseInt(portMapping.getPort()));
             portList.add(p);
         }
         return portList.toArray(ports);
@@ -85,30 +85,28 @@ public class ContainerClusterContextToKubernetesContainer implements Function<Me
                 StratosConstants.KUBERNETES_CLUSTER_ID);
 
         List<EnvironmentVariable> environmentVariables = new ArrayList<EnvironmentVariable>();
-        if (memberContext.getProperties() != null) {
-            Properties properties = memberContext.getProperties();
-            if (properties != null) {
-                // Set dynamic payload
-                List<NameValuePair> payload = (List<NameValuePair>) properties.getProperty(
-                        StratosConstants.DYNAMIC_PAYLOAD);
-                if(payload != null) {
-                    for(NameValuePair parameter : payload) {
-                        addToEnvironmentVariables(environmentVariables, parameter.getName(),
parameter.getValue());
-                    }
-                }
-                // Set member string properties as payload parameters
-                for (Property property : properties.getProperties()) {
-                    if(property.getValue() instanceof String) {
-                        addToEnvironmentVariables(environmentVariables, property.getName(),
-                                String.valueOf(property.getValue()));
-                    }
-                }
+
+        // Set dynamic payload
+        List<NameValuePair> payload = memberContext.getDynamicPayload();
+        if (payload != null) {
+            for (NameValuePair parameter : payload) {
+                addToEnvironmentVariables(environmentVariables, parameter.getName(), parameter.getValue());
+            }
+        }
+
+        // Set member properties
+        Properties properties = memberContext.getProperties();
+        if (properties != null) {
+            for (Property property : properties.getProperties()) {
+                addToEnvironmentVariables(environmentVariables, property.getName(),
+                        property.getValue());
             }
-            // Set kubernetes cluster id
-            addToEnvironmentVariables(environmentVariables, StratosConstants.KUBERNETES_CLUSTER_ID,
-                    kubernetesClusterId);
         }
 
+        // Set kubernetes cluster id
+        addToEnvironmentVariables(environmentVariables, StratosConstants.KUBERNETES_CLUSTER_ID,
+                kubernetesClusterId);
+
         EnvironmentVariable[] array = new EnvironmentVariable[environmentVariables.size()];
         return environmentVariables.toArray(array);
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/KubernetesIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/KubernetesIaas.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/KubernetesIaas.java
index 082c723..3ff2dac 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/KubernetesIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/KubernetesIaas.java
@@ -25,6 +25,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.concurrent.ScheduledThreadExecutor;
 import org.apache.stratos.cloud.controller.context.CloudControllerContext;
 import org.apache.stratos.cloud.controller.domain.*;
+import org.apache.stratos.cloud.controller.domain.Cartridge;
 import org.apache.stratos.cloud.controller.exception.*;
 import org.apache.stratos.cloud.controller.functions.ContainerClusterContextToReplicationController;
 import org.apache.stratos.cloud.controller.iaases.validators.KubernetesPartitionValidator;
@@ -32,7 +33,6 @@ import org.apache.stratos.cloud.controller.iaases.validators.PartitionValidator;
 import org.apache.stratos.cloud.controller.services.impl.CloudControllerServiceUtil;
 import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
 import org.apache.stratos.cloud.controller.util.PodActivationWatcher;
-import org.apache.stratos.common.Property;
 import org.apache.stratos.common.beans.NameValuePair;
 import org.apache.stratos.common.constants.StratosConstants;
 import org.apache.stratos.common.kubernetes.KubernetesGroup;
@@ -40,6 +40,7 @@ import org.apache.stratos.common.kubernetes.PortRange;
 import org.apache.stratos.kubernetes.client.KubernetesApiClient;
 import org.apache.stratos.kubernetes.client.exceptions.KubernetesClientException;
 import org.apache.stratos.kubernetes.client.model.*;
+import org.apache.stratos.kubernetes.client.model.Service;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -175,6 +176,8 @@ public class KubernetesIaas extends Iaas {
 
                 // Create proxy services for port mappings
                 List<Service> services = createProxyServices(clusterContext, kubClusterContext,
kubernetesApi);
+                clusterContext.setKubernetesServices(services);
+                CloudControllerContext.getInstance().updateClusterContext(clusterContext);
 
                 // Wait for pod to be created
                 Pod[] pods = waitForPodToBeCreated(memberContext, kubernetesApi);
@@ -194,12 +197,6 @@ public class KubernetesIaas extends Iaas {
 
                 // Create member context
                 MemberContext newMemberContext = createNewMemberContext(memberContext, pod);
-
-                Property servicesProperty = new Property();
-                servicesProperty.setName(StratosConstants.KUBERNETES_SERVICES);
-                servicesProperty.setValue(services);
-                newMemberContext.getProperties().addProperty(servicesProperty);
-
                 CloudControllerContext.getInstance().addMemberContext(newMemberContext);
 
                 // wait till pod status turns to running and send member spawned.
@@ -277,8 +274,9 @@ public class KubernetesIaas extends Iaas {
         if (log.isDebugEnabled()) {
             log.debug("Creating kubernetes replication controller: [cluster-id] " + clusterId);
         }
+
         // Add dynamic payload to the member context
-        memberContext.getProperties().addProperty(new Property(StratosConstants.DYNAMIC_PAYLOAD,
payload));
+        memberContext.setDynamicPayload(payload);
         ContainerClusterContextToReplicationController controllerFunction =
                 new ContainerClusterContextToReplicationController();
 
@@ -312,6 +310,7 @@ public class KubernetesIaas extends Iaas {
             log.error(message);
             throw new RuntimeException(message);
         }
+
         List<PortMapping> portMappings = cartridge.getPortMappings();
         for(PortMapping portMapping : portMappings) {
             if (log.isInfoEnabled()) {
@@ -319,15 +318,17 @@ public class KubernetesIaas extends Iaas {
                         clusterId, portMapping.getProtocol(), portMapping.getPort()));
             }
 
-            Service service = new Service();
-            service.setId(prepareKubernetesServiceId(clusterId, portMapping));
-            service.setApiVersion("v1beta1");
-            service.setKind("Service");
             int nextServicePort = kubernetesClusterContext.getNextServicePort();
             if(nextServicePort == -1) {
                 throw new RuntimeException("Service port not found");
             }
+
+            Service service = new Service();
+            service.setId(prepareKubernetesServiceId(clusterId, portMapping));
+            service.setApiVersion("v1beta1");
+            service.setKind("Service");
             service.setPort(nextServicePort);
+            service.setContainerPort(portMapping.getPort());
             Selector selector = new Selector();
             selector.setName(clusterId);
             service.setSelector(selector);
@@ -341,13 +342,6 @@ public class KubernetesIaas extends Iaas {
                         portMapping.getPort(), service.getPort()));
             }
         }
-        // Set service port and update
-        Property servicePortProperty = new Property();
-        servicePortProperty.setName(StratosConstants.KUBERNETES_SERVICES);
-        servicePortProperty.setValue(services);
-        clusterContext.getProperties().addProperty(servicePortProperty);
-        CloudControllerContext.getInstance().addClusterContext(clusterContext);
-
         return services;
     }
 
@@ -388,9 +382,8 @@ public class KubernetesIaas extends Iaas {
             KubernetesApiClient kubApi = kubClusterContext.getKubApi();
 
             // Remove the services
-            Property servicesProperty = clusterContext.getProperties().getProperty(StratosConstants.KUBERNETES_SERVICES);
-            if (servicesProperty != null) {
-                List<Service> services = (List<Service>) servicesProperty.getValue();
+            List<Service> services = clusterContext.getKubernetesServices();
+            if (services != null) {
                 for (Service service : services) {
                     try {
                         kubApi.deleteService(service.getId());

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
index 400428a..96bb5ba 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
@@ -33,6 +33,8 @@ import org.apache.stratos.common.constants.StratosConstants;
 import org.apache.stratos.messaging.domain.applications.ClusterDataHolder;
 import org.apache.stratos.messaging.domain.instance.ClusterInstance;
 import org.apache.stratos.messaging.domain.topology.*;
+import org.apache.stratos.messaging.domain.topology.Port;
+import org.apache.stratos.messaging.domain.topology.Service;
 import org.apache.stratos.messaging.event.applications.ApplicationInstanceTerminatedEvent;
 import org.apache.stratos.messaging.event.cluster.status.*;
 import org.apache.stratos.messaging.event.instance.status.InstanceActivatedEvent;
@@ -432,31 +434,33 @@ public class TopologyBuilder {
                 Port port;
                 if(cluster.isKubernetesCluster()){
                     // Update port mappings with generated service proxy port
-                    // TODO: Need to properly fix with the latest Kubernetes version
-                    String serviceHostPortStr = CloudControllerUtil.getProperty(memberContext.getProperties(),
StratosConstants.KUBERNETES_SERVICES);
-                    if(StringUtils.isEmpty(serviceHostPortStr)) {
-                        log.warn("Kubernetes service host port not found for member: [member-id]
" + memberId);
-                    }
-                    // Adding ports to the member
-                    if (StringUtils.isNotEmpty(serviceHostPortStr)) {
-                        for (PortMapping portMapping : portMappings) {
-                            port = new Port(portMapping.getProtocol(),
-                                    Integer.parseInt(serviceHostPortStr),
-                                    Integer.parseInt(portMapping.getProxyPort()));
-                            member.addPort(port);
+                    ClusterContext clusterContext = CloudControllerContext.getInstance().getClusterContext(clusterId);
+                    if(clusterContext == null) {
+                        log.warn("Cluster context not found, could not add member ports:
[cluster-id] " + clusterId);
+                    } else {
+                        List<org.apache.stratos.kubernetes.client.model.Service> services
=
+                                clusterContext.getKubernetesServices();
+                        if(services == null) {
+                            log.warn("Kubernetes services not found in cluster context, could
not add member ports: " +
+                                    "[cluster-id] " + clusterId);
+                        } else {
+                            // Adding ports to the member
+                            for (PortMapping portMapping : portMappings) {
+                                port = new Port(portMapping.getProtocol(),
+                                        findServicePort(clusterId, services, portMapping),
+                                        Integer.parseInt(portMapping.getProxyPort()));
+                                member.addPort(port);
+                            }
                         }
                     }
 
                 } else {
-
                     // Adding ports to the member
                     for (PortMapping portMapping : portMappings) {
-
                         port = new Port(portMapping.getProtocol(),
                                 Integer.parseInt(portMapping.getPort()),
                                 Integer.parseInt(portMapping.getProxyPort()));
                         member.addPort(port);
-
                     }
                 }
 
@@ -471,7 +475,19 @@ public class TopologyBuilder {
 		
 		TopologyEventPublisher.sendInstanceSpawnedEvent(memberContext);
 	}
-    
+
+    private static int findServicePort(String clusterId,
+                                       List<org.apache.stratos.kubernetes.client.model.Service>
services,
+                                       PortMapping portMapping) {
+        for(org.apache.stratos.kubernetes.client.model.Service service : services) {
+            if(service.getContainerPort().equals(portMapping.getPort())) {
+                return service.getPort();
+            }
+        }
+        throw new RuntimeException("Kubernetes service port not found: [cluster-id] " + clusterId
+ " [port] "
+                + portMapping.getPort());
+    }
+
     public static void handleMemberStarted(InstanceStartedEvent instanceStartedEvent) {
         Topology topology = TopologyManager.getTopology();
         Service service = topology.getService(instanceStartedEvent.getServiceName());

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/Property.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/Property.java
b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/Property.java
index b3dc180..7ac6b02 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/Property.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/Property.java
@@ -28,12 +28,12 @@ public class Property implements Serializable, Cloneable {
     private static final long serialVersionUID = -2191782657999410197L;
 
     private String name;
-    private Object value;
+    private String value;
 
     public Property() {
     }
 
-    public Property(String name, Object value) {
+    public Property(String name, String value) {
         this.setName(name);
         this.setValue(value);
     }
@@ -46,11 +46,11 @@ public class Property implements Serializable, Cloneable {
         this.name = name;
     }
 
-    public Object getValue() {
+    public String getValue() {
         return value;
     }
 
-    public void setValue(Object value) {
+    public void setValue(String value) {
         this.value = value;
     }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
index c763b90..e58eb3a 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
@@ -147,23 +147,14 @@ public class StratosConstants {
 
     // Kubernetes related constants
     public static final String KUBERNETES_CLUSTER_ID = "KUBERNETES_CLUSTER_ID";
-    public static final String KUBERNETES_DEPLOYER_TYPE = "kubernetes";
-    public static final String KUBERNETES_MASTER_IP = "KUBERNETES_MASTER_IP";
     public static final String KUBERNETES_MASTER_PORT = "KUBERNETES_MASTER_PORT";
     public static final String KUBERNETES_MASTER_DEFAULT_PORT = "8080";
-    public static final String KUBERNETES_MIN_REPLICAS = "KUBERNETES_REPLICAS_MIN";
-    public static final String KUBERNETES_MAX_REPLICAS = "KUBERNETES_REPLICAS_MAX";
-    public static final String KUBERNETES_PORT_RANGE = "KUBERNETES_PORT_RANGE";
-    public static final String KUBERNETES_SERVICES = "KUBERNETES_SERVICES";
-    
+
     //drools related constants
     public static final String DROOLS_DIR_NAME = "drools";
-    public static final String CONTAINER_SCALE_CHECK_DROOL_FILE = "container-scaling.drl";
     public static final String VM_SCALE_CHECK_DROOL_FILE = "scaling.drl";
     public static final String DEPENDENT_SCALE_CHECK_DROOL_FILE = "dependent-scaling.drl";
-    public static final String CONTAINER_MIN_CHECK_DROOL_FILE = "container-mincheck.drl";
     public static final String VM_MIN_CHECK_DROOL_FILE = "mincheck.drl";
-    public static final String CONTAINER_OBSOLETE_CHECK_DROOL_FILE = "container-obsoletecheck.drl";
     public static final String VM_OBSOLETE_CHECK_DROOL_FILE = "obsoletecheck.drl";
     public static final String MIN_COUNT = "MIN_COUNT";
     
@@ -173,8 +164,6 @@ public class StratosConstants {
     // Autoscaler member timeout constants
     public static final String PENDING_VM_MEMBER_EXPIRY_TIMEOUT = "autoscaler.member.vm.pendingMemberExpiryTimeout";
     public static final String OBSOLETED_VM_MEMBER_EXPIRY_TIMEOUT = "autoscaler.member.vm.obsoletedMemberExpiryTimeout";
-    public static final String PENDING_CONTAINER_MEMBER_EXPIRY_TIMEOUT = "autoscaler.member.container.pendingMemberExpiryTimeout";
-    public static final String OBSOLETED_CONTAINER_MEMBER_EXPIRY_TIMEOUT = "autoscaler.member.container.obsoletedMemberExpiryTimeout";
 
 	public static final String FILTER_VALUE_SEPARATOR = ",";
 	public static final String TOPOLOGY_SERVICE_FILTER = "stratos.topology.service.filter";
@@ -187,9 +176,7 @@ public class StratosConstants {
 	public static final String DEFAULT_LOAD_BALANCER = "default.load.balancer";
 	public static final String NO_LOAD_BALANCER = "no.load.balancer";
 	public static final String EXISTING_LOAD_BALANCERS = "existing.load.balancers";
-	public static final String LOAD_BALANCED_SERVICE_TYPE = "load.balanced.service.type";
 
     public static final long HAZELCAST_INSTANCE_INIT_TIMEOUT = 300000; // 5 min
-    public static final String DYNAMIC_PAYLOAD = "DYNAMIC_PAYLOAD";
 }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Labels.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Labels.java
b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Labels.java
index dfcf082..59abcdc 100644
--- a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Labels.java
+++ b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Labels.java
@@ -20,10 +20,14 @@
  */
 package org.apache.stratos.kubernetes.client.model;
 
+import java.io.Serializable;
+
 /**
  * Labels can contain a list of key/value pairs. Currently we are only using one key/value
pair: name/value.
  */
-public class Labels {
+public class Labels implements Serializable {
+
+	private static final long serialVersionUID = -9019445613544931617L;
 
 	private String name;
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Selector.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Selector.java
b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Selector.java
index 13f461c..c1d7d8d 100644
--- a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Selector.java
+++ b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Selector.java
@@ -20,11 +20,11 @@
  */
 package org.apache.stratos.kubernetes.client.model;
 
-/**
- *
- *
- */
-public class Selector {
+import java.io.Serializable;
+
+public class Selector implements Serializable {
+
+	private static final long serialVersionUID = 8384843252305848574L;
 
 	private String name;
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Service.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Service.java
b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Service.java
index 9cc904e..6a65a55 100644
--- a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Service.java
+++ b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Service.java
@@ -20,6 +20,7 @@
  */
 package org.apache.stratos.kubernetes.client.model;
 
+import java.io.Serializable;
 import java.util.Arrays;
 
 import javax.xml.bind.annotation.XmlRootElement;
@@ -30,7 +31,9 @@ import javax.xml.bind.annotation.XmlRootElement;
  *
  */
 @XmlRootElement
-public class Service {
+public class Service implements Serializable {
+
+	private static final long serialVersionUID = 7766915353839414993L;
 
 	private String kind;
 	private String id;

http://git-wip-us.apache.org/repos/asf/stratos/blob/69d2f343/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 83f99a2..259cace 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:ns="http://api.autoscaler.stratos.apache.org" xmlns:ax27="http://common.stratos.apache.org/xsd"
xmlns:ax25="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax26="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"
xmlns:ax23="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax217="http://exception.autoscaler.stratos.apache.org/xsd"
xmlns:ax21="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ax214="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:ax220="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax212="http://application.exception.autoscaler.stratos.apache.org/xsd"
xmlns:ax222="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:wsaw="http://www.w3.org/2006/05/a
 ddressing/wsdl" 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://api.autoscaler.stratos.apache.org">
+<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns="http://api.autoscaler.stratos.apache.org" xmlns:ax27="http://common.stratos.apache.org/xsd"
xmlns:ax25="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax26="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"
xmlns:ax23="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax217="http://exception.autoscaler.stratos.apache.org/xsd"
xmlns:ax21="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ax214="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:ax220="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax212="http://application.exception.autoscaler.stratos.apache.org/xsd"
xmlns:ax222="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:wsaw="http://www.w3.org/2006/05/a
 ddressing/wsdl" 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://api.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,15 +8,15 @@
                     <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="ax23:LoadThresholds"/>
+                    <xs:element minOccurs="0" name="loadThresholds" nillable="true" type="ax21:LoadThresholds"/>
                     <xs:element minOccurs="0" name="tenantId" type="xs:int"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="LoadThresholds">
                 <xs:sequence>
-                    <xs:element minOccurs="0" name="loadAverage" nillable="true" type="ax23:LoadAverageThresholds"/>
-                    <xs:element minOccurs="0" name="memoryConsumption" nillable="true"
type="ax23:MemoryConsumptionThresholds"/>
-                    <xs:element minOccurs="0" name="requestsInFlight" nillable="true"
type="ax23:RequestsInFlightThresholds"/>
+                    <xs:element minOccurs="0" name="loadAverage" nillable="true" type="ax21:LoadAverageThresholds"/>
+                    <xs:element minOccurs="0" name="memoryConsumption" nillable="true"
type="ax21:MemoryConsumptionThresholds"/>
+                    <xs:element minOccurs="0" name="requestsInFlight" nillable="true"
type="ax21:RequestsInFlightThresholds"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="LoadAverageThresholds">
@@ -200,9 +200,9 @@
                 </xs:sequence>
             </xs:complexType>
         </xs:schema>
-        <xs:schema xmlns:ax24="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd"
xmlns:ax216="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:ax22="http://policy.exception.autoscaler.stratos.apache.org/xsd"
xmlns:ax219="http://common.stratos.apache.org/xsd" xmlns:ax218="http://exception.autoscaler.stratos.apache.org/xsd"
xmlns:ax221="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax213="http://application.exception.autoscaler.stratos.apache.org/xsd"
xmlns:ax223="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax210="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"
xmlns:ax211="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"
attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://api.autoscaler.stratos.apache.org">
-            <xs:import namespace="http://policy.exception.autoscaler.stratos.apache.org/xsd"/>
+        <xs:schema xmlns:ax24="http://policy.exception.autoscaler.stratos.apache.org/xsd"
xmlns:ax216="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:ax22="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd"
xmlns:ax219="http://common.stratos.apache.org/xsd" xmlns:ax218="http://exception.autoscaler.stratos.apache.org/xsd"
xmlns:ax221="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax213="http://application.exception.autoscaler.stratos.apache.org/xsd"
xmlns:ax223="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax210="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"
xmlns:ax211="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"
attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://api.autoscaler.stratos.apache.org">
             <xs:import namespace="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd"/>
+            <xs:import namespace="http://policy.exception.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://application.exception.autoscaler.stratos.apache.org/xsd"/>
@@ -211,17 +211,29 @@
             <xs:import namespace="http://common.stratos.apache.org/xsd"/>
             <xs:import namespace="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd"/>
             <xs:import namespace="http://pojo.autoscaler.stratos.apache.org/xsd"/>
+            <xs:element name="getAutoScalingPolicies">
+                <xs:complexType>
+                    <xs:sequence/>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="getAutoScalingPoliciesResponse">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return"
nillable="true" type="ax21:AutoscalePolicy"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
             <xs:element name="AutoScalerServiceInvalidPolicyException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidPolicyException" nillable="true"
type="ax21:InvalidPolicyException"/>
+                        <xs:element minOccurs="0" name="InvalidPolicyException" nillable="true"
type="ax23:InvalidPolicyException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
             <xs:element name="addAutoScalingPolicy">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="autoscalePolicy" nillable="true"
type="ax23:AutoscalePolicy"/>
+                        <xs:element minOccurs="0" name="autoscalePolicy" nillable="true"
type="ax21:AutoscalePolicy"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -235,7 +247,7 @@
             <xs:element name="updateAutoScalingPolicy">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="autoscalePolicy" nillable="true"
type="ax23:AutoscalePolicy"/>
+                        <xs:element minOccurs="0" name="autoscalePolicy" nillable="true"
type="ax21:AutoscalePolicy"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -270,7 +282,7 @@
             <xs:element name="getAutoscalingPolicyResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax23:AutoscalePolicy"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax21:AutoscalePolicy"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -440,18 +452,6 @@
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getAutoScalingPolicies">
-                <xs:complexType>
-                    <xs:sequence/>
-                </xs:complexType>
-            </xs:element>
-            <xs:element name="getAutoScalingPoliciesResponse">
-                <xs:complexType>
-                    <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return"
nillable="true" type="ax23:AutoscalePolicy"/>
-                    </xs:sequence>
-                </xs:complexType>
-            </xs:element>
             <xs:element name="undeployServiceGroup">
                 <xs:complexType>
                     <xs:sequence>


Mime
View raw message