stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [4/7] stratos git commit: Introducing KubernetesIaas class, MemberContext.clusterInstanceId, removing Cartridge.deployerType
Date Sat, 20 Dec 2014 21:56:42 GMT
http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
index 2d6875d..e67b26c 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
@@ -18,12 +18,10 @@
  */
 package org.apache.stratos.cloud.controller.services.impl;
 
-import org.apache.commons.collections.ListUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.concurrent.PartitionValidatorCallable;
-import org.apache.stratos.cloud.controller.concurrent.ScheduledThreadExecutor;
 import org.apache.stratos.cloud.controller.concurrent.ThreadExecutor;
 import org.apache.stratos.cloud.controller.config.CloudControllerConfig;
 import org.apache.stratos.cloud.controller.context.CloudControllerContext;
@@ -31,30 +29,18 @@ import org.apache.stratos.cloud.controller.domain.*;
 import org.apache.stratos.cloud.controller.domain.Cartridge;
 import org.apache.stratos.cloud.controller.domain.Dependencies;
 import org.apache.stratos.cloud.controller.exception.*;
-import org.apache.stratos.cloud.controller.functions.ContainerClusterContextToKubernetesService;
-import org.apache.stratos.cloud.controller.functions.ContainerClusterContextToReplicationController;
-import org.apache.stratos.cloud.controller.functions.PodToMemberContext;
 import org.apache.stratos.cloud.controller.iaases.Iaas;
 import org.apache.stratos.cloud.controller.messaging.publisher.StatisticsDataPublisher;
+import org.apache.stratos.cloud.controller.messaging.publisher.TopologyEventPublisher;
 import org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder;
-import org.apache.stratos.cloud.controller.messaging.topology.TopologyEventPublisher;
 import org.apache.stratos.cloud.controller.messaging.topology.TopologyManager;
 import org.apache.stratos.cloud.controller.services.CloudControllerService;
 import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
 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.constants.StratosConstants;
 import org.apache.stratos.common.kubernetes.KubernetesGroup;
 import org.apache.stratos.common.kubernetes.KubernetesHost;
 import org.apache.stratos.common.kubernetes.KubernetesMaster;
-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.Label;
-import org.apache.stratos.kubernetes.client.model.Pod;
-import org.apache.stratos.kubernetes.client.model.ReplicationController;
-import org.apache.stratos.kubernetes.client.model.Service;
 import org.apache.stratos.messaging.domain.topology.*;
 import org.apache.stratos.messaging.event.topology.MemberReadyToShutdownEvent;
 
@@ -73,6 +59,8 @@ public class CloudControllerServiceImpl implements CloudControllerService {
 
     private static final Log log = LogFactory.getLog(CloudControllerServiceImpl.class);
 
+    private static final String PERSISTENCE_MAPPING = "PERSISTENCE_MAPPING";
+
     private CloudControllerContext cloudControllerContext = CloudControllerContext.getInstance();
 
     public CloudControllerServiceImpl() {
@@ -101,17 +89,18 @@ public class CloudControllerServiceImpl implements CloudControllerService {
 
         List<IaasProvider> iaasProviders = cartridge.getIaases();
 
-        if (!StratosConstants.KUBERNETES_DEPLOYER_TYPE.equals(cartridge.getDeployerType())) {
-            if (iaasProviders == null || iaasProviders.isEmpty()) {
-                String msg = "Invalid cartridge definition, iaas providers not found: [cartridge-type] " + cartridgeConfig.getType();
-                log.error(msg);
-                throw new InvalidCartridgeDefinitionException(msg);
-            }
-
-            for (IaasProvider iaasProvider : iaasProviders) {
-                CloudControllerServiceUtil.buildIaas(iaasProvider);
-            }
-        }
+        // TODO: Fix kubernetes config
+//        if (!StratosConstants.KUBERNETES_DEPLOYER_TYPE.equals(cartridge.getDeployerType())) {
+//            if (iaasProviders == null || iaasProviders.isEmpty()) {
+//                String msg = "Invalid cartridge definition, iaas providers not found: [cartridge-type] " + cartridgeConfig.getType();
+//                log.error(msg);
+//                throw new InvalidCartridgeDefinitionException(msg);
+//            }
+//
+//            for (IaasProvider iaasProvider : iaasProviders) {
+//                CloudControllerServiceUtil.buildIaas(iaasProvider);
+//            }
+//        }
 
         // TODO transaction begins
         String cartridgeType = cartridge.getType();
@@ -319,76 +308,77 @@ public class CloudControllerServiceImpl implements CloudControllerService {
     }
 
     @Override
-    public MemberContext startInstance(MemberContext memberContext) throws
-            UnregisteredCartridgeException, InvalidIaasProviderException {
+    public MemberContext[] startInstances(InstanceContext[] instanceContexts) throws CartridgeNotFoundException, InvalidIaasProviderException {
 
-        if (log.isDebugEnabled()) {
-            log.debug("CloudControllerServiceImpl:startInstance");
-        }
+        handleNullObject(instanceContexts, "Instance start-up failed, member contexts is null");
 
-        handleNullObject(memberContext, "Instance start-up failed. Member is null.");
+        List<MemberContext> memberContextList = new ArrayList<MemberContext>();
+        for(InstanceContext instanceContext : instanceContexts) {
+            if(instanceContext != null) {
+                MemberContext memberContext = startInstance(instanceContext);
+                memberContextList.add(memberContext);
+            }
+        }
+        MemberContext[] memberContextsArray = memberContextList.toArray(new MemberContext[memberContextList.size()]);
+        return memberContextsArray;
+    }
 
-        String clusterId = memberContext.getClusterId();
-        Partition partition = memberContext.getPartition();
+    public MemberContext startInstance(InstanceContext instanceContext) throws
+            CartridgeNotFoundException, InvalidIaasProviderException {
 
+        // Validate instance context
+        handleNullObject(instanceContext, "Could not start instance, instance context is null");
         if (log.isDebugEnabled()) {
-            log.debug("Received an instance spawn request : " + memberContext);
+            log.debug("Starting up instance: " + instanceContext);
         }
 
-        handleNullObject(partition, "Instance start-up failed. Specified Partition is null. " +
-                memberContext);
+        // Validate partition
+        Partition partition = instanceContext.getPartition();
+        handleNullObject(partition, "Could not start instance, partition is null");
 
+        // Validate cluster
         String partitionId = partition.getId();
-        ClusterContext ctxt = CloudControllerContext.getInstance().getClusterContext(clusterId);
-
-        handleNullObject(ctxt, "Instance start-up failed. Invalid cluster id. " + memberContext);
-
-        String cartridgeType = ctxt.getCartridgeType();
+        String clusterId = instanceContext.getClusterId();
+        ClusterContext clusterContext = CloudControllerContext.getInstance().getClusterContext(clusterId);
+        handleNullObject(clusterContext, "Could not start instance, cluster context not found: [cluster-id] " + clusterId);
 
+        // Validate cartridge
+        String cartridgeType = clusterContext.getCartridgeType();
         Cartridge cartridge = CloudControllerContext.getInstance().getCartridge(cartridgeType);
-
         if (cartridge == null) {
-            String msg =
-                    "Instance start-up failed. No matching Cartridge found [cartridge-type] " + cartridgeType + ". " +
-                            memberContext.toString();
+            String msg = "Could not startup instance, cartridge not found: [cartridge-type] " + cartridgeType;
             log.error(msg);
-            throw new UnregisteredCartridgeException(msg);
+            throw new CartridgeNotFoundException(msg);
         }
 
-        memberContext.setCartridgeType(cartridgeType);
-
-
+        // Validate iaas provider
         IaasProvider iaasProvider = cartridge.getIaasProviderOfPartition(partitionId);
         if (iaasProvider == null) {
-            if (log.isDebugEnabled()) {
-                log.debug("IaasToPartitionMap " + cartridge.hashCode()
-                        + " for cartridge " + cartridgeType + " and for partition: " + partitionId);
-            }
-            String msg = "Instance start-up failed. "
-                    + "There's no IaaS provided for the partition: "
-                    + partitionId
-                    + " and for the Cartridge type: "
-                    + cartridgeType
-                    + ". Only following "
-                    + "partitions can be found in this Cartridge: "
-                    + cartridge.getPartitionToIaasProvider().keySet()
-                    .toString() + ". " + memberContext.toString()
-                    + ". ";
-            log.fatal(msg);
+            String msg = String.format("Could not start instance, " +
+                    "IaaS provider not found in cartridge %s for partition %s." +
+                    "Only following partitions are found: %s ", cartridgeType, partitionId,
+                    cartridge.getPartitionToIaasProvider().keySet().toString());
+            log.error(msg);
             throw new InvalidIaasProviderException(msg);
         }
-        String type = iaasProvider.getType();
+
         try {
-            // generating the Unique member ID...
+            // Generate member ID
             String memberID = generateMemberId(clusterId);
+
+            // Create member context
+            MemberContext memberContext = createMemberContext(instanceContext);
             memberContext.setMemberId(memberID);
-            // have to add memberID to the payload
-            StringBuilder payload = new StringBuilder(ctxt.getPayload());
+            memberContext.setCartridgeType(cartridgeType);
+
+            // Prepare payload
+            StringBuilder payload = new StringBuilder(clusterContext.getPayload());
             addToPayload(payload, "MEMBER_ID", memberID);
+            addToPayload(payload, "INSTANCE_ID", memberContext.getInstanceId());
+            addToPayload(payload, "CLUSTER_INSTANCE_ID", memberContext.getClusterInstanceId());
             addToPayload(payload, "LB_CLUSTER_ID", memberContext.getLbClusterId());
             addToPayload(payload, "NETWORK_PARTITION_ID", memberContext.getNetworkPartitionId());
             addToPayload(payload, "PARTITION_ID", partitionId);
-            addToPayload(payload, "INSTANCE_ID", memberContext.getInstanceId());
             if (memberContext.getProperties() != null) {
                 org.apache.stratos.common.Properties properties = memberContext.getProperties();
                 if (properties != null) {
@@ -399,61 +389,51 @@ public class CloudControllerServiceImpl implements CloudControllerService {
             }
 
             Iaas iaas = iaasProvider.getIaas();
-
-            if (log.isDebugEnabled()) {
-                log.debug("Payload: " + payload.toString());
-            }
-
-            if (iaas == null) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Iaas is null of Iaas Provider: " + type + ". Trying to build IaaS...");
-                }
-                try {
-                    iaas = CloudControllerServiceUtil.buildIaas(iaasProvider);
-                } catch (InvalidIaasProviderException e) {
-                    String msg = "Instance start up failed. " + memberContext.toString() +
-                            "Unable to build Iaas of this IaasProvider [Provider] : " + type + ". Cause: " + e.getMessage();
-                    log.error(msg, e);
-                    throw new InvalidIaasProviderException(msg, e);
-                }
-
-            }
-
-            if (ctxt.isVolumeRequired()) {
-                if (ctxt.getVolumes() != null) {
-                    for (Volume volume : ctxt.getVolumes()) {
-
+            if (clusterContext.isVolumeRequired()) {
+                if (clusterContext.getVolumes() != null) {
+                    for (Volume volume : clusterContext.getVolumes()) {
                         if (volume.getId() == null) {
-                            // create a new volume
+                            // Create a new volume
                             createVolumeAndSetInClusterContext(volume, iaasProvider);
                         }
                     }
                 }
             }
 
-            if (ctxt.isVolumeRequired()) {
-                addToPayload(payload, "PERSISTENCE_MAPPING", getPersistencePayload(ctxt, iaas).toString());
+            if (clusterContext.isVolumeRequired()) {
+                addToPayload(payload, PERSISTENCE_MAPPING, getPersistencePayload(clusterContext, iaas).toString());
+            }
+
+            if (log.isDebugEnabled()) {
+                log.debug("Payload: " + payload.toString());
             }
+
             iaasProvider.setPayload(payload.toString().getBytes());
             iaas.setDynamicPayload(iaasProvider.getPayload());
 
-            //Start instance start up in a new thread
+            // Start instance in a new thread
             ThreadExecutor exec = ThreadExecutor.getInstance();
             if (log.isDebugEnabled()) {
-                log.debug("Cloud Controller is starting the instance start up thread.");
+                log.debug("Cloud Controller is starting the instance creator thread...");
             }
-            exec.execute(new InstanceCreator(memberContext, iaasProvider, cartridgeType));
-
-            log.info("Instance is successfully starting up. " + memberContext.toString());
-
+            exec.execute(new InstanceCreator(memberContext, iaasProvider));
             return memberContext;
-
         } catch (Exception e) {
-            String msg = "Failed to start an instance. " + memberContext.toString() + " Cause: " + e.getMessage();
+            String msg = "Failed to start instance: " + instanceContext.toString();
             log.error(msg, e);
             throw new IllegalStateException(msg, e);
         }
+    }
 
+    private MemberContext createMemberContext(InstanceContext instanceContext) {
+        MemberContext memberContext = new MemberContext();
+        memberContext.setCartridgeType(instanceContext.getCartridgeType());
+        memberContext.setClusterId(instanceContext.getClusterId());
+        memberContext.setClusterInstanceId(instanceContext.getClusterInstanceId());
+        memberContext.setNetworkPartitionId(instanceContext.getNetworkPartitionId());
+        memberContext.setPartition(instanceContext.getPartition());
+        memberContext.setProperties(instanceContext.getProperties());
+        return memberContext;
     }
 
     private void createVolumeAndSetInClusterContext(Volume volume,
@@ -527,11 +507,11 @@ public class CloudControllerServiceImpl implements CloudControllerService {
             throw new InvalidMemberException(msg);
         }
 
-        if ((memberContext.getNodeId() == null) && (memberContext.getInstanceId() == null)) {
+        if (StringUtils.isBlank(memberContext.getInstanceId())) {
             if (log.isErrorEnabled()) {
                 log.error(String.format(
-                        "Member termination failed, node id and instance id are null: [member-id] %s " +
-                                "Removing member from topology.",
+                        "Member termination failed, instance id is blank: [member-id] %s " +
+                                ", removing member from topology...",
                         memberContext.getMemberId()));
             }
             CloudControllerServiceUtil.executeMemberTerminationPostProcess(memberContext);
@@ -616,10 +596,10 @@ public class CloudControllerServiceImpl implements CloudControllerService {
             MemberReadyToShutdownEvent memberReadyToShutdownEvent = new MemberReadyToShutdownEvent(
                     member.getServiceName(),
                     member.getClusterId(),
+                    member.getClusterInstanceId(), member.getMemberId(),
+                    member.getInstanceId(),
                     member.getNetworkPartitionId(),
-                    member.getPartitionId(),
-                    member.getMemberId(),
-                    member.getInstanceId());
+                    member.getPartitionId());
 
             member.setStatus(MemberStatus.ReadyToShutDown);
             log.info("Member Ready to shut down event adding status started");
@@ -667,45 +647,35 @@ public class CloudControllerServiceImpl implements CloudControllerService {
 
     @Override
     public boolean registerService(Registrant registrant)
-            throws UnregisteredCartridgeException {
+            throws CartridgeNotFoundException {
 
         String cartridgeType = registrant.getCartridgeType();
-        handleNullObject(cartridgeType, "Service registration failed. Cartridge Type is null.");
+        handleNullObject(cartridgeType, "Service registration failed, cartridge Type is null.");
 
         String clusterId = registrant.getClusterId();
-        handleNullObject(clusterId, "Service registration failed. Cluster id is null.");
+        handleNullObject(clusterId, "Service registration failed, cluster id is null.");
 
         String payload = registrant.getPayload();
-        handleNullObject(payload, "Service registration failed. Payload is null.");
+        handleNullObject(payload, "Service registration failed, payload is null.");
 
         String hostName = registrant.getHostName();
-        handleNullObject(hostName, "Service registration failed. Hostname is null.");
+        handleNullObject(hostName, "Service registration failed, hostname is null.");
 
         Cartridge cartridge = null;
         if ((cartridge = CloudControllerContext.getInstance().getCartridge(cartridgeType)) == null) {
-
             String msg = "Registration of cluster: " + clusterId +
-                    " failed. - Unregistered cartridge type: " + cartridgeType;
+                    " failed, cartridge not found: [cartridge-type] " + cartridgeType;
             log.error(msg);
-            throw new UnregisteredCartridgeException(msg);
+            throw new CartridgeNotFoundException(msg);
         }
 
-        Properties props = CloudControllerUtil.toJavaUtilProperties(registrant.getProperties());
-        String property = props.getProperty(CloudControllerConstants.IS_LOAD_BALANCER);
+        Properties properties = CloudControllerUtil.toJavaUtilProperties(registrant.getProperties());
+        String property = properties.getProperty(CloudControllerConstants.IS_LOAD_BALANCER);
         boolean isLb = property != null ? Boolean.parseBoolean(property) : false;
-
-        //TODO fix the properties issue
-        /*ClusterContext ctxt = buildClusterContext(cartridge, clusterId,
-        payload, hostName, props, isLb, registrant.getPersistence());
-
-
-        CloudControllerContext.getInstance().addClusterContext(ctxt);*/
         TopologyBuilder.handleClusterCreated(registrant, isLb);
-
         CloudControllerContext.getInstance().persist();
 
-        log.info("Successfully registered: " + registrant);
-
+        log.info("Successfully registered service: " + registrant);
         return true;
     }
 
@@ -737,7 +707,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
     }
 
     @Override
-    public CartridgeInfo getCartridgeInfo(String cartridgeType) throws UnregisteredCartridgeException {
+    public CartridgeInfo getCartridgeInfo(String cartridgeType) throws CartridgeNotFoundException {
         Cartridge cartridge = CloudControllerContext.getInstance().getCartridge(cartridgeType);
         if (cartridge != null) {
             return CloudControllerUtil.toCartridgeInfo(cartridge);
@@ -745,7 +715,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
 
         String msg = "Could not find cartridge: [type] " + cartridgeType;
         log.error(msg);
-        throw new UnregisteredCartridgeException(msg);
+        throw new CartridgeNotFoundException(msg);
     }
 
     @Override
@@ -765,10 +735,10 @@ public class CloudControllerServiceImpl implements CloudControllerService {
             throw new UnregisteredClusterException(msg);
         }
 
-        // if it's a kubernetes cluster
-        if (StratosConstants.KUBERNETES_DEPLOYER_TYPE.equals(cartridge.getDeployerType())) {
-            unregisterDockerService(clusterId_);
-        } else {
+        // TODO: Fix kubernetes config
+//        if (StratosConstants.KUBERNETES_DEPLOYER_TYPE.equals(cartridge.getDeployerType())) {
+//            unregisterDockerService(clusterId_);
+//        } else {
             Runnable terminateInTimeout = new Runnable() {
                 @Override
                 public void run() {
@@ -877,30 +847,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
             };
             new Thread(terminateInTimeout).start();
             new Thread(unregister).start();
-        }
-    }
-
-    @Override
-    public void unregisterDockerService(String clusterId)
-            throws UnregisteredClusterException {
-        Lock lock = null;
-        try {
-            lock = CloudControllerContext.getInstance().acquireClusterContextWriteLock();
-            // terminate all kubernetes units
-            try {
-                terminateContainers(clusterId);
-            } catch (InvalidClusterException e) {
-                String msg = "Docker instance termination fails for cluster: " + clusterId;
-                log.error(msg, e);
-                throw new UnregisteredClusterException(msg, e);
-            }
-            // send cluster removal notifications and update the state
-            onClusterRemoval(clusterId);
-        } finally {
-            if (lock != null) {
-                CloudControllerContext.getInstance().releaseWriteLock(lock);
-            }
-        }
+   //     }
     }
 
     /**
@@ -1023,184 +970,6 @@ public class CloudControllerServiceImpl implements CloudControllerService {
         return CloudControllerContext.getInstance().getClusterContext(clusterId);
     }
 
-    @Override
-    public MemberContext[] startContainers(ContainerClusterContext containerClusterContext)
-            throws UnregisteredCartridgeException {
-        Lock lock = null;
-        try {
-            lock = CloudControllerContext.getInstance().acquireMemberContextWriteLock();
-
-            if (log.isDebugEnabled()) {
-                log.debug("CloudControllerServiceImpl:startContainers");
-            }
-
-            handleNullObject(containerClusterContext, "Container start-up failed. ContainerClusterContext is null.");
-
-            String clusterId = containerClusterContext.getClusterId();
-            handleNullObject(clusterId, "Container start-up failed. Cluster id is null.");
-
-            Partition partition = containerClusterContext.getPartition();
-            handleNullObject(partition, "Container start-up failed. Null partition found in ContainerClusterContext.");
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received a container spawn request : " + containerClusterContext.toString());
-            }
-
-            ClusterContext ctxt = CloudControllerContext.getInstance().getClusterContext(clusterId);
-            handleNullObject(ctxt, "Container start-up failed. Invalid cluster id. " + containerClusterContext.toString());
-
-            String cartridgeType = ctxt.getCartridgeType();
-
-            Cartridge cartridge = CloudControllerContext.getInstance().getCartridge(cartridgeType);
-
-            if (cartridge == null) {
-                String msg = "Instance start-up failed. No matching Cartridge found [type] " + cartridgeType + ". " +
-                        containerClusterContext.toString();
-                log.error(msg);
-                throw new UnregisteredCartridgeException(msg);
-            }
-
-            try {
-                String minReplicas =
-                        validateProperty(StratosConstants.MIN_COUNT, containerClusterContext.getProperties(),
-                                containerClusterContext.toString());
-                String kubernetesClusterId =
-                        validateProperty(StratosConstants.KUBERNETES_CLUSTER_ID, partition.getProperties(),
-                                partition.toString());
-
-                KubernetesGroup kubernetesGroup =
-                        CloudControllerContext.getInstance().getKubernetesGroup(kubernetesClusterId);
-                handleNullObject(kubernetesGroup, "Container start-up failed. Kubernetes group not found for id: "
-                        + kubernetesClusterId);
-
-                String kubernetesMasterIp = kubernetesGroup.getKubernetesMaster().getHostIpAddress();
-                PortRange kubernetesPortRange = kubernetesGroup.getPortRange();
-                // optional
-                String kubernetesMasterPort =
-                        CloudControllerUtil.getProperty(kubernetesGroup.getKubernetesMaster().getProperties(),
-                                StratosConstants.KUBERNETES_MASTER_PORT,
-                                StratosConstants.KUBERNETES_MASTER_DEFAULT_PORT);
-
-                KubernetesClusterContext kubClusterContext = getKubernetesClusterContext(kubernetesClusterId,
-                        kubernetesMasterIp, kubernetesMasterPort, kubernetesPortRange.getLower(), kubernetesPortRange.getUpper());
-                KubernetesApiClient kubApi = kubClusterContext.getKubApi();
-
-                // first let's create a replication controller.
-                ContainerClusterContextToReplicationController controllerFunction = new ContainerClusterContextToReplicationController();
-                ReplicationController controller = controllerFunction.apply(containerClusterContext);
-
-                if (log.isDebugEnabled()) {
-                    log.debug("Cloud Controller is delegating request to start a replication controller " + controller +
-                            " for " + containerClusterContext + " to Kubernetes layer.");
-                }
-
-                kubApi.createReplicationController(controller);
-
-                if (log.isDebugEnabled()) {
-                    log.debug("Cloud Controller successfully started the controller "
-                            + controller + " via Kubernetes layer.");
-                }
-
-                // secondly let's create a kubernetes service proxy to load balance these containers
-                ContainerClusterContextToKubernetesService serviceFunction = new ContainerClusterContextToKubernetesService();
-                Service service = serviceFunction.apply(containerClusterContext);
-
-                if (log.isDebugEnabled()) {
-                    log.debug("Cloud Controller is delegating request to start a service " + service +
-                            " for " + containerClusterContext + " to Kubernetes layer.");
-                }
-
-                kubApi.createService(service);
-
-                // set host port and update
-                Property allocatedServiceHostPortProp = new Property();
-                allocatedServiceHostPortProp.setName(StratosConstants.ALLOCATED_SERVICE_HOST_PORT);
-                allocatedServiceHostPortProp.setValue(String.valueOf(service.getPort()));
-                ctxt.getProperties().addProperty(allocatedServiceHostPortProp);
-                CloudControllerContext.getInstance().addClusterContext(ctxt);
-
-                if (log.isDebugEnabled()) {
-                    log.debug("Cloud Controller successfully started the service "
-                            + controller + " via Kubernetes layer.");
-                }
-
-                // create a label query
-                Label l = new Label();
-                l.setName(clusterId);
-                // execute the label query
-                Pod[] newlyCreatedPods = new Pod[0];
-                int expectedCount = Integer.parseInt(minReplicas);
-
-                for (int i = 0; i < expectedCount; i++) {
-                    newlyCreatedPods = kubApi.getSelectedPods(new Label[]{l});
-
-                    if (log.isDebugEnabled()) {
-
-                        log.debug("Pods Count: " + newlyCreatedPods.length + " for cluster: " + clusterId);
-                    }
-                    if (newlyCreatedPods.length == expectedCount) {
-                        break;
-                    }
-                    Thread.sleep(10000);
-                }
-
-                if (newlyCreatedPods.length == 0) {
-                    if (log.isDebugEnabled()) {
-                        log.debug(String.format("Pods are not created for cluster : %s, hence deleting the service", clusterId));
-                    }
-                    terminateContainers(clusterId);
-                    return new MemberContext[0];
-                }
-
-                if (log.isDebugEnabled()) {
-
-                    log.debug(String.format("Pods created : %s for cluster : %s", newlyCreatedPods.length, clusterId));
-                }
-
-                List<MemberContext> memberContexts = new ArrayList<MemberContext>();
-
-                PodToMemberContext podToMemberContextFunc = new PodToMemberContext();
-                // generate Member Contexts
-                for (Pod pod : newlyCreatedPods) {
-                    MemberContext context = podToMemberContextFunc.apply(pod);
-                    context.setCartridgeType(cartridgeType);
-                    context.setClusterId(clusterId);
-
-                    context.setProperties(CloudControllerUtil.addProperty(context
-                                    .getProperties(), StratosConstants.ALLOCATED_SERVICE_HOST_PORT,
-                            String.valueOf(service.getPort())));
-
-                    CloudControllerContext.getInstance().addMemberContext(context);
-
-                    // wait till Pod status turns to running and send member spawned.
-                    ScheduledThreadExecutor exec = ScheduledThreadExecutor.getInstance();
-                    if (log.isDebugEnabled()) {
-                        log.debug("Cloud Controller is starting the instance start up thread.");
-                    }
-                    CloudControllerContext.getInstance().addScheduledFutureJob(context.getMemberId(), exec.schedule(new PodActivationWatcher(pod.getId(), context, kubApi), 5000));
-
-                    memberContexts.add(context);
-                }
-
-                // persist in registry
-                CloudControllerContext.getInstance().persist();
-
-                log.info("Kubernetes entities are successfully starting up: " + memberContexts);
-
-                return memberContexts.toArray(new MemberContext[0]);
-
-            } catch (Exception e) {
-                String msg = "Failed to start an instance. " + containerClusterContext.toString() + " Cause: " + e.getMessage();
-                log.error(msg, e);
-                throw new IllegalStateException(msg, e);
-            }
-        } finally {
-            if (lock != null) {
-                CloudControllerContext.getInstance().releaseWriteLock(lock);
-            }
-        }
-    }
-
 //    private String validateProperty(String property, ClusterContext ctxt) {
 //
 //        String propVal = CloudControllerUtil.getProperty(ctxt.getProperties(), property);
@@ -1224,330 +993,12 @@ public class CloudControllerServiceImpl implements CloudControllerService {
 //
 //    }
 
-    private String validateProperty(String property, org.apache.stratos.common.Properties properties, String object) {
-
-        String propVal = CloudControllerUtil.getProperty(properties, property);
-        handleNullObject(propVal, "Property validation failed. Cannot find property: '" + property + " in " + object);
-        return propVal;
-
-    }
-
-    private KubernetesClusterContext getKubernetesClusterContext(String kubernetesClusterId, String kubernetesMasterIp,
-                                                                 String kubernetesMasterPort, int upperPort, int lowerPort) {
-
-        KubernetesClusterContext origCtxt =
-                CloudControllerContext.getInstance().getKubernetesClusterContext(kubernetesClusterId);
-        KubernetesClusterContext newCtxt =
-                new KubernetesClusterContext(kubernetesClusterId, kubernetesMasterIp,
-                        kubernetesMasterPort, upperPort, lowerPort);
-
-        if (origCtxt == null) {
-            CloudControllerContext.getInstance().addKubernetesClusterContext(newCtxt);
-            return newCtxt;
-        }
-
-        if (!origCtxt.equals(newCtxt)) {
-            // if for some reason master IP etc. have changed
-            newCtxt.setAvailableHostPorts(origCtxt.getAvailableHostPorts());
-            CloudControllerContext.getInstance().addKubernetesClusterContext(newCtxt);
-            return newCtxt;
-        } else {
-            return origCtxt;
-        }
-    }
-
-    @Override
-    public MemberContext[] terminateContainers(String clusterId)
-            throws InvalidClusterException {
-        Lock lock = null;
-        try {
-            lock = CloudControllerContext.getInstance().acquireMemberContextWriteLock();
-
-            ClusterContext ctxt = CloudControllerContext.getInstance().getClusterContext(clusterId);
-            handleNullObject(ctxt, "Kubernetes units temrination failed. Invalid cluster id. " + clusterId);
-
-            String kubernetesClusterId = CloudControllerUtil.getProperty(ctxt.getProperties(),
-                    StratosConstants.KUBERNETES_CLUSTER_ID);
-            handleNullObject(kubernetesClusterId, "Kubernetes units termination failed. Cannot find '" +
-                    StratosConstants.KUBERNETES_CLUSTER_ID + "'. " + ctxt);
-
-            KubernetesClusterContext kubClusterContext = CloudControllerContext.getInstance().getKubernetesClusterContext(kubernetesClusterId);
-            handleNullObject(kubClusterContext, "Kubernetes units termination failed. Cannot find a matching Kubernetes Cluster for cluster id: "
-                    + kubernetesClusterId);
-
-            KubernetesApiClient kubApi = kubClusterContext.getKubApi();
-            // delete the service
-            try {
-                kubApi.deleteService(CloudControllerUtil.getCompatibleId(clusterId));
-            } catch (KubernetesClientException e) {
-                // we're not going to throw this error, but proceed with other deletions
-                log.error("Failed to delete Kubernetes service with id: " + clusterId, e);
-            }
-
-            // set replicas=0 for the replication controller
-            try {
-                kubApi.updateReplicationController(clusterId, 0);
-            } catch (KubernetesClientException e) {
-                // we're not going to throw this error, but proceed with other deletions
-                log.error("Failed to update Kubernetes Controller with id: " + clusterId, e);
-            }
-
-            // delete pods forcefully
-            try {
-                // create a label query
-                Label l = new Label();
-                l.setName(clusterId);
-                // execute the label query
-                Pod[] pods = kubApi.getSelectedPods(new Label[]{l});
-
-                for (Pod pod : pods) {
-                    try {
-                        // delete pods forcefully
-                        kubApi.deletePod(pod.getId());
-                    } catch (KubernetesClientException ignore) {
-                        // we can't do nothing here
-                        log.warn(String.format("Failed to delete Pod [%s] forcefully!", pod.getId()));
-                    }
-                }
-            } catch (KubernetesClientException e) {
-                // we're not going to throw this error, but proceed with other deletions
-                log.error("Failed to delete pods forcefully for cluster: " + clusterId, e);
-            }
-
-            // delete the replication controller.
-            try {
-                kubApi.deleteReplicationController(clusterId);
-            } catch (KubernetesClientException e) {
-                String msg = "Failed to delete Kubernetes Controller with id: " + clusterId;
-                log.error(msg, e);
-                throw new InvalidClusterException(msg, e);
-            }
-
-            String allocatedPort = CloudControllerUtil.getProperty(ctxt.getProperties(),
-                    StratosConstants.ALLOCATED_SERVICE_HOST_PORT);
-
-            if (allocatedPort != null) {
-                kubClusterContext.deallocateHostPort(Integer
-                        .parseInt(allocatedPort));
-            } else {
-                log.warn("Host port dealloacation failed due to a missing property: "
-                        + StratosConstants.ALLOCATED_SERVICE_HOST_PORT);
-            }
-
-            List<MemberContext> membersToBeRemoved = CloudControllerContext.getInstance().getMemberContextsOfClusterId(clusterId);
-
-            for (MemberContext memberContext : membersToBeRemoved) {
-                CloudControllerServiceUtil.executeMemberTerminationPostProcess(memberContext);
-            }
-
-            // persist
-            CloudControllerContext.getInstance().persist();
-            return membersToBeRemoved.toArray(new MemberContext[0]);
-        } finally {
-            if (lock != null) {
-                CloudControllerContext.getInstance().releaseWriteLock(lock);
-            }
-        }
-    }
-
-    @Override
-    public MemberContext[] updateContainers(String clusterId, int replicas)
-            throws UnregisteredCartridgeException {
-        Lock lock = null;
-        try {
-            lock = CloudControllerContext.getInstance().acquireMemberContextWriteLock();
-
-            if (log.isDebugEnabled()) {
-                log.debug("CloudControllerServiceImpl:updateContainers for cluster : " + clusterId);
-            }
-
-            ClusterContext ctxt = CloudControllerContext.getInstance().getClusterContext(clusterId);
-            handleNullObject(ctxt, "Container update failed. Invalid cluster id. " + clusterId);
-
-            String cartridgeType = ctxt.getCartridgeType();
-
-            Cartridge cartridge = CloudControllerContext.getInstance().getCartridge(cartridgeType);
-
-            if (cartridge == null) {
-                String msg =
-                        "Container update failed. No matching Cartridge found [type] " + cartridgeType
-                                + ". [cluster id] " + clusterId;
-                log.error(msg);
-                throw new UnregisteredCartridgeException(msg);
-            }
-
-            try {
-                String kubernetesClusterId = validateProperty(StratosConstants.KUBERNETES_CLUSTER_ID, ctxt.getProperties(), ctxt.toString());
-
-                KubernetesClusterContext kubClusterContext = CloudControllerContext.getInstance().getKubernetesClusterContext(kubernetesClusterId);
-
-                if (kubClusterContext == null) {
-                    String msg =
-                            "Instance start-up failed. No matching Kubernetes Context Found for [id] " + kubernetesClusterId
-                                    + ". [cluster id] " + clusterId;
-                    log.error(msg);
-                    throw new UnregisteredCartridgeException(msg);
-                }
-
-                KubernetesApiClient kubApi = kubClusterContext.getKubApi();
-                // create a label query
-                Label l = new Label();
-                l.setName(clusterId);
-
-                // get the current pods - useful when scale down
-                Pod[] previousStatePods = kubApi.getSelectedPods(new Label[]{l});
-
-                // update the replication controller - cluster id = replication controller id
-                if (log.isDebugEnabled()) {
-                    log.debug("Cloud Controller is delegating request to update a replication controller " + clusterId +
-                            " to Kubernetes layer.");
-                }
-
-                kubApi.updateReplicationController(clusterId, replicas);
-
-                if (log.isDebugEnabled()) {
-                    log.debug("Cloud Controller successfully updated the controller "
-                            + clusterId + " via Kubernetes layer.");
-                }
-
-                // execute the label query
-                Pod[] allPods = new Pod[0];
-
-                // wait replicas*5s time in the worst case ; best case = 0s
-                for (int i = 0; i < (replicas * previousStatePods.length + 1); i++) {
-                    allPods = kubApi.getSelectedPods(new Label[]{l});
-
-                    if (log.isDebugEnabled()) {
-
-                        log.debug("Pods Count: " + allPods.length + " for cluster: " + clusterId);
-                    }
-                    if (allPods.length == replicas) {
-                        break;
-                    }
-                    Thread.sleep(10000);
-                }
-
-                if (log.isDebugEnabled()) {
-
-                    log.debug(String.format("Pods created : %s for cluster : %s", allPods.length, clusterId));
-                }
-
-                List<MemberContext> memberContexts = new ArrayList<MemberContext>();
-
-                PodToMemberContext podToMemberContextFunc = new PodToMemberContext();
-                // generate Member Contexts
-                for (Pod pod : allPods) {
-                    MemberContext context;
-                    // if member context does not exist -> a new member (scale up)
-                    if ((context = CloudControllerContext.getInstance().getMemberContextOfMemberId(pod.getId())) == null) {
-
-                        context = podToMemberContextFunc.apply(pod);
-                        context.setCartridgeType(cartridgeType);
-                        context.setClusterId(clusterId);
-
-                        context.setProperties(CloudControllerUtil.addProperty(context
-                                        .getProperties(), StratosConstants.ALLOCATED_SERVICE_HOST_PORT,
-                                CloudControllerUtil.getProperty(ctxt.getProperties(),
-                                        StratosConstants.ALLOCATED_SERVICE_HOST_PORT)));
-
-                        // wait till Pod status turns to running and send member spawned.
-                        ScheduledThreadExecutor exec = ScheduledThreadExecutor.getInstance();
-                        if (log.isDebugEnabled()) {
-                            log.debug("Cloud Controller is starting the instance start up thread.");
-                        }
-                        CloudControllerContext.getInstance().addScheduledFutureJob(context.getMemberId(), exec.schedule(new PodActivationWatcher(pod.getId(), context, kubApi), 5000));
-
-                        memberContexts.add(context);
-
-                    }
-                    // publish data
-                    // TODO
-//                CartridgeInstanceDataPublisher.publish(context.getMemberId(), null, null, context.getClusterId(), cartridgeType, MemberStatus.Created.toString(), node);
-
-                }
-
-                if (memberContexts.isEmpty()) {
-                    // terminated members
-                    @SuppressWarnings("unchecked")
-                    List<Pod> difference = ListUtils.subtract(Arrays.asList(previousStatePods), Arrays.asList(allPods));
-                    for (Pod pod : difference) {
-                        if (pod != null) {
-                            MemberContext context = CloudControllerContext.getInstance().getMemberContextOfMemberId(pod.getId());
-                            CloudControllerServiceUtil.executeMemberTerminationPostProcess(context);
-                            memberContexts.add(context);
-                        }
-                    }
-                }
-
-
-                // persist in registry
-                CloudControllerContext.getInstance().persist();
-
-                log.info("Kubernetes entities are successfully starting up. " + memberContexts);
-                return memberContexts.toArray(new MemberContext[0]);
-
-            } catch (Exception e) {
-                String msg = "Failed to update containers belong to cluster " + clusterId + ". Cause: " + e.getMessage();
-                log.error(msg, e);
-                throw new IllegalStateException(msg, e);
-            }
-        } finally {
-            if (lock != null) {
-                CloudControllerContext.getInstance().releaseWriteLock(lock);
-            }
-        }
-    }
 
     @Override
     public void updateClusterStatus(String serviceName, String clusterId, String instanceId, ClusterStatus status) {
         //TODO
     }
 
-    @Override
-    public MemberContext terminateContainer(String memberId) throws MemberTerminationFailedException {
-        Lock lock = null;
-        try {
-            lock = CloudControllerContext.getInstance().acquireMemberContextWriteLock();
-            handleNullObject(memberId, "Failed to terminate member. Invalid Member id. [member-id] " + memberId);
-            MemberContext memberContext = CloudControllerContext.getInstance().getMemberContextOfMemberId(memberId);
-            handleNullObject(memberContext, "Failed to terminate member. Member id not found. [member-id] " + memberId);
-
-            String clusterId = memberContext.getClusterId();
-            handleNullObject(clusterId, "Failed to terminate member. Cluster id is null. [member-id] " + memberId);
-
-            ClusterContext ctxt = CloudControllerContext.getInstance().getClusterContext(clusterId);
-            handleNullObject(ctxt, String.format("Failed to terminate member [member-id] %s. Invalid cluster id %s ", memberId, clusterId));
-
-            String kubernetesClusterId = CloudControllerUtil.getProperty(ctxt.getProperties(),
-                    StratosConstants.KUBERNETES_CLUSTER_ID);
-
-            handleNullObject(kubernetesClusterId, String.format("Failed to terminate member [member-id] %s. Cannot find '" +
-                    StratosConstants.KUBERNETES_CLUSTER_ID + "' in [cluster context] %s ", memberId, ctxt));
-
-            KubernetesClusterContext kubClusterContext = CloudControllerContext.getInstance().getKubernetesClusterContext(kubernetesClusterId);
-            handleNullObject(kubClusterContext, String.format("Failed to terminate member [member-id] %s. Cannot find a matching Kubernetes Cluster in [cluster context] %s ", memberId, ctxt));
-            KubernetesApiClient kubApi = kubClusterContext.getKubApi();
-            // delete the Pod
-            try {
-                // member id = pod id
-                kubApi.deletePod(memberId);
-                MemberContext memberToBeRemoved = CloudControllerContext.getInstance().getMemberContextOfMemberId(memberId);
-                CloudControllerServiceUtil.executeMemberTerminationPostProcess(memberToBeRemoved);
-
-                return memberToBeRemoved;
-
-            } catch (KubernetesClientException e) {
-                String msg = String.format("Failed to terminate member: [member-id] %s", memberId);
-                log.error(msg, e);
-                throw new MemberTerminationFailedException(msg, e);
-            }
-        } finally {
-            if (lock != null) {
-                CloudControllerContext.getInstance().releaseWriteLock(lock);
-            }
-        }
-    }
-
     private void handleNullObject(Object obj, String errorMsg) {
         if (obj == null) {
             log.error(errorMsg);
@@ -1583,10 +1034,11 @@ public class CloudControllerServiceImpl implements CloudControllerService {
                 //newCluster.setStatus(ClusterStatus.Created, null);
                 newCluster.setHostNames(Arrays.asList(appClusterCtxt.getHostName()));
                 Cartridge cartridge = CloudControllerContext.getInstance().getCartridge(appClusterCtxt.getCartridgeType());
-                if (cartridge.getDeployerType() != null &&
-                        cartridge.getDeployerType().equals(StratosConstants.KUBERNETES_DEPLOYER_TYPE)) {
-                    newCluster.setKubernetesCluster(true);
-                }
+                // TODO: Fix kubernetes config
+//                if (cartridge.getDeployerType() != null &&
+//                        cartridge.getDeployerType().equals(StratosConstants.KUBERNETES_DEPLOYER_TYPE)) {
+//                    newCluster.setKubernetesCluster(true);
+//                }
                 if (appClusterCtxt.getProperties() != null) {
                     Properties properties = CloudControllerUtil.toJavaUtilProperties(appClusterCtxt.getProperties());
                     newCluster.setProperties(properties);

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
index 6285d00..cc84cec 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceUtil.java
@@ -32,8 +32,8 @@ import org.apache.stratos.cloud.controller.domain.Partition;
 import org.apache.stratos.cloud.controller.exception.InvalidIaasProviderException;
 import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
 import org.apache.stratos.cloud.controller.iaases.Iaas;
-import org.apache.stratos.cloud.controller.iaases.validators.IaasBasedPartitionValidator;
-import org.apache.stratos.cloud.controller.iaases.validators.KubernetesBasedPartitionValidator;
+import org.apache.stratos.cloud.controller.iaases.validators.PartitionValidator;
+import org.apache.stratos.cloud.controller.iaases.validators.KubernetesPartitionValidator;
 import org.apache.stratos.cloud.controller.messaging.publisher.StatisticsDataPublisher;
 import org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder;
 import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
@@ -98,14 +98,14 @@ public class CloudControllerServiceUtil {
             // if this is a IaaS based partition
             Iaas iaas = iaasProvider.getIaas();
 
-            IaasBasedPartitionValidator validator = (IaasBasedPartitionValidator) iaas.getPartitionValidator();
+            PartitionValidator validator = iaas.getPartitionValidator();
             validator.setIaasProvider(iaasProvider);
             iaasProvider = validator.validate(partitionId, partitionProperties);
             return iaasProvider;
 
         } else if (CloudControllerConstants.DOCKER_PARTITION_PROVIDER.equals(provider)) {
             // if this is a docker based Partition
-            KubernetesBasedPartitionValidator validator = new KubernetesBasedPartitionValidator();
+            KubernetesPartitionValidator validator = new KubernetesPartitionValidator();
             validator.validate(partitionId, partitionProperties);
             return null;
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/InstanceCreator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/InstanceCreator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/InstanceCreator.java
index b666c1c..01059ec 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/InstanceCreator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/InstanceCreator.java
@@ -19,10 +19,12 @@
 
 package org.apache.stratos.cloud.controller.services.impl;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.context.CloudControllerContext;
 import org.apache.stratos.cloud.controller.domain.*;
+import org.apache.stratos.cloud.controller.exception.CartridgeNotFoundException;
 import org.apache.stratos.cloud.controller.iaases.Iaas;
 import org.apache.stratos.cloud.controller.messaging.publisher.StatisticsDataPublisher;
 import org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder;
@@ -40,13 +42,10 @@ public class InstanceCreator implements Runnable {
 
     private MemberContext memberContext;
     private IaasProvider iaasProvider;
-    private String cartridgeType;
 
-    public InstanceCreator(MemberContext memberContext, IaasProvider iaasProvider,
-                           String cartridgeType) {
+    public InstanceCreator(MemberContext memberContext, IaasProvider iaasProvider) {
         this.memberContext = memberContext;
         this.iaasProvider = iaasProvider;
-        this.cartridgeType = cartridgeType;
     }
 
     @Override
@@ -61,28 +60,36 @@ public class InstanceCreator implements Runnable {
             Iaas iaas = iaasProvider.getIaas();
 
             // Create instance
-            NodeMetadata node = createInstance(iaas, clusterContext, memberContext);
+            memberContext = createInstance(iaas, memberContext);
+
+            if(log.isInfoEnabled()) {
+                log.info(String.format("Instance is starting up: [cartridge-type] %s [cluster-id] %s [instance-id] %s"
+                        , memberContext.getCartridgeType(), memberContext.getClusterId(), memberContext.getInstanceId()));
+            }
 
             // Attach volumes
             attachVolumes(iaas, clusterContext, memberContext);
 
             // Allocate IP address
-            iaas.allocateIpAddress(clusterId, memberContext, partition, cartridgeType, node);
+            iaas.allocateIpAddress(clusterId, memberContext, partition);
 
 
             // Update topology
-            TopologyBuilder.handleMemberSpawned(cartridgeType, clusterId,
-                    partition.getId(), memberContext.getPrivateIpAddress(), memberContext.getPublicIpAddress(),
-                    memberContext);
+            TopologyBuilder.handleMemberSpawned(memberContext);
 
             // Publish instance creation statistics to BAM
-            StatisticsDataPublisher.publish(memberContext.getMemberId(),
+            StatisticsDataPublisher.publish(
+                    memberContext.getMemberId(),
                     memberContext.getPartition().getId(),
                     memberContext.getNetworkPartitionId(),
                     memberContext.getClusterId(),
-                    cartridgeType,
+                    memberContext.getCartridgeType(),
                     MemberStatus.Created.toString(),
-                    node);
+                    memberContext.getInstanceMetadata());
+        } catch (Exception e) {
+            String message = String.format("Could not start instance: [cartridge-type] %s [cluster-id] %s",
+                    memberContext.getCartridgeType(), memberContext.getClusterId());
+            log.error(message, e);
         } finally {
             if(lock != null) {
                 CloudControllerContext.getInstance().releaseWriteLock(lock);
@@ -90,45 +97,40 @@ public class InstanceCreator implements Runnable {
         }
     }
 
-    private NodeMetadata createInstance(Iaas iaas, ClusterContext clusterContext, MemberContext memberContext) {
-        NodeMetadata node = iaas.createInstance(clusterContext, memberContext);
+    private MemberContext createInstance(Iaas iaas, MemberContext memberContext) throws CartridgeNotFoundException {
+        memberContext = iaas.createInstance(memberContext);
 
-        // node id
-        String nodeId = node.getId();
-        if (nodeId == null) {
-            String msg = "Node id of the starting instance is null\n" + memberContext.toString();
+        // Validate node id
+        String instanceId = memberContext.getInstanceId();
+        if (StringUtils.isBlank(instanceId)) {
+            String msg = "Instance id of the starting instance is null\n" + memberContext.toString();
             log.error(msg);
             throw new IllegalStateException(msg);
         }
 
-        memberContext.setNodeId(nodeId);
+        // Update member context and persist changes
         CloudControllerContext.getInstance().updateMemberContext(memberContext);
         CloudControllerContext.getInstance().persist();
 
         if (log.isDebugEnabled()) {
-            log.debug("Instance created: [node-metadata] " + node.toString());
+            log.debug("Instance created: [member-context] " + memberContext.toString());
         }
-        return node;
+        return memberContext;
     }
 
     public void attachVolumes(Iaas iaas, ClusterContext clusterContext, MemberContext memberContext) {
         // attach volumes
         if (clusterContext.isVolumeRequired()) {
             // remove region prefix
-            String nodeId = memberContext.getNodeId();
-            String instanceId = nodeId.indexOf('/') != -1 ? nodeId
-                    .substring(nodeId.indexOf('/') + 1, nodeId.length())
-                    : nodeId;
-            memberContext.setInstanceId(instanceId);
             if (clusterContext.getVolumes() != null) {
                 for (Volume volume : clusterContext.getVolumes()) {
                     try {
-                        iaas.attachVolume(instanceId, volume.getId(), volume.getDevice());
+                        iaas.attachVolume(memberContext.getInstanceId(), volume.getId(), volume.getDevice());
                     } catch (Exception e) {
                         // continue without throwing an exception, since
                         // there is an instance already running
                         log.error("Attaching volume to instance [ "
-                                + instanceId + " ] failed!", e);
+                                + memberContext.getInstanceId() + " ] failed!", e);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
index dbf36bc..8dc6164 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
@@ -108,7 +108,6 @@ public class CloudControllerUtil {
         cartridge.setDefaultAutoscalingPolicy(config.getDefaultAutoscalingPolicy());
         cartridge.setDefaultDeploymentPolicy(config.getDefaultDeploymentPolicy());
         cartridge.setServiceGroup(config.getServiceGroup());
-        cartridge.setDeployerType(config.getDeployerType());
         org.apache.stratos.common.Properties props = config.getProperties();
         if (props != null) {
             for (Property prop : props.getProperties()) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PodActivationWatcher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PodActivationWatcher.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PodActivationWatcher.java
index d03f0d9..465f0e8 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PodActivationWatcher.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PodActivationWatcher.java
@@ -23,25 +23,27 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.context.CloudControllerContext;
 import org.apache.stratos.cloud.controller.domain.MemberContext;
-import org.apache.stratos.cloud.controller.registry.RegistryManager;
 import org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder;
 import org.apache.stratos.kubernetes.client.KubernetesApiClient;
 import org.apache.stratos.kubernetes.client.model.Pod;
 
 /**
- * Checks whether a container is active and update the {@link org.apache.stratos.cloud.controller.context.CloudControllerContext}.
+ * Checks whether a container is active and update the
+ * {@link org.apache.stratos.cloud.controller.context.CloudControllerContext}.
  */
 public class PodActivationWatcher implements Runnable {
 
-    private static final Log LOG = LogFactory
-            .getLog(PodActivationWatcher.class);
+    private static final Log log = LogFactory.getLog(PodActivationWatcher.class);
+
+    private static final String POD_STATE_RUNNING = "Running";
+
     private String podId;
-    private MemberContext ctxt;
+    private MemberContext memberContext;
     private KubernetesApiClient kubApi;
     
-    public PodActivationWatcher(String podId, MemberContext ctxt, KubernetesApiClient kubApi) {
+    public PodActivationWatcher(String podId, MemberContext memberContext, KubernetesApiClient kubApi) {
         this.podId = podId;
-        this.ctxt = ctxt;
+        this.memberContext = memberContext;
         this.kubApi = kubApi;
     }
 
@@ -50,30 +52,27 @@ public class PodActivationWatcher implements Runnable {
         try {
             CloudControllerContext cloudControllerContext = CloudControllerContext.getInstance();
             Pod pod = kubApi.getPod(podId);
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("PodActivationWatcher running : "+pod.getCurrentState().getStatus());
+            if (log.isDebugEnabled()) {
+                log.debug("Pod activation watcher running: [status] " + pod.getCurrentState().getStatus());
             }
-            if ("Running".equals(pod.getCurrentState().getStatus()) && ctxt.getPublicIpAddress() == null) {
+            if (POD_STATE_RUNNING.equals(pod.getCurrentState().getStatus()) && memberContext.getPublicIpAddress() == null) {
                 String hostIP = pod.getCurrentState().getHost();
-                ctxt.setPublicIpAddress(hostIP);
-                ctxt.setPrivateIpAddress(hostIP);
-                cloudControllerContext.addMemberContext(ctxt);
+                memberContext.setPublicIpAddress(hostIP);
+                memberContext.setPrivateIpAddress(hostIP);
+                cloudControllerContext.addMemberContext(memberContext);
+
                 // trigger topology
-                TopologyBuilder.handleMemberSpawned(ctxt.getCartridgeType(), ctxt.getClusterId(), 
-                        null, hostIP, hostIP, ctxt);
-                
+                TopologyBuilder.handleMemberSpawned(memberContext);
                 cloudControllerContext.persist();
             }
             
         } catch (Exception e) {
             // not logging exception intentionally
-            LOG.error("Container Activation Watcher Failed.. Cause: "+e.getMessage());
+            log.error("Container activation watcher failed: " + e.getMessage());
             
-            if (LOG.isDebugEnabled()) {
-                LOG.debug(e);
+            if (log.isDebugEnabled()) {
+                log.debug(e);
             }
         }
-        
     }
-    
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/definition/CartridgeDefinitionBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/definition/CartridgeDefinitionBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/definition/CartridgeDefinitionBean.java
index 530f45a..4fe0ede 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/definition/CartridgeDefinitionBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/definition/CartridgeDefinitionBean.java
@@ -20,7 +20,6 @@
 package org.apache.stratos.common.beans.cartridge.definition;
 
 import javax.xml.bind.annotation.XmlRootElement;
-
 import java.util.List;
 
 @XmlRootElement(name = "cartridgeDefinitionBean")
@@ -46,7 +45,6 @@ public class CartridgeDefinitionBean {
     private String defaultDeploymentPolicy;
     private String serviceGroup;
     private ContainerBean container;
-    private String deployerType;
     private List<PropertyBean> property;
     private List<String> exportingProperties;
 
@@ -252,12 +250,4 @@ public class CartridgeDefinitionBean {
     public void setContainer(ContainerBean container) {
         this.container = container;
     }
-
-    public String getDeployerType() {
-        return deployerType;
-    }
-
-    public void setDeployerType(String deployerType) {
-        this.deployerType = deployerType;
-    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/topology/Member.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/topology/Member.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/topology/Member.java
index 7697a06..98f3052 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/topology/Member.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/topology/Member.java
@@ -27,6 +27,8 @@ public class Member {
 
     private String serviceName;
     private String clusterId;
+    private String instanceId;
+    private String clusterInstanceId;
     private String networkPartitionId;
     private String partitionId;
     private String memberId;
@@ -35,15 +37,6 @@ public class Member {
     private String lbClusterId;
     private String memberPublicIp;
     private List<PropertyBean> property;
-    
-    @Override
-    public String toString() {
-        return "Member [serviceName=" + getServiceName() + ", clusterId=" + getClusterId() + ", networkPartitionId="
-                + getNetworkPartitionId() + ", partitionId=" + getPartitionId() + ", memberId=" + getMemberId() + ", status=" + getStatus()
-                + ", memberIp=" + getMemberIp() + ", lbClusterId=" + getLbClusterId() + ", memberPublicIp=" + getMemberPublicIp()
-                + ", property=" + getProperty() + "]";
-    }
-
 
     public String getServiceName() {
         return serviceName;
@@ -124,4 +117,36 @@ public class Member {
     public void setProperty(List<PropertyBean> property) {
         this.property = property;
     }
+
+    public String getInstanceId() {
+        return instanceId;
+    }
+
+    public void setInstanceId(String instanceId) {
+        this.instanceId = instanceId;
+    }
+
+    public String getClusterInstanceId() {
+        return clusterInstanceId;
+    }
+
+    public void setClusterInstanceId(String clusterInstanceId) {
+        this.clusterInstanceId = clusterInstanceId;
+    }
+
+    @Override
+    public String toString() {
+        return "Member [serviceName=" + getServiceName()
+                + ", clusterId=" + getClusterId()
+                + ", memberId=" + getMemberId()
+                + ", instanceId=" + getInstanceId()
+                + ", clusterInstanceId=" + getClusterInstanceId()
+                + ", networkPartitionId=" + getNetworkPartitionId()
+                + ", partitionId=" + getPartitionId()
+                + ", status=" + getStatus()
+                + ", memberIp=" + getMemberIp()
+                + ", memberPublicIp=" + getMemberPublicIp()
+                + ", lbClusterId=" + getLbClusterId()
+                + ", property=" + getProperty() + "]";
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/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 2859adf..f075b8e 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
@@ -230,7 +230,6 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface {
 			throws KubernetesClientException {
 
 		try {
-			
 			GsonBuilder gsonBuilder = new GsonBuilder();
 			Gson gson = gsonBuilder.create();
 			String content = gson.toJson(controller);
@@ -264,7 +263,6 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface {
 					+ controller;
 			log.error(msg, e);
 			throw new KubernetesClientException(msg, e);
-
 		}
 	}
 
@@ -471,21 +469,20 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface {
 	}
 
     @Override
-    public Pod[] getSelectedPods(Label[] label) throws KubernetesClientException {
+    public Pod[] queryPods(Label[] label) throws KubernetesClientException {
         
         try {
             String labelQuery = getLabelQuery(label);
             URI uri = new URIBuilder(baseURL + "pods").addParameter("labels", labelQuery).build();
-            KubernetesResponse res = restClient.doGet(uri);
+            KubernetesResponse response = restClient.doGet(uri);
             
-            handleNullResponse("Pod retrieval failed.", res);
+            handleNullResponse("Pod retrieval failed, kubernetes api response is null", response);
             
-            if (res.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
+            if (response.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
                 return new Pod[0];
             }
             
-            String content = res.getContent();
-            
+            String content = response.getContent();
             GsonBuilder gsonBuilder = new GsonBuilder();
             Gson gson = gsonBuilder.create();
             PodList podList = gson.fromJson(content, PodList.class);
@@ -493,7 +490,6 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface {
                 return new Pod[0];
             }
             return podList.getItems();
-            
         } catch (Exception e) {
             String msg = "Error while retrieving Pods.";
             log.error(msg, e);
@@ -512,9 +508,8 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface {
     private void handleNullResponse(String message, KubernetesResponse res)
             throws KubernetesClientException {
         if (res == null) {
-            log.error(message+ " Null response received.");
+            log.error(message+ " Null response received");
             throw new KubernetesClientException(message);
         }
     }
-	
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/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 d27fb98..aab4f52 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
@@ -49,7 +49,7 @@ public interface KubernetesAPIClientInterface {
 	 * @return Pods selected Pods by executing the label query.
 	 * @throws KubernetesClientException
 	 */
-	public Pod[] getSelectedPods(Label[] label) throws KubernetesClientException;
+	public Pod[] queryPods(Label[] label) throws KubernetesClientException;
 	
 	/**
 	 * Create a new Pod

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/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 7f74f40..03dc7d8 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
@@ -134,7 +134,7 @@ public class KubernetesApiClientLiveTest extends TestCase{
         }
 	    assertEquals(true, match);
 	    
-	    Pod[] selectedPods = client.getSelectedPods(new Label[]{l});
+	    Pod[] selectedPods = client.queryPods(new Label[]{l});
 	    assertEquals(1, selectedPods.length);
 	    
 	    if (log.isDebugEnabled()) {
@@ -154,15 +154,15 @@ public class KubernetesApiClientLiveTest extends TestCase{
 	        assertEquals(true, e instanceof KubernetesClientException);
 	    }
 	    
-	    selectedPods = client.getSelectedPods(new Label[]{l});
+	    selectedPods = client.queryPods(new Label[]{l});
         assertEquals(0, selectedPods.length);
         
         Label ll = new Label();
         ll.setName("nirmal2");
-        selectedPods = client.getSelectedPods(new Label[]{l, ll});
+        selectedPods = client.queryPods(new Label[]{l, ll});
         assertEquals(0, selectedPods.length);
         
-        selectedPods = client.getSelectedPods(new Label[]{});
+        selectedPods = client.queryPods(new Label[]{});
         assertEquals(0, selectedPods.length);
 	}
 	
@@ -219,7 +219,7 @@ public class KubernetesApiClientLiveTest extends TestCase{
         
         assertEquals(1, client.getAllReplicationControllers().length);
         
-        Pod[] pods = client.getSelectedPods(new Label[]{l1});
+        Pod[] pods = client.queryPods(new Label[]{l1});
         assertEquals(replicas, pods.length);
         
         // test incorrect replica count
@@ -236,7 +236,7 @@ public class KubernetesApiClientLiveTest extends TestCase{
         
         Thread.sleep(10000);
         
-        pods = client.getSelectedPods(new Label[]{l1});
+        pods = client.queryPods(new Label[]{l1});
         assertEquals(replicas, pods.length);
         
         client.deleteReplicationController(id);

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/LoadBalancerConfiguration.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/LoadBalancerConfiguration.java b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/LoadBalancerConfiguration.java
index b62c3e1..9859864 100644
--- a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/LoadBalancerConfiguration.java
+++ b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/LoadBalancerConfiguration.java
@@ -473,7 +473,8 @@ public class LoadBalancerConfiguration {
                             String memberId = memberNode.getName();
                             // we are making it as 1 because we are not using this for static loadbalancer configuration
                             long initTime = -1;
-                            Member member = new Member(cluster.getServiceName(), cluster.getClusterId(), Constants.STATIC_NETWORK_PARTITION, Constants.STATIC_PARTITION, memberId, initTime);
+                            Member member = new Member(cluster.getServiceName(), cluster.getClusterId(), memberId,
+                                    memberId, "1", Constants.STATIC_NETWORK_PARTITION, Constants.STATIC_PARTITION, initTime);
                             String ip = memberNode.getProperty(Constants.CONF_PROPERTY_IP);
                             validateRequiredPropertyInNode(Constants.CONF_PROPERTY_IP, ip, String.format("member %s", memberId));
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/client/CloudControllerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/client/CloudControllerServiceClient.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/client/CloudControllerServiceClient.java
index 7ab1837..4446267 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/client/CloudControllerServiceClient.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/client/CloudControllerServiceClient.java
@@ -108,7 +108,7 @@ public class CloudControllerServiceClient {
                             String payload, String tenantRange,
                             String hostName, Properties properties,
                             String autoscalorPolicyName, String deploymentPolicyName, Persistence persistence) throws RemoteException,
-                            CloudControllerServiceUnregisteredCartridgeExceptionException {		
+                            CloudControllerServiceCartridgeNotFoundExceptionException {
 	    Registrant registrant = new Registrant();
 	    registrant.setClusterId(clusterId);
 	    registrant.setCartridgeType(cartridgeType);
@@ -133,7 +133,7 @@ public class CloudControllerServiceClient {
 	}
 
 	public CartridgeInfo getCartridgeInfo(String cartridgeType) throws RemoteException, 
-	CloudControllerServiceUnregisteredCartridgeExceptionException {
+	CloudControllerServiceCartridgeNotFoundExceptionException {
 		return stub.getCartridgeInfo(cartridgeType);
 	}
 	

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/cartridge/CartridgeDeploymentManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/cartridge/CartridgeDeploymentManager.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/cartridge/CartridgeDeploymentManager.java
index 3056a75..915755e 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/cartridge/CartridgeDeploymentManager.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/cartridge/CartridgeDeploymentManager.java
@@ -18,16 +18,9 @@
  */
 package org.apache.stratos.manager.deploy.cartridge;
 
-import org.apache.stratos.common.constants.StratosConstants;
-
-
 public class CartridgeDeploymentManager {
 
-	public static CartridgeDeployer getDeploymentManager(String deployerType){
-		if(deployerType != null && StratosConstants.KUBERNETES_DEPLOYER_TYPE.equals(deployerType)) {
-			return new DockerCartridgeDeployer();
-		} else {
-			return new DefaultCartridgeDeployer();
-		} 
-	}
+    public static CartridgeDeployer getDeploymentManager() {
+        return new DefaultCartridgeDeployer();
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java
index a56dcdf..1ceff80 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java
@@ -21,7 +21,7 @@ package org.apache.stratos.manager.deploy.service;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.cloud.controller.stub.CloudControllerServiceUnregisteredCartridgeExceptionException;
+import org.apache.stratos.cloud.controller.stub.CloudControllerServiceCartridgeNotFoundExceptionException;
 import org.apache.stratos.cloud.controller.stub.domain.CartridgeInfo;
 import org.apache.stratos.cloud.controller.stub.domain.LoadbalancerConfig;
 import org.apache.stratos.common.Properties;
@@ -74,7 +74,7 @@ public class ServiceDeploymentManager {
         try {
             cartridgeInfo = CloudControllerServiceClient.getServiceClient().getCartridgeInfo(type);
 
-        } catch (CloudControllerServiceUnregisteredCartridgeExceptionException e) {
+        } catch (CloudControllerServiceCartridgeNotFoundExceptionException e) {
             String message = type + " is not a valid cartridgeSubscription type. Please try again with a valid cartridgeSubscription type.";
             log.error(message);
             throw new ADCException(message, e);

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/DefaultServiceGroupDeployer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/DefaultServiceGroupDeployer.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/DefaultServiceGroupDeployer.java
index 125d226..e737d23 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/DefaultServiceGroupDeployer.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/DefaultServiceGroupDeployer.java
@@ -26,7 +26,7 @@ import org.apache.stratos.autoscaler.stub.AutoScalerServiceAutoScalerExceptionEx
 import org.apache.stratos.autoscaler.stub.AutoScalerServiceInvalidServiceGroupExceptionException;
 import org.apache.stratos.autoscaler.stub.pojo.Dependencies;
 import org.apache.stratos.autoscaler.stub.pojo.ServiceGroup;
-import org.apache.stratos.cloud.controller.stub.CloudControllerServiceUnregisteredCartridgeExceptionException;
+import org.apache.stratos.cloud.controller.stub.CloudControllerServiceCartridgeNotFoundExceptionException;
 import org.apache.stratos.manager.client.AutoscalerServiceClient;
 import org.apache.stratos.manager.client.CloudControllerServiceClient;
 import org.apache.stratos.manager.exception.ADCException;
@@ -113,7 +113,7 @@ public class DefaultServiceGroupDeployer implements ServiceGroupDeployer {
                     }
                 } catch (RemoteException e) {
                     throw new ADCException(e);
-                } catch (CloudControllerServiceUnregisteredCartridgeExceptionException e) {
+                } catch (CloudControllerServiceCartridgeNotFoundExceptionException e) {
                     throw new ADCException(e);
                 }
             }

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/ServiceGroupDeployer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/ServiceGroupDeployer.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/ServiceGroupDeployer.java
index 342d5cc..8d5653f 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/ServiceGroupDeployer.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/grouping/deployer/ServiceGroupDeployer.java
@@ -19,7 +19,7 @@
 
 package org.apache.stratos.manager.grouping.deployer;
 
-import org.apache.stratos.cloud.controller.stub.CloudControllerServiceUnregisteredCartridgeExceptionException;
+import org.apache.stratos.cloud.controller.stub.CloudControllerServiceCartridgeNotFoundExceptionException;
 import org.apache.stratos.manager.exception.ADCException;
 import org.apache.stratos.manager.exception.InvalidServiceGroupException;
 import org.apache.stratos.manager.exception.ServiceGroupDefinitioException;
@@ -28,7 +28,7 @@ import org.apache.stratos.manager.grouping.definitions.ServiceGroupDefinition;
 public interface ServiceGroupDeployer {
 
     public void deployServiceGroupDefinition(Object serviceGroupObj) throws InvalidServiceGroupException, ServiceGroupDefinitioException,
-            ADCException, CloudControllerServiceUnregisteredCartridgeExceptionException;
+            ADCException, CloudControllerServiceCartridgeNotFoundExceptionException;
 
     public ServiceGroupDefinition getServiceGroupDefinition(String serviceGroupDefinitionName) throws ServiceGroupDefinitioException, ADCException;
 


Mime
View raw message