Skip to content
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

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

kr11
Copy link
Collaborator

@kr11 kr11 commented Nov 20, 2024

Pull Request Description

[Please provide a clear and concise description of your changes here]

This PR solves issue #xx.

  • Added UpdateByPaTypes(pa *autoscalingv1alpha1.PodAutoscaler) into ScalingContext, and added implementation in BaseScalingContext, KpaScalingContext and ApaScalingContext.

    • Note: KpaScalingContext.UpdateByPaTypes and ApaScalingContext.UpdateByPaTypes will invoke BaseScalingContext.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

  • PR title includes appropriate prefix(es)
  • Changes are clearly explained in the PR description
  • New and existing tests pass successfully
  • Code adheres to project style and best practices
  • Documentation updated to reflect changes (if applicable)
  • Thorough testing completed, no regressions introduced

By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.

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"
Copy link
Collaborator

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

Copy link
Collaborator Author

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

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
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator

@Jeffwan Jeffwan left a 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

@Jeffwan Jeffwan merged commit 8d25fb7 into main Nov 21, 2024
14 checks passed
@Jeffwan Jeffwan deleted the kangrong/features/pa_configuration branch November 21, 2024 18:44
gangmuk pushed a commit that referenced this pull request Jan 25, 2025
* enable config PA via metadata.labels

* fix linter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make PodAutoscaler Parameters Configurable
2 participants