-
Notifications
You must be signed in to change notification settings - Fork 14
/
resources_requirements.go
57 lines (48 loc) · 1.8 KB
/
resources_requirements.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) Mondoo, Inc.
// SPDX-License-Identifier: BUSL-1.1
package k8s
import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
)
// DefaultCnspecResources for cnspec container
var DefaultCnspecResources corev1.ResourceRequirements = corev1.ResourceRequirements{
Limits: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("400M"),
corev1.ResourceCPU: resource.MustParse("600m"),
},
Requests: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("150M"),
corev1.ResourceCPU: resource.MustParse("300m"),
},
}
// DefaultContainerScanningResources for cnspec container
var DefaultContainerScanningResources corev1.ResourceRequirements = corev1.ResourceRequirements{
Limits: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("500M"),
corev1.ResourceCPU: resource.MustParse("1"),
},
Requests: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("150M"),
corev1.ResourceCPU: resource.MustParse("400m"),
},
}
// DefaultNodeScanningResources for cnspec container when scanning nodes
var DefaultNodeScanningResources corev1.ResourceRequirements = corev1.ResourceRequirements{
Limits: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("160M"),
corev1.ResourceCPU: resource.MustParse("200m"),
},
Requests: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("100M"),
corev1.ResourceCPU: resource.MustParse("50m"),
},
}
// ResourcesRequirementsWithDefaults will return the resource requirements from the parameter if such
// are specified. If not requirements are specified, default values will be returned.
func ResourcesRequirementsWithDefaults(m corev1.ResourceRequirements, defaults corev1.ResourceRequirements) corev1.ResourceRequirements {
if m.Size() != 0 {
return m
}
return defaults
}