code: func GetProportion(rs *apps.ReplicaSet, d apps.Deployment, deploymentReplicasToAdd, deploymentReplicasAdded int32) int32 {
  	if rs == nil || *(rs.Spec.Replicas) == 0 || deploymentReplicasToAdd == 0 || deploymentReplicasToAdd == deploymentReplicasAdded {
  		return int32(0)
  	}
  
  	rsFraction := getReplicaSetFraction(*rs, d)
  	allowed := deploymentReplicasToAdd - deploymentReplicasAdded
  
  	if deploymentReplicasToAdd > 0 {
  		// Use the minimum between the replica set fraction and the maximum allowed replicas
  		// when scaling up. This way we ensure we will not scale up more than the allowed
  		// replicas we can add.
  		return integer.Int32Min(rsFraction, allowed)
  	}
  	// Use the maximum between the replica set fraction and the maximum allowed replicas
  	// when scaling down. This way we ensure we will not scale down more than the allowed
  	// replicas we can remove.
  	return integer.Int32Max(rsFraction, allowed)
  }
docs: // GetProportion will estimate the proportion for the provided replica set using 1. the current size
  // of the parent deployment, 2. the replica count that needs be added on the replica sets of the
  // deployment, and 3. the total replicas added in the replica sets of the deployment so far.