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

feat(serverless): add option to scale on CPU usage #1541

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const unmarshalContainerScalingOption = (

return {
concurrentRequestsThreshold: data.concurrent_requests_threshold,
cpuUsageThreshold: data.cpu_usage_threshold,
} as ContainerScalingOption
}

Expand Down Expand Up @@ -371,6 +372,7 @@ const marshalContainerScalingOption = (
param: 'concurrent_requests_threshold',
value: request.concurrentRequestsThreshold,
},
{ param: 'cpu_usage_threshold', value: request.cpuUsageThreshold },
]),
})

Expand Down
15 changes: 13 additions & 2 deletions packages/clients/src/api/container/v1beta1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,15 @@ export type TriggerStatus =

export interface ContainerScalingOption {
/**
* One-of ('scalingRule'): at most one of 'concurrentRequestsThreshold' could
* be set.
* One-of ('scalingRule'): at most one of 'concurrentRequestsThreshold',
* 'cpuUsageThreshold' could be set.
*/
concurrentRequestsThreshold?: number
/**
* One-of ('scalingRule'): at most one of 'concurrentRequestsThreshold',
* 'cpuUsageThreshold' could be set.
*/
cpuUsageThreshold?: number
}

export interface SecretHashedValue {
Expand Down Expand Up @@ -236,6 +241,8 @@ export interface Container {
*
* - Concurrent_requests_threshold: Scale depending on the number of concurrent
* requests being processed per container instance.
* - Cpu_usage_threshold: Scale depending on the CPU usage of a container
* instance.
*/
scalingOption?: ContainerScalingOption
/** Creation date of the container. */
Expand Down Expand Up @@ -433,6 +440,8 @@ export type CreateContainerRequest = {
*
* - Concurrent_requests_threshold: Scale depending on the number of concurrent
* requests being processed per container instance.
* - Cpu_usage_threshold: Scale depending on the CPU usage of a container
* instance.
*/
scalingOption?: ContainerScalingOption
}
Expand Down Expand Up @@ -894,6 +903,8 @@ export type UpdateContainerRequest = {
*
* - Concurrent_requests_threshold: Scale depending on the number of concurrent
* requests being processed per container instance.
* - Cpu_usage_threshold: Scale depending on the CPU usage of a container
* instance.
*/
scalingOption?: ContainerScalingOption
}
Expand Down