Repository navigation
Wire up Scale Down Delay config and annotation - #9568
Conversation
|
Let's also hold this until 0.18 is cut. |
|
Was kind of hoping to sneak it in to 0.18 since it's effectively feature flagged but.. yeah, probably a good call not to since we're so close now :(. |
| func validateScaleDownDelay(annotations map[string]string) *apis.FieldError { | ||
| var errs *apis.FieldError |
There was a problem hiding this comment.
| func validateScaleDownDelay(annotations map[string]string) *apis.FieldError { | |
| var errs *apis.FieldError | |
| func validateScaleDownDelay(annotations map[string]string) (errs *apis.FieldError) { |
A rare case when I actually prefer the named return value :)
Though in this particular case I'd restructure differently -- see suggestions below.
There was a problem hiding this comment.
this is just copy-pastaed from the other validates, so we might want to change them all in one go separately
There was a problem hiding this comment.
(unless you think we should change just this one?)
| if d, err := time.ParseDuration(w); err != nil { | ||
| errs = apis.ErrInvalidValue(w, ScaleDownDelayAnnotationKey) | ||
| } else if d < 0 || d > WindowMax { | ||
| // Since we disallow windows longer than WindowMax, so we should limit this | ||
| // as well. | ||
| errs = apis.ErrOutOfBoundsValue(w, 0*time.Second, WindowMax, ScaleDownDelayAnnotationKey) | ||
| } else if d.Round(time.Second) != d { | ||
| errs = apis.ErrGeneric("must be specified with at most second precision", ScaleDownDelayAnnotationKey) | ||
| } |
There was a problem hiding this comment.
| if d, err := time.ParseDuration(w); err != nil { | |
| errs = apis.ErrInvalidValue(w, ScaleDownDelayAnnotationKey) | |
| } else if d < 0 || d > WindowMax { | |
| // Since we disallow windows longer than WindowMax, so we should limit this | |
| // as well. | |
| errs = apis.ErrOutOfBoundsValue(w, 0*time.Second, WindowMax, ScaleDownDelayAnnotationKey) | |
| } else if d.Round(time.Second) != d { | |
| errs = apis.ErrGeneric("must be specified with at most second precision", ScaleDownDelayAnnotationKey) | |
| } | |
| switch d, err := time.ParseDuration(w); { | |
| case err != nil: | |
| return apis.ErrInvalidValue(w, ScaleDownDelayAnnotationKey) | |
| case d < 0 || d > WindowMax: | |
| // Since we disallow windows longer than WindowMax, so we should limit this | |
| // as well. | |
| return apis.ErrOutOfBoundsValue(w, 0*time.Second, WindowMax, ScaleDownDelayAnnotationKey) | |
| case d.Round(time.Second) != d: | |
| return apis.ErrGeneric("must be specified with at most second precision", ScaleDownDelayAnnotationKey) | |
| } |
| errs = apis.ErrGeneric("must be specified with at most second precision", ScaleDownDelayAnnotationKey) | ||
| } | ||
| } | ||
| return errs |
There was a problem hiding this comment.
| return errs | |
| return nil |
|
WFM, let's merge this in, and I'll rearrange things to my sense of perfect beauty in a followup :) |
0345635 to
5041bcc
Compare
|
Rebased on #9565. |
|
/unhold release is cut needs a new lgtm due to rebase /assign @markusthoemmes @vagababov |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: julz, markusthoemmes The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/unhold |
|
The following jobs failed:
Failed non-flaky tests preventing automatic retry of pull-knative-serving-unit-tests: |
|
sigh. /retest |
Codecov Report
@@ Coverage Diff @@
## master #9568 +/- ##
==========================================
+ Coverage 88.77% 88.81% +0.04%
==========================================
Files 213 213
Lines 9397 9416 +19
==========================================
+ Hits 8342 8363 +21
Misses 797 797
+ Partials 258 256 -2
Continue to review full report at Codecov.
|
Part of #9092.
After this all that remains (I think) is adding the config map example (which is where I'll add the Release Note).
Docs PR: knative/docs#2857.
/hold this will need rebasing once the first two commits land in #9565./hold for release on Tuesday
/assign @markusthoemmes @vagababov
(until #9565 lands you probably want to skip to third commit for the new stuff).