Skip to content

Commit

Permalink
Avoid providing memory limit if not set explicitly
Browse files Browse the repository at this point in the history
Signed-off-by: Nitishkumar Singh <[email protected]>
  • Loading branch information
nitishkumar71 authored and alexellis committed Jan 25, 2022
1 parent 3579061 commit 8ac45f5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/provider/handlers/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func MakeReadHandler(client *containerd.Client) func(w http.ResponseWriter, r *h
annotations := &fn.annotations
labels := &fn.labels
memory := resource.NewQuantity(fn.memoryLimit, resource.BinarySI)
res = append(res, types.FunctionStatus{
status := types.FunctionStatus{
Name: fn.name,
Image: fn.image,
Replicas: uint64(fn.replicas),
Expand All @@ -50,9 +50,17 @@ func MakeReadHandler(client *containerd.Client) func(w http.ResponseWriter, r *h
Secrets: fn.secrets,
EnvVars: fn.envVars,
EnvProcess: fn.envProcess,
Limits: &types.FunctionResources{Memory: memory.String()},
CreatedAt: fn.createdAt,
})
}

// Do not remove below memory check for 0
// Memory limit should not be included in status until set explicitly
limit := &types.FunctionResources{Memory: memory.String()}
if limit.Memory != "0" {
status.Limits = limit
}

res = append(res, status)
}

body, _ := json.Marshal(res)
Expand Down

0 comments on commit 8ac45f5

Please sign in to comment.