Skip to content

Commit b1711ae

Browse files
authored
feat(serverless): add sandbox for containers and functions (scaleway#3894)
1 parent f144a03 commit b1711ae

10 files changed

+43
-3
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ARGS:
2323
[secret-environment-variables.{index}.key]
2424
[secret-environment-variables.{index}.value]
2525
[http-option=enabled] Configure how HTTP and HTTPS requests are handled (unknown_http_option | enabled | redirected)
26+
[sandbox] Execution environment of the container (unknown_sandbox | v1 | v2)
2627
[deploy=true] Deploy container after creation
2728
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
2829

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

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ARGS:
2323
[secret-environment-variables.{index}.key]
2424
[secret-environment-variables.{index}.value]
2525
[http-option=enabled] Configure how HTTP and HTTPS requests are handled (unknown_http_option | enabled | redirected)
26+
[sandbox] Execution environment of the container (unknown_sandbox | v1 | v2)
2627
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
2728

2829
FLAGS:

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

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ARGS:
2020
[secret-environment-variables.{index}.key]
2121
[secret-environment-variables.{index}.value]
2222
[http-option=enabled] Configure how HTTP and HTTPS requests are handled (unknown_http_option | enabled | redirected)
23+
[sandbox] Execution environment of the function (unknown_sandbox | v1 | v2)
2324
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
2425

2526
FLAGS:

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

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ARGS:
2020
[secret-environment-variables.{index}.key]
2121
[secret-environment-variables.{index}.value]
2222
[http-option=enabled] Configure how HTTP and HTTPS requests are handled (unknown_http_option | enabled | redirected)
23+
[sandbox] Execution environment of the function (unknown_sandbox | v1 | v2)
2324
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
2425

2526
FLAGS:

docs/commands/container.md

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ scw container container create [arg=value ...]
7777
| secret-environment-variables.{index}.key | | |
7878
| secret-environment-variables.{index}.value | | |
7979
| http-option | Default: `enabled`<br />One of: `unknown_http_option`, `enabled`, `redirected` | Configure how HTTP and HTTPS requests are handled |
80+
| sandbox | One of: `unknown_sandbox`, `v1`, `v2` | Execution environment of the container |
8081
| deploy | Default: `true` | Deploy container after creation |
8182
| 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 |
8283

@@ -198,6 +199,7 @@ scw container container update <container-id ...> [arg=value ...]
198199
| secret-environment-variables.{index}.key | | |
199200
| secret-environment-variables.{index}.value | | |
200201
| http-option | Default: `enabled`<br />One of: `unknown_http_option`, `enabled`, `redirected` | Configure how HTTP and HTTPS requests are handled |
202+
| sandbox | One of: `unknown_sandbox`, `v1`, `v2` | Execution environment of the container |
201203
| 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 |
202204

203205

docs/commands/function.md

+2
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ scw function function create [arg=value ...]
303303
| secret-environment-variables.{index}.key | | |
304304
| secret-environment-variables.{index}.value | | |
305305
| http-option | Default: `enabled`<br />One of: `unknown_http_option`, `enabled`, `redirected` | Configure how HTTP and HTTPS requests are handled |
306+
| sandbox | One of: `unknown_sandbox`, `v1`, `v2` | Execution environment of the function |
306307
| 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 |
307308

308309

@@ -461,6 +462,7 @@ scw function function update <function-id ...> [arg=value ...]
461462
| secret-environment-variables.{index}.key | | |
462463
| secret-environment-variables.{index}.value | | |
463464
| http-option | Default: `enabled`<br />One of: `unknown_http_option`, `enabled`, `redirected` | Configure how HTTP and HTTPS requests are handled |
465+
| sandbox | One of: `unknown_sandbox`, `v1`, `v2` | Execution environment of the function |
464466
| 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 |
465467

466468

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/mattn/go-isatty v0.0.20
2626
github.com/moby/buildkit v0.13.2
2727
github.com/opencontainers/go-digest v1.0.0
28-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.28.0.20240619132217-1112036edc75
28+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.28.0.20240625131845-2fb884b9241b
2929
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
3030
github.com/spf13/cobra v1.8.1
3131
github.com/spf13/pflag v1.0.5

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
453453
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
454454
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
455455
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
456-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.28.0.20240619132217-1112036edc75 h1:b6LcngHAd4a42srJ5YSYAr8sMU4YqdA+vlHf+ONCKk8=
457-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.28.0.20240619132217-1112036edc75/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
456+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.28.0.20240625131845-2fb884b9241b h1:ksF8k2+T5vjDRZTBe1z7S+fHQom9aC9yrCCvSoqdjXA=
457+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.28.0.20240625131845-2fb884b9241b/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
458458
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
459459
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
460460
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=

internal/namespaces/container/v1beta1/container_cli.go

+16
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,14 @@ func containerContainerCreate() *core.Command {
583583
Default: core.DefaultValueSetter("enabled"),
584584
EnumValues: []string{"unknown_http_option", "enabled", "redirected"},
585585
},
586+
{
587+
Name: "sandbox",
588+
Short: `Execution environment of the container`,
589+
Required: false,
590+
Deprecated: false,
591+
Positional: false,
592+
EnumValues: []string{"unknown_sandbox", "v1", "v2"},
593+
},
586594
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
587595
},
588596
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
@@ -725,6 +733,14 @@ func containerContainerUpdate() *core.Command {
725733
Default: core.DefaultValueSetter("enabled"),
726734
EnumValues: []string{"unknown_http_option", "enabled", "redirected"},
727735
},
736+
{
737+
Name: "sandbox",
738+
Short: `Execution environment of the container`,
739+
Required: false,
740+
Deprecated: false,
741+
Positional: false,
742+
EnumValues: []string{"unknown_sandbox", "v1", "v2"},
743+
},
728744
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
729745
},
730746
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {

internal/namespaces/function/v1beta1/function_cli.go

+16
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,14 @@ func functionFunctionCreate() *core.Command {
610610
Default: core.DefaultValueSetter("enabled"),
611611
EnumValues: []string{"unknown_http_option", "enabled", "redirected"},
612612
},
613+
{
614+
Name: "sandbox",
615+
Short: `Execution environment of the function`,
616+
Required: false,
617+
Deprecated: false,
618+
Positional: false,
619+
EnumValues: []string{"unknown_sandbox", "v1", "v2"},
620+
},
613621
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
614622
},
615623
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
@@ -733,6 +741,14 @@ func functionFunctionUpdate() *core.Command {
733741
Default: core.DefaultValueSetter("enabled"),
734742
EnumValues: []string{"unknown_http_option", "enabled", "redirected"},
735743
},
744+
{
745+
Name: "sandbox",
746+
Short: `Execution environment of the function`,
747+
Required: false,
748+
Deprecated: false,
749+
Positional: false,
750+
EnumValues: []string{"unknown_sandbox", "v1", "v2"},
751+
},
736752
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
737753
},
738754
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {

0 commit comments

Comments
 (0)