Skip to content

Commit 9ce420c

Browse files
Increase memory limit for ROSA/HCP env
In ROSA/HCP env, the gatekeeper-audit pod failed with OOMKilled. This PR increases the memory limit to 1Gi to fix this issue. Ref: https://issues.redhat.com/browse/ACM-9757 Signed-off-by: Yi Rae Kim <[email protected]>
1 parent 57b98a1 commit 9ce420c

File tree

5 files changed

+28
-20
lines changed

5 files changed

+28
-20
lines changed

config/gatekeeper/kustomization.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ resources:
2929
- apiextensions.k8s.io_v1_customresourcedefinition_assignimage.mutations.gatekeeper.sh.yaml
3030
# Remove --disable-cert-rotation
3131
# Set a CPU limit
32+
# Increase default Memory limit
3233
patches:
33-
- patch: |-
34-
- op: remove
35-
path: /spec/template/spec/containers/0/args/5
36-
target:
37-
kind: Deployment
38-
name: gatekeeper-audit
3934
- patch: |-
4035
- op: replace
4136
path: /spec/template/spec/containers/0/resources/limits/cpu
4237
value: 1000m
38+
- op: replace
39+
path: /spec/template/spec/containers/0/resources/limits/memory
40+
value: 1Gi
41+
- op: remove
42+
path: /spec/template/spec/containers/0/args/5
4343
target:
4444
kind: Deployment
4545
name: gatekeeper-audit

controllers/gatekeeper_controller_test.go

+6-9
Original file line numberDiff line numberDiff line change
@@ -557,18 +557,18 @@ func TestResources(t *testing.T) {
557557
// test default resources
558558
auditObj, err := util.GetManifestObject(AuditFile)
559559
g.Expect(err).ToNot(HaveOccurred())
560-
assertResources(g, auditObj, nil)
560+
assertResources(g, auditObj, test.DefaultDeployment.AuditResources)
561561
webhookObj, err := util.GetManifestObject(WebhookFile)
562562
g.Expect(err).ToNot(HaveOccurred())
563-
assertResources(g, webhookObj, nil)
563+
assertResources(g, webhookObj, test.DefaultDeployment.WebResources)
564564

565565
// test nil resources
566566
err = crOverrides(gatekeeper, AuditFile, auditObj, namespace, false, false)
567567
g.Expect(err).ToNot(HaveOccurred())
568-
assertResources(g, auditObj, nil)
568+
assertResources(g, auditObj, test.DefaultDeployment.AuditResources)
569569
err = crOverrides(gatekeeper, WebhookFile, webhookObj, namespace, false, false)
570570
g.Expect(err).ToNot(HaveOccurred())
571-
assertResources(g, webhookObj, nil)
571+
assertResources(g, webhookObj, test.DefaultDeployment.WebResources)
572572

573573
// test resources override
574574
gatekeeper.Spec.Audit = audit
@@ -592,11 +592,8 @@ func assertResources(g *WithT, obj *unstructured.Unstructured, expected *corev1.
592592
current, found, err := unstructured.NestedMap(util.ToMap(c), "resources")
593593
g.Expect(err).ToNot(HaveOccurred())
594594
g.Expect(found).To(BeTrue())
595-
if expected == nil {
596-
assertResource(g, test.DefaultDeployment.Resources, current)
597-
} else {
598-
assertResource(g, expected, current)
599-
}
595+
596+
assertResource(g, expected, current)
600597
}
601598
}
602599

pkg/bindata/bindata.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/gatekeeper_controller_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ var _ = Describe("Gatekeeper", func() {
199199
})
200200

201201
By("Checking default resource limits and requests", func() {
202-
assertResources(*test.DefaultDeployment.Resources, auditDeployment.Spec.Template.Spec.Containers[0].Resources)
203-
assertResources(*test.DefaultDeployment.Resources, webhookDeployment.Spec.Template.Spec.Containers[0].Resources)
202+
assertResources(*test.DefaultDeployment.AuditResources, auditDeployment.Spec.Template.Spec.Containers[0].Resources)
203+
assertResources(*test.DefaultDeployment.WebResources, webhookDeployment.Spec.Template.Spec.Containers[0].Resources)
204204
})
205205

206206
By("Checking default image", func() {

test/e2e/util/util.go

+13-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ type defaultConfig struct {
3939
Affinity *corev1.Affinity
4040
NodeSelector map[string]string
4141
PodAnnotations map[string]string
42-
Resources *corev1.ResourceRequirements
42+
WebResources *corev1.ResourceRequirements
43+
AuditResources *corev1.ResourceRequirements
4344
FailurePolicy admregv1.FailurePolicyType
4445
NamespaceSelector *metav1.LabelSelector
4546
}
@@ -74,7 +75,17 @@ var DefaultDeployment = defaultConfig{
7475
NodeSelector: map[string]string{
7576
"kubernetes.io/os": "linux",
7677
},
77-
Resources: &corev1.ResourceRequirements{
78+
AuditResources: &corev1.ResourceRequirements{
79+
Limits: corev1.ResourceList{
80+
corev1.ResourceCPU: resource.MustParse("1000m"),
81+
corev1.ResourceMemory: resource.MustParse("1Gi"),
82+
},
83+
Requests: corev1.ResourceList{
84+
corev1.ResourceCPU: resource.MustParse("100m"),
85+
corev1.ResourceMemory: resource.MustParse("512Mi"),
86+
},
87+
},
88+
WebResources: &corev1.ResourceRequirements{
7889
Limits: corev1.ResourceList{
7990
corev1.ResourceCPU: resource.MustParse("1000m"),
8091
corev1.ResourceMemory: resource.MustParse("512Mi"),

0 commit comments

Comments
 (0)