fix: fix bugs about validation of targetMinReplicas<=targetMaxReplicas and CronFederatedHPA status
Signed-off-by: jwcesign <jwcesign@gmail.com>
This commit is contained in:
parent
ee3fa49ac0
commit
4da22c3f28
|
@ -268,7 +268,7 @@ func (c *CronFederatedHPAJob) addFailedExecutionHistory(
|
|||
|
||||
func (c *CronFederatedHPAJob) addSuccessExecutionHistory(
|
||||
cronFHPA *autoscalingv1alpha1.CronFederatedHPA,
|
||||
appliedReplicas, appliedMaxReplicas, appliedMinReplicas *int32) error {
|
||||
appliedReplicas, appliedMinReplicas, appliedMaxReplicas *int32) error {
|
||||
_, nextExecutionTime := c.scheduler.NextRun()
|
||||
|
||||
// Add success history record, return false if there is no such rule
|
||||
|
|
|
@ -16,6 +16,7 @@ package cronfederatedhpa
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"net/http"
|
||||
"time"
|
||||
_ "time/tzdata"
|
||||
|
@ -140,11 +141,11 @@ func validateCronFederatedHPAScalingReplicas(rule autoscalingv1alpha1.CronFedera
|
|||
errs = append(errs, field.Invalid(fldPath.Child("targetMinReplicas"), "",
|
||||
"targetMinReplicas should be larger than 0"))
|
||||
}
|
||||
if pointer.Int32Deref(rule.TargetMaxReplicas, 1) <= 0 {
|
||||
if pointer.Int32Deref(rule.TargetMaxReplicas, math.MaxInt32) <= 0 {
|
||||
errs = append(errs, field.Invalid(fldPath.Child("targetMaxReplicas"), "",
|
||||
"targetMaxReplicas should be larger than 0"))
|
||||
}
|
||||
if pointer.Int32Deref(rule.TargetMinReplicas, 1) > pointer.Int32Deref(rule.TargetMaxReplicas, 1) {
|
||||
if pointer.Int32Deref(rule.TargetMinReplicas, 1) > pointer.Int32Deref(rule.TargetMaxReplicas, math.MaxInt32) {
|
||||
errs = append(errs, field.Invalid(fldPath.Child("targetMinReplicas"), "",
|
||||
"targetMaxReplicas should be larger than or equal to targetMinReplicas"))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue