in src/scaler/scaler-core/scaling-methods/base.js [296:332]
function ensureValidClusterSize(cluster, suggestedSize, scalingDirection) {
let size = suggestedSize;
if (suggestedSize > cluster.maxSize) {
logger.debug({
message: `\tClamping the suggested size of ${suggestedSize} ${cluster.units} to configured maximum ${cluster.maxSize}`,
projectId: cluster.projectId,
regionId: cluster.regionId,
clusterId: cluster.clusterId,
});
size = cluster.maxSize;
} else if (suggestedSize < cluster.minSize) {
logger.debug({
message: `\tClamping the suggested size of ${suggestedSize} ${cluster.units} to configured minimum ${cluster.minSize}`,
projectId: cluster.projectId,
regionId: cluster.regionId,
clusterId: cluster.clusterId,
});
size = cluster.minSize;
}
/*
* Check for a cluster size that is too small to prevent an invalid scaling operation.
* A check for a cluster size that is too large is not included here because this is
* dependent on the number of replicas in the cluster.
*/
if (size < CLUSTER_SIZE_MIN) {
size = CLUSTER_SIZE_MIN;
logger.debug({
message: `\tModifiying scale ${scalingDirection} to ${size} ${cluster.units} to ensure minimally valid ${CLUSTER_SIZE_MIN} ${cluster.units}`,
projectId: cluster.projectId,
regionId: cluster.regionId,
clusterId: cluster.clusterId,
});
}
return size;
}