Skip to content

Commit 2c7fcae

Browse files
author
Moritz Clasmeier
committed
Add new tiny resource profile
1 parent 867a8fb commit 2c7fcae

3 files changed

Lines changed: 115 additions & 0 deletions

File tree

internal/deployer/constants.go

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,20 @@ var (
66
centralCrName = "stackrox-central-services"
77
securedClusterCrName = "stackrox-secured-cluster-services"
88

9+
centralDbPVCSizeTiny = "10Gi"
910
centralDbPVCSizeSmall = "30Gi"
1011

12+
centralResourcesTiny = map[string]interface{}{
13+
"requests": map[string]string{
14+
"memory": "300Mi",
15+
"cpu": "200m",
16+
},
17+
"limits": map[string]string{
18+
"memory": "2Gi",
19+
"cpu": "1",
20+
},
21+
}
22+
1123
centralResourcesSmall = map[string]interface{}{
1224
"requests": map[string]string{
1325
"memory": "1Gi",
@@ -19,6 +31,17 @@ var (
1931
},
2032
}
2133

34+
centralDbResourcesTiny = map[string]interface{}{
35+
"requests": map[string]string{
36+
"memory": "400Mi",
37+
"cpu": "200m",
38+
},
39+
"limits": map[string]string{
40+
"memory": "2Gi",
41+
"cpu": "1",
42+
},
43+
}
44+
2245
centralDbResourcesSmall = map[string]interface{}{
2346
"requests": map[string]string{
2447
"memory": "1Gi",
@@ -52,6 +75,17 @@ var (
5275
},
5376
}
5477

78+
centralScannerV4DbResourcesTiny = map[string]interface{}{
79+
"requests": map[string]string{
80+
"memory": "400Mi",
81+
"cpu": "300m",
82+
},
83+
"limits": map[string]string{
84+
"memory": "2000Mi",
85+
"cpu": "1000m",
86+
},
87+
}
88+
5589
centralScannerV4DbResourcesSmall = map[string]interface{}{
5690
"requests": map[string]string{
5791
"memory": "512Mi",
@@ -63,6 +97,17 @@ var (
6397
},
6498
}
6599

100+
centralScannerV4IndexerResourcesTiny = map[string]interface{}{
101+
"requests": map[string]string{
102+
"memory": "300Mi",
103+
"cpu": "200m",
104+
},
105+
"limits": map[string]string{
106+
"memory": "2Gi",
107+
"cpu": "2000m",
108+
},
109+
}
110+
66111
centralScannerV4IndexerResourcesSmall = map[string]interface{}{
67112
"requests": map[string]string{
68113
"memory": "512Mi",
@@ -74,6 +119,17 @@ var (
74119
},
75120
}
76121

122+
centralScannerV4MatcherResourcesTiny = map[string]interface{}{
123+
"requests": map[string]string{
124+
"memory": "300Mi",
125+
"cpu": "200m",
126+
},
127+
"limits": map[string]string{
128+
"memory": "2Gi",
129+
"cpu": "1000m",
130+
},
131+
}
132+
77133
centralScannerV4MatcherResourcesSmall = map[string]interface{}{
78134
"requests": map[string]string{
79135
"memory": "512Mi",
@@ -87,6 +143,17 @@ var (
87143

88144
// Secured Cluster
89145

146+
securedClusterSensorResourcesTiny = map[string]interface{}{
147+
"requests": map[string]string{
148+
"memory": "300Mi",
149+
"cpu": "200m",
150+
},
151+
"limits": map[string]string{
152+
"memory": "2Gi",
153+
"cpu": "1000m",
154+
},
155+
}
156+
90157
securedClusterSensorResourcesSmall = map[string]interface{}{
91158
"requests": map[string]string{
92159
"memory": "500Mi",

internal/deployer/deploy_via_operator.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,38 @@ func (d *Deployer) createAdminPasswordSecret(ctx context.Context) error {
259259

260260
func getCentralResourcesOperator(resourcesProfile types.ResourceProfile) map[string]interface{} {
261261
switch resourcesProfile {
262+
case types.ResourceProfileTiny:
263+
return map[string]interface{}{
264+
"spec": map[string]interface{}{
265+
"central": map[string]interface{}{
266+
"resources": centralResourcesTiny,
267+
"db": map[string]interface{}{
268+
"resources": centralDbResourcesTiny,
269+
"persistence": map[string]interface{}{
270+
"persistentVolumeClaim": map[string]interface{}{
271+
"size": centralDbPVCSizeTiny,
272+
},
273+
},
274+
},
275+
},
276+
"scanner": map[string]interface{}{
277+
"scannerComponent": "Disabled",
278+
},
279+
"scannerV4": map[string]interface{}{
280+
"db": map[string]interface{}{
281+
"resources": centralScannerV4DbResourcesTiny,
282+
},
283+
"indexer": map[string]interface{}{
284+
"resources": centralScannerV4IndexerResourcesTiny,
285+
"scaling": noScaling,
286+
},
287+
"matcher": map[string]interface{}{
288+
"resources": centralScannerV4MatcherResourcesTiny,
289+
"scaling": noScaling,
290+
},
291+
},
292+
},
293+
}
262294
case types.ResourceProfileSmall:
263295
return map[string]interface{}{
264296
"spec": map[string]interface{}{
@@ -705,6 +737,20 @@ func (d *Deployer) deploySecuredClusterOperator(ctx context.Context) error {
705737

706738
func getSecuredClusterResourcesOperator(resourceProfile types.ResourceProfile) map[string]interface{} {
707739
switch resourceProfile {
740+
case types.ResourceProfileTiny:
741+
return map[string]interface{}{
742+
"spec": map[string]interface{}{
743+
"sensor": map[string]interface{}{
744+
"resources": securedClusterSensorResourcesTiny,
745+
},
746+
"scanner": map[string]interface{}{
747+
"scannerComponent": "Disabled",
748+
},
749+
"scannerV4": map[string]interface{}{
750+
"scannerComponent": "Disabled",
751+
},
752+
},
753+
}
708754
case types.ResourceProfileSmall:
709755
return map[string]interface{}{
710756
"spec": map[string]interface{}{

internal/types/resources.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type ResourceProfile int
1111
const (
1212
ResourceProfileAcsDefaults ResourceProfile = iota
1313
ResourceProfileAuto
14+
ResourceProfileTiny
1415
ResourceProfileSmall
1516
ResourceProfileMedium
1617
ResourceProfileCI
@@ -20,6 +21,7 @@ var (
2021
resourceProfileNames = map[ResourceProfile]string{
2122
ResourceProfileAcsDefaults: "acs-defaults",
2223
ResourceProfileAuto: "auto",
24+
ResourceProfileTiny: "tiny",
2325
ResourceProfileSmall: "small",
2426
ResourceProfileMedium: "medium",
2527
ResourceProfileCI: "ci",

0 commit comments

Comments
 (0)