Skip to content

Commit 8ba34b7

Browse files
authored
23 configuration options for autoscaling (#27)
* feat(sdk): update sdk scaleway (#26) Signed-off-by: Alexandre Philibeaux <[email protected]> * feat(container): add options for autoscaling Signed-off-by: Alexandre Philibeaux <[email protected]> --------- Signed-off-by: Alexandre Philibeaux <[email protected]>
1 parent b51a5e6 commit 8ba34b7

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

README.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,18 @@ You can can setup this namespace with our cli `scw containers namespace create`
4343

4444
### simple deploy
4545

46-
| input name | value |
47-
| ------------------ | -------------------------------------- |
48-
| type | deploy (default value ) |
49-
| scw_registry | rg.fr-par.scw.cloud/test/images:latest |
50-
| scw_region | fr-par (default value) |
51-
| scw_container_port | 80 (default value ) |
52-
| scw_memory_limit | 256 (default value ) |
46+
| input name | value |
47+
| -------------------- | -------------------------------------- |
48+
| type | deploy (default value ) |
49+
| scw_registry | rg.fr-par.scw.cloud/test/images:latest |
50+
| scw_region | fr-par (default value) |
51+
| scw_container_port | 80 (default value ) |
52+
| scw_memory_limit | 256 (default value ) |
53+
| scw_cpu_limit | 256 (default value ) |
54+
| scw_min_scale | 1 (default value ) |
55+
| scw_max_scale | 5 (default value ) |
56+
| scw_max_concurrency | 5 (default value ) |
57+
| scw_cpu_limit | 70 (default value ) |
5358

5459
```bash
5560
on: [push]

action.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ inputs:
3737
description: "Max Scale of the Container"
3838
required: false
3939
default: "5"
40+
scw_cpu_limit:
41+
description: "CPU Limit of the Container"
42+
required: false
43+
default: "70"
44+
scw_max_concurrency:
45+
description: "Max Concurrency of the Container"
46+
required: false
47+
default: "5"
4048
scw_dns:
4149
description: "DNS name where your container will be available. Limitation: 63 char maximun"
4250
required: false
@@ -84,6 +92,8 @@ runs:
8492
- ${{ inputs.scw_memory_limit }}
8593
- ${{ inputs.scw_min_scale }}
8694
- ${{ inputs.scw_max_scale }}
95+
- ${{ inputs.scw_cpu_limit }}
96+
- ${{ inputs.scw_max_concurrency }}
8797
- ${{ inputs.scw_dns }}
8898
- ${{ inputs.scw_dns_prefix }}
8999
- ${{ inputs.root_zone }}

container.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,24 @@ func CreateContainerAndDeploy(
197197
port, _ := strconv.ParseInt(envOr(EnvContainerPort, fmt.Sprint(Port)), 10, 32)
198198
memoryLimit, _ := strconv.ParseInt(envOr(EnvMemoryLimit, fmt.Sprint(MemoryLimit)), 10, 32)
199199
minScale, _ := strconv.ParseInt(envOr(EnvMinScale, fmt.Sprint(MinScale)), 10, 32)
200-
maxScale, _ := strconv.ParseInt(envOr(EnvMinScale, fmt.Sprint(MinScale)), 10, 32)
200+
maxScale, _ := strconv.ParseInt(envOr(EnvMaxScale, fmt.Sprint(MaxScale)), 10, 32)
201+
maxConcurrency, _ := strconv.ParseInt(envOr(EnvMaxConcurrency, fmt.Sprint(MaxConcurrency)), 10, 32)
202+
cpuLimit, _ := strconv.ParseInt(envOr(EnvMaxConcurrency, fmt.Sprint(MaxConcurrency)), 10, 32)
201203

202204
Port := uint32(port)
203205
MemoryLimit := uint32(memoryLimit)
204206
MinScale := uint32(minScale)
205207
MaxScale := uint32(maxScale)
208+
MaxConcurrency := uint32(maxConcurrency)
209+
CPULimit := uint32(cpuLimit)
206210

207211
createdContainer, err := api.CreateContainer(&container.CreateContainerRequest{
208212
Description: &Description,
209213
MaxConcurrency: &MaxConcurrency,
210214
MemoryLimit: &MemoryLimit,
211215
MinScale: &MinScale,
212216
MaxScale: &MaxScale,
217+
CPULimit: &CPULimit,
213218
Name: ContainerName,
214219
NamespaceID: NamespaceContainer.ID,
215220
Port: &Port,

main.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ const (
1515
EnvContainerNamespaceID = "INPUT_SCW_CONTAINERS_NAMESPACE_ID"
1616
EnvContainerPort = "INPUT_SCW_CONTAINER_PORT"
1717
EnvDNS = "INPUT_SCW_DNS"
18-
EnvDNSPrefix = "INPUT_SCW_DNS_PREFIX"
18+
EnvDNSPrefix = "INPUT_SCW_DNS_PREFIX"
1919
EnvRegion = "INPUT_SCW_REGION"
2020
EnvPathRegistry = "INPUT_SCW_REGISTRY"
2121
EnvProjectID = "INPUT_SCW_PROJECT_ID"
2222
EnvSecretKey = "INPUT_SCW_SECRET_KEY"
2323
EnvMemoryLimit = "INPUT_SCW_MEMORY_LIMIT"
2424
EnvMinScale = "INPUT_SCW_MIN_SCALE"
2525
EnvMaxScale = "INPUT_SCW_MAX_SCALE"
26+
EnvMaxConcurrency = "INPUT_SCW_MAX_CONCURRENCY"
27+
EnvCPULimit = "INPUT_SCW_CPU_LIMIT"
2628
EnvRootZone = "INPUT_ROOT_ZONE"
2729
EnvEnvironmentVariables = "INPUT_SCW_ENVIRONMENT_VARIABLES"
2830
EnvSecrets = "INPUT_SCW_SECRETS"
@@ -35,6 +37,7 @@ var (
3537
MaxScale uint32 = 5
3638
MaxConcurrency uint32 = 5
3739
MemoryLimit uint32 = 256
40+
CPULimit uint32 = 70
3841
Timeout scw.Duration = scw.Duration{
3942
Seconds: 60,
4043
Nanos: 0,

0 commit comments

Comments
 (0)