stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject stratos git commit: Adding kubernetes cluster id to cluster context
Date Thu, 25 Dec 2014 20:35:59 GMT
Repository: stratos
Updated Branches:
  refs/heads/master ef267bb6a -> 49150da16


Adding kubernetes cluster id to cluster context


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

Branch: refs/heads/master
Commit: 49150da1607736dc1e0abff9ab2f26276713f002
Parents: ef267bb
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Fri Dec 26 02:05:49 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Fri Dec 26 02:05:49 2014 +0530

----------------------------------------------------------------------
 .../cloud/controller/domain/ClusterContext.java     | 16 ++++++++--------
 .../iaases/kubernetes/KubernetesIaas.java           | 13 +++++++------
 .../iaases/kubernetes/KubernetesIaasUtil.java       |  4 +---
 .../messaging/topology/TopologyBuilder.java         |  9 ---------
 4 files changed, 16 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/49150da1/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 147b5d9..fb52685 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
@@ -47,6 +47,7 @@ public class ClusterContext implements Serializable{
     private long timeoutInMillis;
     private Properties properties;
     private List<Service> kubernetesServices;
+    private String kubernetesClusterId;
 
     public ClusterContext(String clusterId, String cartridgeType, String payload, String
hostName, 
     		boolean isLbCluster, Properties properties) {
@@ -140,12 +141,11 @@ public class ClusterContext implements Serializable{
         this.kubernetesServices = kubernetesServices;
     }
 
-	
-	/*public void addProperty(String key, int value) {
-		this.properties.put(key, value);
-	}
-	
-	public void addProperty(String key, String value) {
-		this.properties.put(key, value);
-	}*/
+    public void setKubernetesClusterId(String kubernetesClusterId) {
+        this.kubernetesClusterId = kubernetesClusterId;
+    }
+
+    public String getKubernetesClusterId() {
+        return kubernetesClusterId;
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/49150da1/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
index aeaf999..9f569f2 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaas.java
@@ -159,6 +159,7 @@ public class KubernetesIaas extends Iaas {
 
             try {
                 String kubernetesClusterId = partition.getKubernetesClusterId();
+                clusterContext.setKubernetesClusterId(kubernetesClusterId);
                 KubernetesCluster kubernetesCluster = CloudControllerContext.getInstance().
                         getKubernetesCluster(kubernetesClusterId);
                 handleNullObject(kubernetesCluster, "Could not start container, kubernetes
cluster not found: " +
@@ -414,14 +415,15 @@ public class KubernetesIaas extends Iaas {
             lock = CloudControllerContext.getInstance().acquireMemberContextWriteLock();
 
             ClusterContext clusterContext = CloudControllerContext.getInstance().getClusterContext(clusterId);
-            handleNullObject(clusterContext, "Could not terminate containers, cluster not
found: [cluster-id] " + clusterId);
+            handleNullObject(clusterContext, "Could not terminate containers, cluster not
found: [cluster-id] "
+                    + clusterId);
 
-            String kubernetesClusterId = CloudControllerUtil.getProperty(clusterContext.getProperties(),
-                    StratosConstants.KUBERNETES_CLUSTER_ID);
+            String kubernetesClusterId = clusterContext.getKubernetesClusterId();
             handleNullObject(kubernetesClusterId, "Could not terminate containers, kubernetes
cluster id not found: " +
                     "[cluster-id] " + clusterId);
 
-            KubernetesClusterContext kubClusterContext = CloudControllerContext.getInstance().getKubernetesClusterContext(kubernetesClusterId);
+            KubernetesClusterContext kubClusterContext = CloudControllerContext.getInstance().
+                    getKubernetesClusterContext(kubernetesClusterId);
             handleNullObject(kubClusterContext, "Could not terminate containers, kubernetes
cluster not found: " +
                     "[kubernetes-cluster-id] " + kubernetesClusterId);
 
@@ -485,8 +487,7 @@ public class KubernetesIaas extends Iaas {
             handleNullObject(clusterContext, String.format("Could not terminate container,
cluster context not found: " +
                     "[cluster-id] %s [member-id] %s", clusterId, memberId));
 
-            String kubernetesClusterId = CloudControllerUtil.getProperty(clusterContext.getProperties(),
-                    StratosConstants.KUBERNETES_CLUSTER_ID);
+            String kubernetesClusterId = clusterContext.getKubernetesClusterId();
             handleNullObject(kubernetesClusterId, String.format("Could not terminate container,
kubernetes cluster " +
                     "context id is null: [cluster-id] %s [member-id] %s", clusterId, memberId));
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/49150da1/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaasUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaasUtil.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaasUtil.java
index 623f851..0a6b8cc 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaasUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/kubernetes/KubernetesIaasUtil.java
@@ -73,9 +73,7 @@ public class KubernetesIaasUtil {
     public static EnvironmentVariable[] prepareEnvironmentVariables(ClusterContext clusterContext,
                                                                      MemberContext memberContext)
{
 
-        String kubernetesClusterId = CloudControllerUtil.getProperty(clusterContext.getProperties(),
-                StratosConstants.KUBERNETES_CLUSTER_ID);
-
+        String kubernetesClusterId = clusterContext.getKubernetesClusterId();
         List<EnvironmentVariable> environmentVariables = new ArrayList<EnvironmentVariable>();
 
         // Set dynamic payload

http://git-wip-us.apache.org/repos/asf/stratos/blob/49150da1/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 b42f67b..a4a7706 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
@@ -354,15 +354,6 @@ public class TopologyBuilder {
         }*/
     }
 
-
-    private static void setKubernetesCluster(Cluster cluster) {  
-    	boolean isKubernetesCluster = (cluster.getProperties().getProperty(StratosConstants.KUBERNETES_CLUSTER_ID)
!= null);
-		if (log.isDebugEnabled()) {
-			log.debug(" Kubernetes Cluster ["+ isKubernetesCluster + "] ");
-		}
-		cluster.setKubernetesCluster(isKubernetesCluster);		
-	}
-
 	public static void handleClusterRemoved(ClusterContext ctxt) {
         Topology topology = TopologyManager.getTopology();
         Service service = topology.getService(ctxt.getCartridgeType());


Mime
View raw message