New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to set QP resources per service #14038
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #14038 +/- ##
==========================================
- Coverage 86.22% 86.19% -0.03%
==========================================
Files 199 199
Lines 14767 14795 +28
==========================================
+ Hits 12733 12753 +20
- Misses 1732 1737 +5
- Partials 302 305 +3
☔ View full report in Codecov by Sentry. |
/assign @dprotaso |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we deprecate the % knob?
pkg/apis/serving/register.go
Outdated
@@ -162,6 +180,30 @@ var ( | |||
QueueSidecarResourcePercentageAnnotationKey, | |||
"queue.sidecar." + GroupName + "/resourcePercentage", | |||
} | |||
QueueSidecarCPUResourceRequestAnnotation = kmap.KeyPriority{ | |||
QueueSidecarCPUResourceRequestAnnotationKey, | |||
"queue.sidecar." + GroupName + "/CPUResourceRequest", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need the alternate casing for new annotations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dprotaso You mean s/CPUResourceRequest
/cpuesourcerequest
? Wouldnt that be a bit misaligned compared to the resourcePercentage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resourcePercentage
is present here because it was the old casing that we supported. We didn't want to break old deployments
For new keys we should just use kebab-casing
only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok then I will fix.
I was mixed on whether this should be exposed to users but ultimately if they can set their own request/limits on the user container then it's no different from setting it on the sidecar (in terms of abusing it) |
LGTM. |
Yeah I think it makes sense. |
Hi @dprotaso gentle ping. I deprecated the resource percentage (should be done at docs side too), now it prints:
Also replied to the comments above. |
@dprotaso gentle ping, I removed the redundant key. |
@@ -188,14 +188,15 @@ func validateQueueSidecarAnnotation(m map[string]string) *apis.FieldError { | |||
if !ok { | |||
return nil | |||
} | |||
errs := apis.ErrGeneric("Queue proxy resource percentage annotation is deprecated. Please use the available annotations to explicitly set resource values per service").ViaKey(k).At(apis.WarningLevel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should validate the new annotations here by attempting to parse them. Then it will fail when we create/update/apply vs. silently dropping it later on when creating the deployment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok will add it.
@dprotaso thanks for reviewing, I added the validation part:
|
validate := func(k, v string) *apis.FieldError { | ||
if _, err := resource.ParseQuantity(v); err != nil { | ||
return errs.Also(apis.ErrInvalidValue(v, apis.CurrentField).ViaKey(k)) | ||
} | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just move this into the loop below? so we're not creating a closure on every validate invocation?
if ok { | ||
errs = errs.Also(validate(k, v)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ok { | |
errs = errs.Also(validate(k, v)) | |
} | |
if !ok { | |
continue | |
} | |
... // add code above here |
@dprotaso gentle ping. |
@dprotaso hi should we merge this? I will add the docs. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, skonto The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
* allow to set qp resources per service * add ephemeral storage * deprecate resource percentage * remove the old casing * add proper validation * fix loop
Part of the work for #13861.
Proposed Changes
Release Note