Skip to content

Commit 7fd5d35

Browse files
weltekialexellis
authored andcommitted
Add note on using profiles to set default CPU/RAM
Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
1 parent 6dc052a commit 7fd5d35

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

docs/reference/profiles.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ Profiles in Kubernetes work by injecting the supplied configuration directly int
7171

7272
The configuration use the exact options that you find in the Kubernetes documentation.
7373

74+
!!! note "Configuration priority"
75+
Resources set in the function spec take precedence over resources set through Profiles.
76+
7477
### Examples
7578

7679
#### Use an Alternative RuntimeClass
@@ -428,4 +431,34 @@ spec:
428431
resources:
429432
limits:
430433
nvidia.com/gpu: 1 # requesting 1 GPU
431-
```
434+
```
435+
436+
#### Set default RAM/CPU for all functions
437+
438+
You might want to set default memory and CPU resources for all your functions. This can be done by creating a Profile and applying it to all your functions by default.
439+
440+
Example of a profile that sets Memory/CPU limits and requests:
441+
442+
```yaml
443+
kind: Profile
444+
apiVersion: openfaas.com/v1
445+
metadata:
446+
name: default-resources
447+
namespace: openfaas
448+
spec:
449+
resources:
450+
requests:
451+
memory: "64Mi"
452+
cpu: "250m"
453+
limits:
454+
memory: "128Mi"
455+
cpu: "500m"
456+
```
457+
458+
Add the profiles annotation to all functions to apply this profile.
459+
460+
```yaml
461+
com.openfaas.profile: default-resources
462+
```
463+
464+
It is still possible to override the default settings on a per function basis by setting different values in the function `stack.yaml`: see [Memory/CPU limits](/reference/yaml/#function-memorycpu-limits). Resources set in the function spec take precedence over resources set through Profiles.

0 commit comments

Comments
 (0)