stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject stratos git commit: Removing host port from container ports to avoid a known kubernetes issue
Date Mon, 29 Dec 2014 08:26:18 GMT
Repository: stratos
Updated Branches:
  refs/heads/master 2e3deabc5 -> 5551449bb


Removing host port from container ports to avoid a known kubernetes issue


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

Branch: refs/heads/master
Commit: 5551449bb1f95b4f2646d119c2379ba5a9dd2d48
Parents: 2e3deab
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Mon Dec 29 13:56:00 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Mon Dec 29 13:56:00 2014 +0530

----------------------------------------------------------------------
 .../stratos/autoscaler/rule/AutoscalerRuleEvaluator.java    | 9 +++------
 .../cloud/controller/iaases/kubernetes/KubernetesIaas.java  | 8 ++++----
 .../cloud/controller/services/impl/InstanceCreator.java     | 8 +++++---
 .../stratos/kubernetes/client/KubernetesApiClient.java      | 4 +++-
 4 files changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/5551449b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
index 1374358..4de0f77 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
@@ -21,9 +21,6 @@ package org.apache.stratos.autoscaler.rule;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-//import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.PartitionManager;
-//import org.apache.stratos.autoscaler.context.partition.ClusterLevelPartitionContext;
-//import org.apache.stratos.autoscaler.NetworkPartitionLbHolder;
 import org.apache.stratos.common.constants.StratosConstants;
 import org.drools.KnowledgeBase;
 import org.drools.KnowledgeBaseFactory;
@@ -57,7 +54,7 @@ public class AutoscalerRuleEvaluator {
         knowledgeBases.put(drlFileName, readKnowledgeBase(drlFileName));
 
         if (log.isDebugEnabled()) {
-            log.debug("Drools file is parsed successfully : " + drlFileName);
+            log.debug("Drools file is parsed successfully: " + drlFileName);
         }
     }
     
@@ -70,7 +67,7 @@ public class AutoscalerRuleEvaluator {
         }
         ksession.fireAllRules();
         if(log.isDebugEnabled()){
-            log.debug(String.format("Rule executed for : %s ", obj));
+            log.debug(String.format("Rule executed for: %s ", obj));
         }
         return handle;
     }
@@ -93,7 +90,7 @@ public class AutoscalerRuleEvaluator {
             for (KnowledgeBuilderError error: errors) {
                 log.error(error.getMessage());
             }
-            throw new IllegalArgumentException("Could not parse knowledge.");
+            throw new IllegalArgumentException("Could not parse knowledge");
         }
         KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
         kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());

http://git-wip-us.apache.org/repos/asf/stratos/blob/5551449b/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 cadc97b..f8579c7 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
@@ -218,8 +218,8 @@ public class KubernetesIaas extends Iaas {
 
                 // persist in registry
                 CloudControllerContext.getInstance().persist();
-                log.info("Container started successfully: [cluster-id] " + clusterId + "
[member-id] " +
-                        memberContext.getMemberId());
+                log.info(String.format("Container started successfully: [cluster-id] %s [member-id]
%s",
+                        newMemberContext.getClusterId(), newMemberContext.getMemberId()));
 
                 return newMemberContext;
             } catch (Exception e) {
@@ -246,8 +246,8 @@ public class KubernetesIaas extends Iaas {
         newMemberContext.setInstanceId(pod.getId());
         newMemberContext.setDefaultPrivateIP(pod.getCurrentState().getPodIP());
         newMemberContext.setPrivateIPs(new String[]{pod.getCurrentState().getPodIP()});
-        newMemberContext.setDefaultPublicIP(pod.getCurrentState().getHostIP());
-        newMemberContext.setPublicIPs(new String[]{pod.getCurrentState().getHostIP()});
+        newMemberContext.setDefaultPublicIP(pod.getCurrentState().getHost());
+        newMemberContext.setPublicIPs(new String[]{pod.getCurrentState().getHost()});
         newMemberContext.setInitTime(memberContext.getInitTime());
         newMemberContext.setProperties(memberContext.getProperties());
         return newMemberContext;

http://git-wip-us.apache.org/repos/asf/stratos/blob/5551449b/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 415b3a7..e96ab57 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
@@ -62,8 +62,11 @@ public class InstanceCreator implements Runnable {
             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()));
+                log.info(String.format("Instance started successfully: [cartridge-type] %s
[cluster-id] %s [instance-id] %s " +
+                                "[default-private-ip] %s [default-public-ip] %s",
+                        memberContext.getCartridgeType(), memberContext.getClusterId(),
+                        memberContext.getInstanceId(), memberContext.getDefaultPrivateIP(),
+                        memberContext.getDefaultPublicIP()));
             }
 
             // Attach volumes
@@ -72,7 +75,6 @@ public class InstanceCreator implements Runnable {
             // Allocate IP address
             iaas.allocateIpAddress(clusterId, memberContext, partition);
 
-
             // Update topology
             TopologyBuilder.handleMemberSpawned(memberContext);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/5551449b/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 04f7c5b..94ae243 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
@@ -367,7 +367,9 @@ public class KubernetesApiClient implements KubernetesAPIClientInterface
{
         for (int containerPort : containerPorts) {
             Port port = new Port();
             port.setContainerPort(containerPort);
-            port.setHostPort(containerPort);
+            // Not setting host port to avoid following issue:
+            // https://github.com/openshift/origin/issues/210
+            // port.setHostPort(containerPort);
             ports.add(port);
         }
         return ports;


Mime
View raw message