You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2014/12/30 05:55:14 UTC
stratos git commit: removing container specific drools files
Repository: stratos
Updated Branches:
refs/heads/master 242e68c72 -> a15373646
removing container specific drools files
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/a1537364
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/a1537364
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/a1537364
Branch: refs/heads/master
Commit: a153736465806c07b0f083a0f39192222a8660d2
Parents: 242e68c
Author: R-Rajkumar <rr...@gmail.com>
Authored: Tue Dec 30 10:24:40 2014 +0530
Committer: R-Rajkumar <rr...@gmail.com>
Committed: Tue Dec 30 10:24:40 2014 +0530
----------------------------------------------------------------------
.../monitor/cluster/ClusterMonitor.java | 12 +-
.../common/constants/StratosConstants.java | 6 +-
.../modules/distribution/container-mincheck.drl | 54 ------
.../modules/distribution/src/assembly/bin.xml | 21 ---
.../src/main/conf/drools/container-mincheck.drl | 54 ------
.../conf/drools/container-obsoletecheck.drl | 46 -----
.../src/main/conf/drools/container-scaling.drl | 173 -------------------
7 files changed, 9 insertions(+), 357 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/a1537364/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
index 251ac46..34803e9 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
@@ -85,17 +85,17 @@ public class ClusterMonitor extends AbstractClusterMonitor {
this.networkPartitionIdToClusterLevelNetworkPartitionCtxts = new HashMap<String, ClusterLevelNetworkPartitionContext>();
readConfigurations();
autoscalerRuleEvaluator = new AutoscalerRuleEvaluator();
- autoscalerRuleEvaluator.parseAndBuildKnowledgeBaseForDroolsFile(StratosConstants.VM_OBSOLETE_CHECK_DROOL_FILE);
- autoscalerRuleEvaluator.parseAndBuildKnowledgeBaseForDroolsFile(StratosConstants.VM_SCALE_CHECK_DROOL_FILE);
- autoscalerRuleEvaluator.parseAndBuildKnowledgeBaseForDroolsFile(StratosConstants.VM_MIN_CHECK_DROOL_FILE);
+ autoscalerRuleEvaluator.parseAndBuildKnowledgeBaseForDroolsFile(StratosConstants.OBSOLETE_CHECK_DROOL_FILE);
+ autoscalerRuleEvaluator.parseAndBuildKnowledgeBaseForDroolsFile(StratosConstants.SCALE_CHECK_DROOL_FILE);
+ autoscalerRuleEvaluator.parseAndBuildKnowledgeBaseForDroolsFile(StratosConstants.MIN_CHECK_DROOL_FILE);
autoscalerRuleEvaluator.parseAndBuildKnowledgeBaseForDroolsFile(StratosConstants.DEPENDENT_SCALE_CHECK_DROOL_FILE);
this.obsoleteCheckKnowledgeSession = autoscalerRuleEvaluator.getStatefulSession(
- StratosConstants.VM_OBSOLETE_CHECK_DROOL_FILE);
+ StratosConstants.OBSOLETE_CHECK_DROOL_FILE);
this.scaleCheckKnowledgeSession = autoscalerRuleEvaluator.getStatefulSession(
- StratosConstants.VM_SCALE_CHECK_DROOL_FILE);
+ StratosConstants.SCALE_CHECK_DROOL_FILE);
this.minCheckKnowledgeSession = autoscalerRuleEvaluator.getStatefulSession(
- StratosConstants.VM_MIN_CHECK_DROOL_FILE);
+ StratosConstants.MIN_CHECK_DROOL_FILE);
this.dependentScaleCheckKnowledgeSession = autoscalerRuleEvaluator.getStatefulSession(
StratosConstants.DEPENDENT_SCALE_CHECK_DROOL_FILE);
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a1537364/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
index e58eb3a..f32000b 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
@@ -152,10 +152,10 @@ public class StratosConstants {
//drools related constants
public static final String DROOLS_DIR_NAME = "drools";
- public static final String VM_SCALE_CHECK_DROOL_FILE = "scaling.drl";
+ public static final String SCALE_CHECK_DROOL_FILE = "scaling.drl";
public static final String DEPENDENT_SCALE_CHECK_DROOL_FILE = "dependent-scaling.drl";
- public static final String VM_MIN_CHECK_DROOL_FILE = "mincheck.drl";
- public static final String VM_OBSOLETE_CHECK_DROOL_FILE = "obsoletecheck.drl";
+ public static final String MIN_CHECK_DROOL_FILE = "mincheck.drl";
+ public static final String OBSOLETE_CHECK_DROOL_FILE = "obsoletecheck.drl";
public static final String MIN_COUNT = "MIN_COUNT";
// Policy and definition related constants
http://git-wip-us.apache.org/repos/asf/stratos/blob/a1537364/products/stratos/modules/distribution/container-mincheck.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/container-mincheck.drl b/products/stratos/modules/distribution/container-mincheck.drl
deleted file mode 100755
index 2679d25..0000000
--- a/products/stratos/modules/distribution/container-mincheck.drl
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.autoscaler.rule;
-
-import org.apache.commons.logging.Log;
-import org.apache.stratos.autoscaler.context.cluster.KubernetesClusterContext;
-
-global org.apache.stratos.autoscaler.rule.RuleLog log;
-global org.apache.stratos.autoscaler.rule.RuleTasksDelegator delegator;
-global java.lang.String clusterId;
-
-rule "Container Minimum Rule"
-dialect "mvel"
- when
- $kubernetesClusterContext : KubernetesClusterContext ()
- kubernetesClusterId : String() from $kubernetesClusterContext.getKubernetesClusterID()
- minReplicas : Integer() from $kubernetesClusterContext.getMinReplicas()
- nonTerminatedReplicas : Integer() from $kubernetesClusterContext.getNonTerminatedMemberCount()
- isServiceClusterCreated : Boolean() from $kubernetesClusterContext.isServiceClusterCreated()
-
- eval(log.info("Running minimum rule: [kub-cluster] " + kubernetesClusterId + " [cluster] " + clusterId))
- eval(log.info("[min-check] " + " [cluster] : " + clusterId + " [Replicas] nonTerminated : " + nonTerminatedReplicas))
- eval(log.info("[min-check] " + " [cluster] : " + clusterId + " [Replicas] minReplicas : " + minReplicas))
- eval(nonTerminatedReplicas < minReplicas)
- then
- if (isServiceClusterCreated) {
- // we suceeded calling startContainer() once, can't call it again
- log.info("[min-check] Decided to scale-up : [cluster] : " + clusterId);
- log.info("[min-check] " + " [cluster] : " + clusterId + " ; min-rule not satisfied, scaling up to minReplicas : " + minReplicas);
- delegator.delegateScaleUpContainers($kubernetesClusterContext, minReplicas);
- } else {
- // we should call startContainer
- log.info("[min-check] Decided to create the cluster : [cluster] : " + clusterId);
- log.info("[min-check] " + " [cluster] : " + clusterId + " ; min-rule not satisfied, no containers created yet, creating minReplicas : " + minReplicas);
- delegator.delegateStartContainers($kubernetesClusterContext);
- }
-end
http://git-wip-us.apache.org/repos/asf/stratos/blob/a1537364/products/stratos/modules/distribution/src/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/assembly/bin.xml b/products/stratos/modules/distribution/src/assembly/bin.xml
index 9ddd08e..2313e4d 100755
--- a/products/stratos/modules/distribution/src/assembly/bin.xml
+++ b/products/stratos/modules/distribution/src/assembly/bin.xml
@@ -729,27 +729,6 @@
<filtered>true</filtered>
<fileMode>600</fileMode>
</file>
- <!-- container-drools files -->
- <file>
- <source>src/main/conf/drools/container-mincheck.drl</source>
- <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/drools</outputDirectory>
- <filtered>true</filtered>
- <fileMode>600</fileMode>
- </file>
- <file>
- <source>src/main/conf/drools/container-obsoletecheck.drl</source>
- <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/drools</outputDirectory>
- <filtered>true</filtered>
- <fileMode>600</fileMode>
- </file>
- <file>
- <source>src/main/conf/drools/container-scaling.drl</source>
- <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/drools</outputDirectory>
- <filtered>true</filtered>
- <fileMode>600</fileMode>
- </file>
- <!-- container-drools files -->
- <!-- /drools files end-->
<!-- autoscaler -->
<file>
<source>${project.basedir}/INSTALL.txt</source>
http://git-wip-us.apache.org/repos/asf/stratos/blob/a1537364/products/stratos/modules/distribution/src/main/conf/drools/container-mincheck.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/drools/container-mincheck.drl b/products/stratos/modules/distribution/src/main/conf/drools/container-mincheck.drl
deleted file mode 100644
index 4d0aa5e..0000000
--- a/products/stratos/modules/distribution/src/main/conf/drools/container-mincheck.drl
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.autoscaler.rule;
-
-import org.apache.commons.logging.Log;
-import org.apache.stratos.autoscaler.context.cluster.KubernetesClusterContext;
-
-global org.apache.stratos.autoscaler.rule.RuleLog log;
-global org.apache.stratos.autoscaler.rule.RuleTasksDelegator delegator;
-global java.lang.String clusterId;
-
-rule "Container Minimum Rule"
-dialect "mvel"
- when
- kubernetesClusterContext : KubernetesClusterContext ()
- kubernetesClusterId : String() from kubernetesClusterContext.getKubernetesClusterID()
- minReplicas : Integer() from kubernetesClusterContext.getMinReplicas()
- nonTerminatedReplicas : Integer() from kubernetesClusterContext.getNonTerminatedMemberCount()
- isServiceClusterCreated : Boolean() from kubernetesClusterContext.isServiceClusterCreated()
-
- eval(log.info("Running minimum rule: [kub-cluster] " + kubernetesClusterId + " [cluster] " + clusterId))
- eval(log.info("[min-check] " + " [cluster] : " + clusterId + " [Replicas] nonTerminated : " + nonTerminatedReplicas))
- eval(log.info("[min-check] " + " [cluster] : " + clusterId + " [Replicas] minReplicas : " + minReplicas))
- eval(nonTerminatedReplicas < minReplicas)
- then
- if (isServiceClusterCreated) {
- // we suceeded calling startContainer() once, can't call it again
- log.info("[min-check] Decided to scale-up : [cluster] : " + clusterId);
- log.info("[min-check] " + " [cluster] : " + clusterId + " ; min-rule not satisfied, scaling up to minReplicas : " + minReplicas);
- delegator.delegateScaleUpContainers(kubernetesClusterContext, minReplicas);
- } else {
- // we should call startContainer
- log.info("[min-check] Decided to create the cluster : [cluster] : " + clusterId);
- log.info("[min-check] " + " [cluster] : " + clusterId + " ; min-rule not satisfied, no containers created yet, creating minReplicas : " + minReplicas);
- delegator.delegateStartContainers(kubernetesClusterContext);
- }
-end
http://git-wip-us.apache.org/repos/asf/stratos/blob/a1537364/products/stratos/modules/distribution/src/main/conf/drools/container-obsoletecheck.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/drools/container-obsoletecheck.drl b/products/stratos/modules/distribution/src/main/conf/drools/container-obsoletecheck.drl
deleted file mode 100644
index f6dd3e7..0000000
--- a/products/stratos/modules/distribution/src/main/conf/drools/container-obsoletecheck.drl
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.autoscaler.rule;
-
-import org.apache.commons.logging.Log;
-import org.apache.stratos.autoscaler.context.cluster.KubernetesClusterContext;
-
-global org.apache.stratos.autoscaler.rule.RuleLog log;
-global org.apache.stratos.autoscaler.rule.RuleTasksDelegator delegator;
-global java.lang.String clusterId;
-
-rule "Terminate Obsoleted Containers"
-dialect "mvel"
- when
- kubernetesClusterContext : KubernetesClusterContext ()
- kubernetesClusterId : String() from kubernetesClusterContext.getKubernetesClusterID()
- obsoleteReplicas : Integer() from kubernetesClusterContext.getObsoletedMembers().size()
-
- eval(log.info("Running obsolete containers rule [kub-cluster] : " + kubernetesClusterId + " [cluster] : " + clusterId))
- eval(log.info("[obsolete-check] " + "[cluster] : " + clusterId + " [Replicas] obsoleteReplicas : " + obsoleteReplicas))
- eval(kubernetesClusterContext.getObsoletedMembers().keySet().size() > 0)
- memberId : String() from kubernetesClusterContext.getObsoletedMembers().keySet()
- eval(log.debug("[obsolete-check] [kub-cluster] : " + kubernetesClusterId + " [cluster] : " + clusterId + " Member id : " + memberId))
- then
- log.info("[obsolete-check] Terminating the obsolete member with id : " + memberId + " in the cluster : " + clusterId);
- delegator.delegateTerminateContainer(kubernetesClusterContext, memberId);
-end
-
-
http://git-wip-us.apache.org/repos/asf/stratos/blob/a1537364/products/stratos/modules/distribution/src/main/conf/drools/container-scaling.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/drools/container-scaling.drl b/products/stratos/modules/distribution/src/main/conf/drools/container-scaling.drl
deleted file mode 100644
index 56a2fae..0000000
--- a/products/stratos/modules/distribution/src/main/conf/drools/container-scaling.drl
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.autoscaler.rule;
-
-import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy;
-import org.apache.stratos.autoscaler.pojo.policy.autoscale.LoadThresholds;
-import org.apache.stratos.autoscaler.context.cluster.KubernetesClusterContext;
-
-global org.apache.stratos.autoscaler.rule.RuleLog log;
-global org.apache.stratos.autoscaler.rule.RuleTasksDelegator delegator;
-global org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy autoscalePolicy;
-global java.lang.String clusterId;
-global java.lang.Boolean rifReset;
-global java.lang.Boolean mcReset;
-global java.lang.Boolean laReset;
-
-rule "Containers Scaling Rule"
-dialect "mvel"
- when
- kubernetesClusterContext : KubernetesClusterContext ()
- kubernetesClusterId : String() from kubernetesClusterContext.getKubernetesClusterID()
- minReplicas : Integer() from kubernetesClusterContext.getMinReplicas()
- maxReplicas : Integer() from kubernetesClusterContext.getMaxReplicas()
- nonTerminatedReplicas : Integer() from kubernetesClusterContext.getNonTerminatedMemberCount()
- activeReplicas : Integer() from kubernetesClusterContext.getActiveMemberCount()
-
- eval(log.info("Running scaling rule [kub-cluster] : " + kubernetesClusterId + " [cluster] : " + clusterId))
-
- loadThresholds : LoadThresholds() from autoscalePolicy.getLoadThresholds()
-
- rifUpperLimit : Float() from loadThresholds.getRequestsInFlight().getUpperLimit()
- rifLowerLimit : Float() from loadThresholds.getRequestsInFlight().getLowerLimit()
-
- rifAverage : Float() from kubernetesClusterContext.getAverageRequestsInFlight()
- rifGradient : Float() from kubernetesClusterContext.getRequestsInFlightGradient()
- rifSecondDerivative : Float() from kubernetesClusterContext.getRequestsInFlightSecondDerivative()
- rifPredictedValue : Double() from delegator.getPredictedValueForNextMinute(rifAverage, rifGradient, rifSecondDerivative, 1)
-
- mcUpperLimit : Float() from loadThresholds.getMemoryConsumption().getUpperLimit()
- mcLowerLimit : Float() from loadThresholds.getMemoryConsumption().getLowerLimit()
-
- memoryConsumptionAverage : Float() from kubernetesClusterContext.getAverageMemoryConsumption()
- memoryConsumptionGradient : Float() from kubernetesClusterContext.getMemoryConsumptionGradient()
- memoryConsumptionSecondDerivative : Float() from kubernetesClusterContext.getMemoryConsumptionSecondDerivative()
- mcPredictedValue : Double() from delegator.getPredictedValueForNextMinute(memoryConsumptionAverage, memoryConsumptionGradient, memoryConsumptionSecondDerivative, 1)
-
- laUpperLimit : Float() from loadThresholds.getLoadAverage().getUpperLimit()
- laLowerLimit : Float() from loadThresholds.getLoadAverage().getLowerLimit()
-
- loadAverageAverage : Float() from kubernetesClusterContext.getAverageLoadAverage()
- loadAverageGradient : Float() from kubernetesClusterContext.getLoadAverageGradient()
- loadAverageSecondDerivative : Float() from kubernetesClusterContext.getLoadAverageSecondDerivative()
- laPredictedValue : Double() from delegator.getPredictedValueForNextMinute(loadAverageAverage, loadAverageGradient, loadAverageSecondDerivative, 1)
-
- scaleUpForRif : Boolean() from (rifReset && (rifPredictedValue > rifUpperLimit))
- scaleUpForMc : Boolean() from (mcReset && (mcPredictedValue > mcUpperLimit))
- scaleUpForLa : Boolean() from (laReset && (laPredictedValue > laUpperLimit))
-
- scaleDownForRif : Boolean() from (rifReset && (rifPredictedValue < rifUpperLimit))
- scaleDownForMc : Boolean() from (mcReset && (mcPredictedValue < mcUpperLimit))
- scaleDownForLa : Boolean() from (laReset && (laPredictedValue < laUpperLimit))
-
- scaleUp : Boolean() from (scaleUpForRif || scaleUpForMc || scaleUpForLa)
- scaleDown : Boolean() from (scaleDownForRif && scaleDownForMc && scaleDownForLa)
-
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] minReplicas : " + minReplicas))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] maxReplicas : " + maxReplicas))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] nonTerminated : " + nonTerminatedReplicas))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [Replicas] activeReplicas : " + activeReplicas))
-
- eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] resetted ? : " + rifReset))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] predicted value : " + rifPredictedValue))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] upper limit : " + rifUpperLimit))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] lower limit : " + rifLowerLimit))
-
- eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] resetted ? : " + mcReset))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] predicted value : " + mcPredictedValue))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] upper limit : " + mcUpperLimit))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] lower limit : " + mcLowerLimit))
-
- eval(log.debug("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] resetted ? : " + laReset))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] predicted value : " + laPredictedValue))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] upper limit : " + laUpperLimit))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] lower limit : " + laLowerLimit))
-
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " scale-up action : " + scaleUp))
- eval(log.info("[scaling] " + " [cluster] : " + clusterId + " scale-down action : " + scaleDown))
-
- then
- if (scaleUp) {
- int requiredReplicas = 0;
- if (scaleUpForRif) {
- int predictedReplicasForRif = delegator.getPredictedReplicasForStat(minReplicas, rifUpperLimit, rifPredictedValue);
- log.info("[scaling] " + " [cluster] : " + clusterId + " [RequestInFlight] predicted replicas : " + predictedReplicasForRif);
- if (predictedReplicasForRif > requiredReplicas ) {
- requiredReplicas = predictedReplicasForRif;
- }
- }
- if (scaleUpForMc) {
- int predictedReplicasForMc = delegator.getPredictedReplicasForStat(minReplicas, mcUpperLimit, mcPredictedValue);
- log.info("[scaling] " + " [cluster] : " + clusterId + " [MemoryConsumption] predicted replicas : " + predictedReplicasForMc);
- if (predictedReplicasForMc > requiredReplicas ) {
- requiredReplicas = predictedReplicasForMc;
- }
- }
- if (scaleUpForLa) {
- int predictedReplicasForLa = delegator.getPredictedReplicasForStat(minReplicas, laUpperLimit, laPredictedValue);
- log.info("[scaling] " + " [cluster] : " + clusterId + " [LoadAverage] predicted replicas : " + predictedReplicasForLa);
- if (predictedReplicasForLa > requiredReplicas ) {
- requiredReplicas = predictedReplicasForLa;
- }
- }
- //max-check
- if (requiredReplicas > maxReplicas) {
- log.info("[scaling] " + " [cluster] : " + clusterId + " predicted replicas > max replicas : ");
- requiredReplicas = maxReplicas;
- }
- //min-check
- if (requiredReplicas < minReplicas) {
- log.info("[scaling] " + " [cluster] : " + clusterId + " predicted replicas < min replicas : ");
- requiredReplicas = minReplicas;
- }
- //expand the cluster
- if (requiredReplicas > nonTerminatedReplicas) {
- log.info("[scaling] Decided to scale-up : [cluster] : " + clusterId);
- log.info("[scaling-up] " + " [cluster] : " + clusterId + " valid number of replicas to expand : " + requiredReplicas);
- delegator.delegateScaleUpContainers(kubernetesClusterContext, requiredReplicas);
- }
- //shrink the cluster
- if (requiredReplicas < nonTerminatedReplicas) {
- if (requiredReplicas < activeReplicas) {
- log.info("[scaling] Decided to scale-down : [cluster] : " + clusterId);
- log.info("[scaling-down] " + " [cluster] : " + clusterId + " valid number of replicas to shrink : " + requiredReplicas);
- delegator.delegateScaleDownContainers(kubernetesClusterContext, requiredReplicas);
- } else {
- log.info("[scaling] " + " [cluster] : " + clusterId + " Even if requiredReplicas < nonTerminatedReplicas, still requiredReplicas >= activeReplicas ; hence not scaling down ");
- }
- }
- if (requiredReplicas == nonTerminatedReplicas) {
- log.info("[scaling] " + " [cluster] : " + clusterId + " Non terminated replicas and predicted replicas are same");
- }
-
- } else if (scaleDown) {
- if (activeReplicas > minReplicas) {
- log.info("[scaling] Decided to scale-down [cluster] : " + clusterId);
- log.info("[scaling-down] " + " [cluster] : " + clusterId + " shrink the cluster to minReplicas : " + minReplicas);
- //shrink the cluster to minReplicas
- delegator.delegateScaleDownContainers(kubernetesClusterContext, minReplicas);
- } else {
- log.info("[scaling] " + " [cluster] : " + clusterId + " Even if all predicted stats < upperLimit, still activeReplicas <= minReplicas ; hence not scaling down ");
- }
- } else {
- log.info("[scaling] No decision made to either scale up or down ... ");
- }
-end
-