Skip to content

Wire up Scale Down Delay config and annotation - #9568

Merged
knative-prow-robot merged 1 commit into
knative:masterfrom
julz:dontdelayadddelay
Sep 30, 2020
Merged

knative-prow-robot merged 1 commit into
knative:masterfrom
julz:dontdelayadddelay

Conversation

@julz

@julz julz commented Sep 25, 2020 •

Copy link
Copy Markdown
Contributor

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).

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 25, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Sep 25, 2020
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/API API objects and controllers area/autoscale labels Sep 25, 2020
@markusthoemmes

Copy link
Copy Markdown
Contributor

Let's also hold this until 0.18 is cut.

@julz

julz commented Sep 25, 2020

Copy link
Copy Markdown
Contributor Author

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 :(.

Comment on lines +113 to +114
func validateScaleDownDelay(annotations map[string]string) *apis.FieldError {
var errs *apis.FieldError

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just copy-pastaed from the other validates, so we might want to change them all in one go separately

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(unless you think we should change just this one?)

Comment on lines +116 to +124
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)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return errs
return nil

@vagababov

Copy link
Copy Markdown
Contributor

WFM, let's merge this in, and I'll rearrange things to my sense of perfect beauty in a followup :)
/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 25, 2020
@julz
julz force-pushed the dontdelayadddelay branch from 0345635 to 5041bcc Compare September 25, 2020 18:03
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 25, 2020
@julz

julz commented Sep 25, 2020

Copy link
Copy Markdown
Contributor Author

Rebased on #9565.

@julz

julz commented Sep 30, 2020

Copy link
Copy Markdown
Contributor Author

/unhold release is cut

needs a new lgtm due to rebase

/assign @markusthoemmes @vagababov

@markusthoemmes markusthoemmes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 30, 2020
@knative-prow-robot

Copy link
Copy Markdown
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@julz

julz commented Sep 30, 2020

Copy link
Copy Markdown
Contributor Author

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 30, 2020
@knative-test-reporter-robot

Copy link
Copy Markdown

The following jobs failed:

Test name Triggers Retries
pull-knative-serving-unit-tests 0/3

Failed non-flaky tests preventing automatic retry of pull-knative-serving-unit-tests:

pkg/reconciler/route.TestGlobalResyncOnUpdateDomainConfigMap/test-domain.dev
pkg/reconciler/route.TestGlobalResyncOnUpdateDomainConfigMap

@julz

julz commented Sep 30, 2020

Copy link
Copy Markdown
Contributor Author

sigh.

/retest

@codecov

codecov Bot commented Sep 30, 2020

Copy link
Copy Markdown

Codecov Report

Merging #9568 into master will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
pkg/apis/autoscaling/annotation_validation.go 100.00% <100.00%> (ø)
pkg/apis/autoscaling/v1alpha1/pa_lifecycle.go 100.00% <100.00%> (ø)
...kg/reconciler/autoscaling/kpa/resources/decider.go 100.00% <100.00%> (ø)
pkg/autoscaler/scaling/multiscaler.go 88.03% <0.00%> (-1.71%) ⬇️
pkg/reconciler/autoscaling/kpa/scaler.go 89.85% <0.00%> (+1.44%) ⬆️
pkg/reconciler/revision/reconcile_resources.go 83.13% <0.00%> (+2.40%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 886a228...5041bcc. Read the comment docs.

@knative-prow-robot
knative-prow-robot merged commit f6874ed into knative:master Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/API API objects and controllers area/autoscale cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants