Limit autoprovisioned groups to 15
This commit is contained in:
parent
c0b48e4a15
commit
de524a6688
|
|
@ -109,6 +109,8 @@ type AutoscalingOptions struct {
|
||||||
ClusterName string
|
ClusterName string
|
||||||
// NodeAutoprovisioningEnabled tells whether the node auto-provisioning is enabled for this cluster.
|
// NodeAutoprovisioningEnabled tells whether the node auto-provisioning is enabled for this cluster.
|
||||||
NodeAutoprovisioningEnabled bool
|
NodeAutoprovisioningEnabled bool
|
||||||
|
// MaxAutoprovisionedNodeGroupCount is the maximum number of autoprovisioned groups in the cluster.
|
||||||
|
MaxAutoprovisionedNodeGroupCount int
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAutoscalingContext returns an autoscaling context from all the necessary parameters passed via arguments
|
// NewAutoscalingContext returns an autoscaling context from all the necessary parameters passed via arguments
|
||||||
|
|
|
||||||
|
|
@ -295,6 +295,17 @@ func executeScaleUp(context *AutoscalingContext, info nodegroupset.ScaleUpInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func addAutoprovisionedCandidates(context *AutoscalingContext, nodeGroups []cloudprovider.NodeGroup, unschedulablePods []*apiv1.Pod) {
|
func addAutoprovisionedCandidates(context *AutoscalingContext, nodeGroups []cloudprovider.NodeGroup, unschedulablePods []*apiv1.Pod) {
|
||||||
|
autoprovisionedNodeGroupCount := 0
|
||||||
|
for _, group := range nodeGroups {
|
||||||
|
if group.Autoprovisioned() {
|
||||||
|
autoprovisionedNodeGroupCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if autoprovisionedNodeGroupCount >= context.MaxAutoprovisionedNodeGroupCount {
|
||||||
|
glog.V(4).Infof("Max autoprovisioned node group count reached")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
machines, err := context.CloudProvider.GetAvilableMachineTypes()
|
machines, err := context.CloudProvider.GetAvilableMachineTypes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warningf("Failed to get machine types: %v", err)
|
glog.Warningf("Failed to get machine types: %v", err)
|
||||||
|
|
|
||||||
|
|
@ -104,11 +104,12 @@ var (
|
||||||
expanderFlag = flag.String("expander", expander.RandomExpanderName,
|
expanderFlag = flag.String("expander", expander.RandomExpanderName,
|
||||||
"Type of node group expander to be used in scale up. Available values: ["+strings.Join(expander.AvailableExpanders, ",")+"]")
|
"Type of node group expander to be used in scale up. Available values: ["+strings.Join(expander.AvailableExpanders, ",")+"]")
|
||||||
|
|
||||||
writeStatusConfigMapFlag = flag.Bool("write-status-configmap", true, "Should CA write status information to a configmap")
|
writeStatusConfigMapFlag = flag.Bool("write-status-configmap", true, "Should CA write status information to a configmap")
|
||||||
maxInactivityTimeFlag = flag.Duration("max-inactivity", 10*time.Minute, "Maximum time from last recorded autoscaler activity before automatic restart")
|
maxInactivityTimeFlag = flag.Duration("max-inactivity", 10*time.Minute, "Maximum time from last recorded autoscaler activity before automatic restart")
|
||||||
maxFailingTimeFlag = flag.Duration("max-failing-time", 15*time.Minute, "Maximum time from last recorded successful autoscaler run before automatic restart")
|
maxFailingTimeFlag = flag.Duration("max-failing-time", 15*time.Minute, "Maximum time from last recorded successful autoscaler run before automatic restart")
|
||||||
balanceSimilarNodeGroupsFlag = flag.Bool("balance-similar-node-groups", false, "Detect similar node groups and balance the number of nodes between them")
|
balanceSimilarNodeGroupsFlag = flag.Bool("balance-similar-node-groups", false, "Detect similar node groups and balance the number of nodes between them")
|
||||||
nodeAutoprovisioningEnabled = flag.Bool("node-autoprovisioning-enabled", false, "Should CA autoprovision node groups when needed")
|
nodeAutoprovisioningEnabled = flag.Bool("node-autoprovisioning-enabled", false, "Should CA autoprovision node groups when needed")
|
||||||
|
maxAutoprovisionedNodeGroupCount = flag.Int("max-autoprovisioned-node-group-count", 15, "The maximum number of autoprovisioned groups in the cluster.")
|
||||||
)
|
)
|
||||||
|
|
||||||
func createAutoscalerOptions() core.AutoscalerOptions {
|
func createAutoscalerOptions() core.AutoscalerOptions {
|
||||||
|
|
@ -138,6 +139,7 @@ func createAutoscalerOptions() core.AutoscalerOptions {
|
||||||
ConfigNamespace: *namespace,
|
ConfigNamespace: *namespace,
|
||||||
ClusterName: *clusterName,
|
ClusterName: *clusterName,
|
||||||
NodeAutoprovisioningEnabled: *nodeAutoprovisioningEnabled,
|
NodeAutoprovisioningEnabled: *nodeAutoprovisioningEnabled,
|
||||||
|
MaxAutoprovisionedNodeGroupCount: *maxAutoprovisionedNodeGroupCount,
|
||||||
}
|
}
|
||||||
|
|
||||||
configFetcherOpts := dynamic.ConfigFetcherOptions{
|
configFetcherOpts := dynamic.ConfigFetcherOptions{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue