Skip to content

Commit e8adef0

Browse files
authored
feat(serverless): add option to scale on CPU usage (#4239)
1 parent 5cb9272 commit e8adef0

File tree

7 files changed

+23
-4
lines changed

7 files changed

+23
-4
lines changed

cmd/scw/testdata/test-all-usage-container-container-create-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ARGS:
2525
[sandbox] Execution environment of the container (unknown_sandbox | v1 | v2)
2626
[local-storage-limit] Local storage limit of the container (in MB)
2727
[scaling-option.concurrent-requests-threshold]
28+
[scaling-option.cpu-usage-threshold]
2829
[deploy=true] Deploy container after creation
2930
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
3031

cmd/scw/testdata/test-all-usage-container-container-update-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ARGS:
2525
[sandbox] Execution environment of the container (unknown_sandbox | v1 | v2)
2626
[local-storage-limit] Local storage limit of the container (in MB)
2727
[scaling-option.concurrent-requests-threshold]
28+
[scaling-option.cpu-usage-threshold]
2829
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
2930

3031
DEPRECATED ARGS:

docs/commands/container.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ scw container container create [arg=value ...]
8080
| sandbox | One of: `unknown_sandbox`, `v1`, `v2` | Execution environment of the container |
8181
| local-storage-limit | | Local storage limit of the container (in MB) |
8282
| scaling-option.concurrent-requests-threshold | | |
83+
| scaling-option.cpu-usage-threshold | | |
8384
| deploy | Default: `true` | Deploy container after creation |
8485
| 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 |
8586

@@ -204,6 +205,7 @@ scw container container update <container-id ...> [arg=value ...]
204205
| sandbox | One of: `unknown_sandbox`, `v1`, `v2` | Execution environment of the container |
205206
| local-storage-limit | | Local storage limit of the container (in MB) |
206207
| scaling-option.concurrent-requests-threshold | | |
208+
| scaling-option.cpu-usage-threshold | | |
207209
| 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 |
208210

209211

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/mattn/go-isatty v0.0.20
2727
github.com/moby/buildkit v0.13.2
2828
github.com/opencontainers/go-digest v1.0.0
29-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241028153617-2a48843b5fcb
29+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6
3030
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
3131
github.com/spf13/cobra v1.8.1
3232
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
465465
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
466466
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
467467
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
468-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241028153617-2a48843b5fcb h1:OsRpbw60numCy/+3FS7UhZzkdiTu6OZwq29bb4b3gNo=
469-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241028153617-2a48843b5fcb/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
468+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6 h1:wTLtvVjR/V+Rz34qp0JDMTkkPUZPY0NkiywtdqwGcPs=
469+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
470470
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
471471
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
472472
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=

internal/namespaces/container/v1beta1/container_cli.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,12 @@ func containerContainerCreate() *core.Command {
618618
Deprecated: false,
619619
Positional: false,
620620
},
621+
{
622+
Name: "scaling-option.cpu-usage-threshold",
623+
Required: false,
624+
Deprecated: false,
625+
Positional: false,
626+
},
621627
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
622628
},
623629
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
@@ -780,6 +786,12 @@ func containerContainerUpdate() *core.Command {
780786
Deprecated: false,
781787
Positional: false,
782788
},
789+
{
790+
Name: "scaling-option.cpu-usage-threshold",
791+
Required: false,
792+
Deprecated: false,
793+
Positional: false,
794+
},
783795
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
784796
},
785797
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {

internal/namespaces/function/v1beta1/testdata/test-deploy-simple.golden

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@ Sandbox unknown_sandbox
4141
"region": "fr-par",
4242
"http_option": "enabled",
4343
"runtime_message": "",
44-
"sandbox": "unknown_sandbox"
44+
"sandbox": "unknown_sandbox",
45+
"created_at": null,
46+
"updated_at": null,
47+
"ready_at": null
4548
}

0 commit comments

Comments
 (0)