Skip to content

Commit

Permalink
feat(serverless): add option to scale on CPU usage (#4239)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Oct 31, 2024
1 parent 5cb9272 commit e8adef0
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ARGS:
[sandbox] Execution environment of the container (unknown_sandbox | v1 | v2)
[local-storage-limit] Local storage limit of the container (in MB)
[scaling-option.concurrent-requests-threshold]
[scaling-option.cpu-usage-threshold]
[deploy=true] Deploy container after creation
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ARGS:
[sandbox] Execution environment of the container (unknown_sandbox | v1 | v2)
[local-storage-limit] Local storage limit of the container (in MB)
[scaling-option.concurrent-requests-threshold]
[scaling-option.cpu-usage-threshold]
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

DEPRECATED ARGS:
Expand Down
2 changes: 2 additions & 0 deletions docs/commands/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ scw container container create [arg=value ...]
| sandbox | One of: `unknown_sandbox`, `v1`, `v2` | Execution environment of the container |
| local-storage-limit | | Local storage limit of the container (in MB) |
| scaling-option.concurrent-requests-threshold | | |
| scaling-option.cpu-usage-threshold | | |
| deploy | Default: `true` | Deploy container after creation |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |

Expand Down Expand Up @@ -204,6 +205,7 @@ scw container container update <container-id ...> [arg=value ...]
| sandbox | One of: `unknown_sandbox`, `v1`, `v2` | Execution environment of the container |
| local-storage-limit | | Local storage limit of the container (in MB) |
| scaling-option.concurrent-requests-threshold | | |
| scaling-option.cpu-usage-threshold | | |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |


Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/mattn/go-isatty v0.0.20
github.com/moby/buildkit v0.13.2
github.com/opencontainers/go-digest v1.0.0
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241028153617-2a48843b5fcb
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241028153617-2a48843b5fcb h1:OsRpbw60numCy/+3FS7UhZzkdiTu6OZwq29bb4b3gNo=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241028153617-2a48843b5fcb/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6 h1:wTLtvVjR/V+Rz34qp0JDMTkkPUZPY0NkiywtdqwGcPs=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=
Expand Down
12 changes: 12 additions & 0 deletions internal/namespaces/container/v1beta1/container_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,12 @@ func containerContainerCreate() *core.Command {
Deprecated: false,
Positional: false,
},
{
Name: "scaling-option.cpu-usage-threshold",
Required: false,
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
Expand Down Expand Up @@ -780,6 +786,12 @@ func containerContainerUpdate() *core.Command {
Deprecated: false,
Positional: false,
},
{
Name: "scaling-option.cpu-usage-threshold",
Required: false,
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ Sandbox unknown_sandbox
"region": "fr-par",
"http_option": "enabled",
"runtime_message": "",
"sandbox": "unknown_sandbox"
"sandbox": "unknown_sandbox",
"created_at": null,
"updated_at": null,
"ready_at": null
}

0 comments on commit e8adef0

Please sign in to comment.