-
Notifications
You must be signed in to change notification settings - Fork 263
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
Enable setting PodAutoscaler configuration via YAML labels #409
Conversation
autoscaling.aibrix.ai/max-scale-up-rate: "2" | ||
autoscaling.aibrix.ai/max-scale-down-rate: "2" | ||
kpa.autoscaling.aibrix.ai/stable-window: "60s" | ||
kpa.autoscaling.aibrix.ai/scale-down-delay: "60s" |
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.
Do we plan to use other units like min etc? If not, should we alway use second
so we do not need to parse the s
there
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.
Do we plan to use other units like min etc? If not, should we alway use
second
so we do not need to parse thes
there
I think we could remain the form of "30s" for some reason:
- It refers to the KPA setting, like
autoscaling.knative.dev/window: "40s"
(doc). - Furthermore, Go has a built-in function which parses "30s" into the
time.Duration
. If we only keep 30, we still need to add* time.second
manually.
@@ -24,6 +37,7 @@ type ScalingContext interface { | |||
GetMaxScaleUpRate() float64 | |||
GetMaxScaleDownRate() float64 | |||
GetCurrentUsePerPod() float64 | |||
UpdateByPaTypes(pa *autoscalingv1alpha1.PodAutoscaler) error |
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.
What does UpdateByPaTypes
mean? it tries to build the context from the object?
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.
What does
UpdateByPaTypes
mean? it tries to build the context from the object?
Yes, when KpaAutoscaler
or ApaAutoscaler
invoke UpdateScalingContext(pa)
, they need to use pa
object to update KpaScalingContext
and ApaScalingContext
correspondingly.
Another benefit is that KpaScalingContext
and ApaScalingContext
possess certain common parameters within BaseScalingContext
. Consequently, they can call BaseScalingContext.UpdateByPaTypes
to avoid the duplicate codes.
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.
it looks good to me
* enable config PA via metadata.labels * fix linter
Pull Request Description
[Please provide a clear and concise description of your changes here]
This PR solves issue #xx.
Added
UpdateByPaTypes(pa *autoscalingv1alpha1.PodAutoscaler)
intoScalingContext
, and added implementation inBaseScalingContext
,KpaScalingContext
andApaScalingContext
.KpaScalingContext.UpdateByPaTypes
andApaScalingContext.UpdateByPaTypes
will invokeBaseScalingContext.UpdateByPaTypes
first.Added unit tests.
Related Issues
Resolves: #406
Important: Before submitting, please complete the description above and review the checklist below.
Contribution Guidelines (Expand for Details)
We appreciate your contribution to aibrix! To ensure a smooth review process and maintain high code quality, please adhere to the following guidelines:
Pull Request Title Format
Your PR title should start with one of these prefixes to indicate the nature of the change:
[Bug]
: Corrections to existing functionality[CI]
: Changes to build process or CI pipeline[Docs]
: Updates or additions to documentation[API]
: Modifications to aibrix's API or interface[CLI]
: Changes or additions to the Command Line Interface[Misc]
: For changes not covered above (use sparingly)Note: For changes spanning multiple categories, use multiple prefixes in order of importance.
Submission Checklist
By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.