Skip to content

Commit

Permalink
feat(serverless): add option to scale on CPU usage (#1541)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Nov 4, 2024
1 parent 966ed42 commit 5a1a365
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/clients/src/api/container/v1beta1/marshalling.gen.ts
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

0 comments on commit 5a1a365

Please sign in to comment.