code: func convertDesiredReplicasWithRules(currentReplicas, desiredReplicas, hpaMinReplicas, hpaMaxReplicas int32) (int32, string, string) {
  
  	var minimumAllowedReplicas int32
  	var maximumAllowedReplicas int32
  
  	var possibleLimitingCondition string
  	var possibleLimitingReason string
  
  	if hpaMinReplicas == 0 {
  		minimumAllowedReplicas = 1
  		possibleLimitingReason = "the desired replica count is zero"
  	} else {
  		minimumAllowedReplicas = hpaMinReplicas
  		possibleLimitingReason = "the desired replica count is less than the minimum replica count"
  	}
  
  	// Do not upscale too much to prevent incorrect rapid increase of the number of master replicas caused by
  	// bogus CPU usage report from heapster/kubelet (like in issue #32304).
  	scaleUpLimit := calculateScaleUpLimit(currentReplicas)
  
  	if hpaMaxReplicas > scaleUpLimit {
  		maximumAllowedReplicas = scaleUpLimit
  
  		possibleLimitingCondition = "ScaleUpLimit"
  		possibleLimitingReason = "the desired replica count is increasing faster than the maximum scale rate"
  	} else {
  		maximumAllowedReplicas = hpaMaxReplicas
  
  		possibleLimitingCondition = "TooManyReplicas"
  		possibleLimitingReason = "the desired replica count is more than the maximum replica count"
  	}
  
  	if desiredReplicas < minimumAllowedReplicas {
  		possibleLimitingCondition = "TooFewReplicas"
  
  		return minimumAllowedReplicas, possibleLimitingCondition, possibleLimitingReason
  	} else if desiredReplicas > maximumAllowedReplicas {
  		return maximumAllowedReplicas, possibleLimitingCondition, possibleLimitingReason
  	}
  
  	return desiredReplicas, "DesiredWithinRange", "the desired count is within the acceptable range"
  }
docs: // convertDesiredReplicas performs the actual normalization, without depending on `HorizontalController` or `HorizontalPodAutoscaler`