Skip to content

Commit e55927e

Browse files
feat: add per-function vcpu parameter (#645)
1 parent 1764a43 commit e55927e

4 files changed

Lines changed: 16 additions & 3 deletions

File tree

go/models/function_config.go

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/porcelain/deploy.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
840840
}
841841
}
842842

843-
hasConfig := function.DisplayName != "" || function.Generator != "" || len(routes) > 0 || len(excludedRoutes) > 0 || len(function.BuildData) > 0 || function.Priority != 0 || function.TrafficRules != nil || function.Timeout != 0 || len(function.EventSubscriptions) > 0 || function.Region != "" || function.Memory != 0
843+
hasConfig := function.DisplayName != "" || function.Generator != "" || len(routes) > 0 || len(excludedRoutes) > 0 || len(function.BuildData) > 0 || function.Priority != 0 || function.TrafficRules != nil || function.Timeout != 0 || len(function.EventSubscriptions) > 0 || function.Region != "" || function.Memory != 0 || function.Vcpu != 0
844844
if hasConfig {
845845
cfg := models.FunctionConfig{
846846
DisplayName: function.DisplayName,
@@ -852,6 +852,7 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
852852
BuildData: function.BuildData,
853853
Priority: int64(function.Priority),
854854
EventSubscriptions: function.EventSubscriptions,
855+
Vcpu: function.Vcpu,
855856
}
856857

857858
if function.TrafficRules != nil {

go/porcelain/functions_manifest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type functionsManifestEntry struct {
2727
ExcludedRoutes []excludedFunctionRoute `json:"excludedRoutes"`
2828
Priority int `json:"priority"`
2929
TrafficRules *functionTrafficRules `json:"trafficRules"`
30+
Vcpu float32 `json:"vcpu"`
3031
}
3132

3233
type functionRoute struct {

swagger.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5558,7 +5558,7 @@ definitions:
55585558
memory:
55595559
type: integer
55605560
description: |
5561-
The function's memory allocation in MB.
5561+
The function's memory allocation in MB. Mutually exclusive with `vcpu`.
55625562
routes:
55635563
type: array
55645564
items:
@@ -5573,6 +5573,12 @@ definitions:
55735573
type: string
55745574
traffic_rules:
55755575
$ref: '#/definitions/trafficRulesConfig'
5576+
vcpu:
5577+
type: number
5578+
format: float
5579+
description: |
5580+
Number of vCPUs to provision for the function. Allowed range is
5581+
0.5–2.
55765582
event_subscriptions:
55775583
type: array
55785584
items:

0 commit comments

Comments
 (0)