Skip to content

Commit

Permalink
flag config error if admissionGP exceeds warmupGP (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrove-oss committed Dec 13, 2024
1 parent 515c0a3 commit b6bd577
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ func ValidateAppWrapperConfig(config *AppWrapperConfig) error {
config.FaultTolerance.AdmissionGracePeriod, config.FaultTolerance.GracePeriodMaximum)
}
if config.FaultTolerance.WarmupGracePeriod > config.FaultTolerance.GracePeriodMaximum {
return fmt.Errorf("WarmupGracePeriod %v exceeds GracePeriodCeiling %v",
return fmt.Errorf("AdmissionGracePeriod %v exceeds GracePeriodCeiling %v",
config.FaultTolerance.WarmupGracePeriod, config.FaultTolerance.GracePeriodMaximum)
}
if config.FaultTolerance.AdmissionGracePeriod > config.FaultTolerance.WarmupGracePeriod {
return fmt.Errorf("AdmissionGracePeriod %v exceeds AdmissionGracePeriod %v",
config.FaultTolerance.WarmupGracePeriod, config.FaultTolerance.GracePeriodMaximum)
}
if config.FaultTolerance.SuccessTTL <= 0 {
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ var _ = Describe("AppWrapper Config", func() {
bad = &FaultToleranceConfig{WarmupGracePeriod: 10 * time.Second, GracePeriodMaximum: 1 * time.Second}
Expect(ValidateAppWrapperConfig(&AppWrapperConfig{FaultTolerance: bad})).ShouldNot(Succeed())

bad = &FaultToleranceConfig{AdmissionGracePeriod: 10 * time.Second, WarmupGracePeriod: 1 * time.Second}
Expect(ValidateAppWrapperConfig(&AppWrapperConfig{FaultTolerance: bad})).ShouldNot(Succeed())

bad = &FaultToleranceConfig{SuccessTTL: -1 * time.Second}
Expect(ValidateAppWrapperConfig(&AppWrapperConfig{FaultTolerance: bad})).ShouldNot(Succeed())
})
Expand Down

0 comments on commit b6bd577

Please sign in to comment.