You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/05/21 08:16:19 UTC
stratos git commit: Setting container default cpu and memory to zero
and fixing concurrent modification issue in kubernetes live test
Repository: stratos
Updated Branches:
refs/heads/master cef58c25a -> b26ecdc89
Setting container default cpu and memory to zero and fixing concurrent modification issue in kubernetes live test
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/b26ecdc8
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/b26ecdc8
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/b26ecdc8
Branch: refs/heads/master
Commit: b26ecdc89ec40e962178e37ddc128f4445bb1e46
Parents: cef58c2
Author: Imesh Gunaratne <im...@apache.org>
Authored: Thu May 21 11:57:15 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Thu May 21 11:57:31 2015 +0530
----------------------------------------------------------------------
.../iaases/kubernetes/KubernetesIaas.java | 22 +++++++++++++-------
.../client/live/AbstractLiveTest.java | 5 +++--
2 files changed, 17 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/b26ecdc8/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 4aa4c4c..b218403 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
@@ -379,8 +379,9 @@ public class KubernetesIaas extends Iaas {
throw new RuntimeException(message);
}
- int cpu = Integer.getInteger(KUBERNETES_CONTAINER_CPU_DEFAULT, 1);
- int memory = Integer.getInteger(KUBERNETES_CONTAINER_MEMORY_DEFAULT, 1024);
+ // Set default values to zero to avoid cpu and memory restrictions
+ int cpu = Integer.getInteger(KUBERNETES_CONTAINER_CPU_DEFAULT, 0);
+ int memory = Integer.getInteger(KUBERNETES_CONTAINER_MEMORY_DEFAULT, 0);
Property cpuProperty = cartridge.getProperties().getProperty(KUBERNETES_CONTAINER_CPU);
if(cpuProperty != null) {
cpu = Integer.parseInt(cpuProperty.getValue());
@@ -409,8 +410,19 @@ public class KubernetesIaas extends Iaas {
clusterContext, memberContext);
List<Port> ports = KubernetesIaasUtil.convertPortMappings(Arrays.asList(cartridge.getPortMappings()));
+
+ log.info(String.format("Starting pod: [application] %s [cartridge] %s [member] %s " +
+ "[cpu] %d [memory] %d MB",
+ memberContext.getApplicationId(), memberContext.getCartridgeType(),
+ memberContext.getMemberId(), cpu, memory));
+
kubernetesApi.createPod(podId, podLabel, dockerImage, cpu, memory, ports, environmentVariables);
+ log.info(String.format("Pod started successfully: [application] %s [cartridge] %s [member] %s " +
+ "[pod] %s [cpu] %d [memory] %d MB",
+ memberContext.getApplicationId(), memberContext.getCartridgeType(),
+ memberContext.getMemberId(), podId, cpu, memory));
+
// Add pod id to member context
memberContext.setKubernetesPodId(podId);
memberContext.setKubernetesPodLabel(podLabel);
@@ -424,12 +436,6 @@ public class KubernetesIaas extends Iaas {
// Persist cloud controller context
CloudControllerContext.getInstance().persist();
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Kubernetes pod created successfully: [application] %s [cartridge] %s [member] %s " +
- "[pod] %s", applicationId, cartridgeType,
- memberId, memberContext.getKubernetesPodId()));
- }
}
/**
http://git-wip-us.apache.org/repos/asf/stratos/blob/b26ecdc8/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/AbstractLiveTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/AbstractLiveTest.java b/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/AbstractLiveTest.java
index 0ab978e..85ae645 100644
--- a/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/AbstractLiveTest.java
+++ b/components/org.apache.stratos.kubernetes.client/src/test/java/org/apache/stratos/kubernetes/client/live/AbstractLiveTest.java
@@ -35,6 +35,7 @@ import org.junit.BeforeClass;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
/**
* Abstract live test class.
@@ -65,8 +66,8 @@ public class AbstractLiveTest extends TestCase {
protected boolean testPodActivation;
protected boolean testServiceSocket;
protected String[] minionPublicIPs = {"172.17.8.102"};
- protected List<String> podIdList = new ArrayList<String>();
- protected List<String> serviceIdList = new ArrayList<String>();
+ protected List<String> podIdList = new CopyOnWriteArrayList<String>();
+ protected List<String> serviceIdList = new CopyOnWriteArrayList<String>();
@BeforeClass
public void setUp() {