stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject git commit: Removing autoscaling policy instance in KubernetesClusterMonitor
Date Fri, 24 Oct 2014 14:33:54 GMT
Repository: stratos
Updated Branches:
  refs/heads/master aa2dedefb -> 004dd5216


Removing autoscaling policy instance in KubernetesClusterMonitor


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

Branch: refs/heads/master
Commit: 004dd52163fdc7a7a18b08d545ef26681175ddff
Parents: aa2dede
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Fri Oct 24 20:03:48 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Fri Oct 24 20:03:48 2014 +0530

----------------------------------------------------------------------
 .../autoscaler/monitor/ClusterMonitorFactory.java      |  2 +-
 .../autoscaler/monitor/KubernetesClusterMonitor.java   | 13 +++++--------
 .../monitor/KubernetesServiceClusterMonitor.java       |  7 ++++---
 3 files changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/004dd521/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitorFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitorFactory.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitorFactory.java
index d3932ea..d7238bf 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitorFactory.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitorFactory.java
@@ -391,7 +391,7 @@ public class ClusterMonitorFactory {
                 kubernetesClusterCtxt,
                 cluster.getClusterId(),
                 cluster.getServiceName(),
-                policy);
+                policy.getId());
 
         dockerClusterMonitor.setStatus(ClusterStatus.Created);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/004dd521/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/KubernetesClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/KubernetesClusterMonitor.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/KubernetesClusterMonitor.java
index c6f709c..0254030 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/KubernetesClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/KubernetesClusterMonitor.java
@@ -24,6 +24,7 @@ import org.apache.stratos.autoscaler.KubernetesClusterContext;
 import org.apache.stratos.autoscaler.MemberStatsContext;
 import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClient;
 import org.apache.stratos.autoscaler.exception.TerminationException;
+import org.apache.stratos.autoscaler.policy.PolicyManager;
 import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
 import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
 import org.apache.stratos.messaging.domain.topology.Cluster;
@@ -61,16 +62,16 @@ public abstract class KubernetesClusterMonitor extends AbstractClusterMonitor
{
     private static final Log log = LogFactory.getLog(KubernetesClusterMonitor.class);
 
     private KubernetesClusterContext kubernetesClusterCtxt;
-    protected AutoscalePolicy autoscalePolicy;
+    protected String autoscalePolicyId;
 
     protected KubernetesClusterMonitor(String clusterId, String serviceId,
                                        KubernetesClusterContext kubernetesClusterContext,
                                        AutoscalerRuleEvaluator autoscalerRuleEvaluator,
-                                       AutoscalePolicy autoscalePolicy) {
+                                       String autoscalePolicyId) {
 
         super(clusterId, serviceId, autoscalerRuleEvaluator);
         this.kubernetesClusterCtxt = kubernetesClusterContext;
-        this.autoscalePolicy = autoscalePolicy;
+        this.autoscalePolicyId = autoscalePolicyId;
     }
 
     @Override
@@ -488,13 +489,9 @@ public abstract class KubernetesClusterMonitor extends AbstractClusterMonitor
{
     }
 
     public AutoscalePolicy getAutoscalePolicy() {
-        return autoscalePolicy;
+        return PolicyManager.getInstance().getAutoscalePolicy(autoscalePolicyId);
     }
 
-    public void setAutoscalePolicy(AutoscalePolicy autoscalePolicy) {
-        this.autoscalePolicy = autoscalePolicy;
-    }
-    
     private Member getMemberByMemberId(String memberId) {
         try {
             TopologyManager.acquireReadLock();

http://git-wip-us.apache.org/repos/asf/stratos/blob/004dd521/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/KubernetesServiceClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/KubernetesServiceClusterMonitor.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/KubernetesServiceClusterMonitor.java
index 8abcf33..c0a435c 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/KubernetesServiceClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/KubernetesServiceClusterMonitor.java
@@ -28,6 +28,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.autoscaler.KubernetesClusterContext;
 import org.apache.stratos.autoscaler.exception.InvalidArgumentException;
+import org.apache.stratos.autoscaler.policy.PolicyManager;
 import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
 import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
 import org.apache.stratos.autoscaler.util.AutoScalerConstants;
@@ -50,12 +51,12 @@ public final class KubernetesServiceClusterMonitor extends KubernetesClusterMoni
 
     public KubernetesServiceClusterMonitor(KubernetesClusterContext kubernetesClusterCtxt,
                                            String serviceClusterID, String serviceId,
-                                           AutoscalePolicy autoscalePolicy) {
+                                           String autoscalePolicyId) {
         super(serviceClusterID, serviceId, kubernetesClusterCtxt,
               new AutoscalerRuleEvaluator(
                       StratosConstants.CONTAINER_MIN_CHECK_DROOL_FILE,
                       StratosConstants.CONTAINER_SCALE_CHECK_DROOL_FILE),
-              autoscalePolicy);
+              autoscalePolicyId);
         readConfigurations();
     }
 
@@ -100,7 +101,7 @@ public final class KubernetesServiceClusterMonitor extends KubernetesClusterMoni
         String clusterId = getClusterId();
         if (rifReset || memoryConsumptionReset || loadAverageReset) {
             getScaleCheckKnowledgeSession().setGlobal("clusterId", clusterId);
-            getScaleCheckKnowledgeSession().setGlobal("autoscalePolicy", autoscalePolicy);
+            getScaleCheckKnowledgeSession().setGlobal("autoscalePolicy", getAutoscalePolicy());
             getScaleCheckKnowledgeSession().setGlobal("rifReset", rifReset);
             getScaleCheckKnowledgeSession().setGlobal("mcReset", memoryConsumptionReset);
             getScaleCheckKnowledgeSession().setGlobal("laReset", loadAverageReset);


Mime
View raw message