stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [1/2] stratos git commit: Setting container image pull policy to PullIfNotPresent
Date Thu, 25 Dec 2014 20:24:06 GMT
Repository: stratos
Updated Branches:
  refs/heads/master 18e7d9bb8 -> ef267bb6a


Setting container image pull policy to PullIfNotPresent


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

Branch: refs/heads/master
Commit: 5609530dc2a08b4a84ddbcf2fd40d2665fde4043
Parents: 18e7d9b
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Fri Dec 26 01:45:57 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Fri Dec 26 01:45:57 2014 +0530

----------------------------------------------------------------------
 .../stratos/kubernetes/client/KubernetesApiClient.java      | 2 ++
 .../stratos/kubernetes/client/KubernetesConstants.java      | 1 +
 .../apache/stratos/kubernetes/client/model/Container.java   | 9 +++++++++
 .../kubernetes/client/live/KubernetesApiClientLiveTest.java | 6 ++++--
 4 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/5609530d/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 479de3d..04f7c5b 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
@@ -77,6 +77,7 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface
{
         containerTemplate.setName(podName);
         containerTemplate.setImage(dockerImage);
         containerTemplate.setPorts(convertIntPortListToPortList(containerPorts));
+        containerTemplate.setImagePullPolicy(KubernetesConstants.POLICY_PULL_IF_NOT_PRESENT);
 
         manifest.addContainer(containerTemplate);
         desiredState.setManifest(manifest);
@@ -321,6 +322,7 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface
{
             Container containerTemplate = new Container();
             containerTemplate.setName(replicationControllerName);
             containerTemplate.setImage(dockerImage);
+            containerTemplate.setImagePullPolicy(KubernetesConstants.POLICY_PULL_IF_NOT_PRESENT);
             if(environmentVariables != null) {
                 containerTemplate.setEnv(environmentVariables);
             }

http://git-wip-us.apache.org/repos/asf/stratos/blob/5609530d/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesConstants.java
b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesConstants.java
index ed796d0..66e4556 100644
--- a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesConstants.java
+++ b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/KubernetesConstants.java
@@ -29,4 +29,5 @@ public class KubernetesConstants {
     public static final String KIND_SERVICE = "Service";
     public static final String KIND_REPLICATION_CONTROLLER = "ReplicationController";
     public static final String KIND_POD = "Pod";
+    public static final String POLICY_PULL_IF_NOT_PRESENT = "PullIfNotPresent";
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/5609530d/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Container.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Container.java
b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Container.java
index 0501539..dd10493 100644
--- a/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Container.java
+++ b/components/org.apache.stratos.kubernetes.client/src/main/java/org/apache/stratos/kubernetes/client/model/Container.java
@@ -34,6 +34,7 @@ public class Container {
 	private String[] command;
 	private VolumeMount[] volumeMounts;
 	private List<Port> ports;
+	private String imagePullPolicy;
 	private EnvironmentVariable[] env;
 
 	public Container() {
@@ -108,4 +109,12 @@ public class Container {
 				+ ", ports=" + ports + ", env="
 				+ Arrays.toString(env) + "]";
 	}
+
+	public String getImagePullPolicy() {
+		return imagePullPolicy;
+	}
+
+	public void setImagePullPolicy(String imagePullPolicy) {
+		this.imagePullPolicy = imagePullPolicy;
+	}
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/5609530d/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 9ee1aef..687b08c 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
@@ -40,7 +40,9 @@ import java.util.List;
 
 /**
  * Notes:
- * - Pull the docker image before running the live test
+ * Initially it would take some time to pull the docker image and create a pod.
+ * As a result live test would fail when running for the first time on a fresh
+ * kubernetes cluster.
  */
 @Category(org.apache.stratos.kubernetes.client.LiveTests.class)
 public class KubernetesApiClientLiveTest extends TestCase{
@@ -51,7 +53,7 @@ public class KubernetesApiClientLiveTest extends TestCase{
     private static final int SERVICE_PORT = 4500;
     private static final String DEFAULT_KUBERNETES_MASTER_IP = "172.17.8.100";
     private static final String DEFAULT_DOCKER_IMAGE =  "gurpartap/redis";
-    private static final int POD_ACTIVATION_WAIT_TIME = 15000; // 15 seconds
+    private static final int POD_ACTIVATION_WAIT_TIME = 10000; // 10 seconds
 
     private KubernetesApiClient client;
     private String dockerImage;


Mime
View raw message