From 8dbe40f37e23911abc873b362cabb27799006a12 Mon Sep 17 00:00:00 2001 From: Rajdeep Das Date: Fri, 29 Dec 2023 16:22:32 +0530 Subject: [PATCH] Add default resource requirements for init-containers --- ...db.com_v1_mongodbcommunity_specify_pod_resources.yaml | 9 +++++++++ controllers/construct/mongodbstatefulset.go | 2 ++ 2 files changed, 11 insertions(+) diff --git a/config/samples/mongodb.com_v1_mongodbcommunity_specify_pod_resources.yaml b/config/samples/mongodb.com_v1_mongodbcommunity_specify_pod_resources.yaml index 78722d3c3..84f8e66af 100644 --- a/config/samples/mongodb.com_v1_mongodbcommunity_specify_pod_resources.yaml +++ b/config/samples/mongodb.com_v1_mongodbcommunity_specify_pod_resources.yaml @@ -44,6 +44,15 @@ spec: requests: cpu: "0.2" memory: 200M + initContainers: + - name: mongodb-agent-readinessprobe + resources: + limits: + cpu: "2" + memory: 200M + requests: + cpu: "1" + memory: 100M # the user credentials will be generated from this secret # once the credentials are generated, this secret is no longer required --- diff --git a/controllers/construct/mongodbstatefulset.go b/controllers/construct/mongodbstatefulset.go index 876d61505..ed0e9dd8a 100644 --- a/controllers/construct/mongodbstatefulset.go +++ b/controllers/construct/mongodbstatefulset.go @@ -284,6 +284,7 @@ func versionUpgradeHookInit(volumeMount []corev1.VolumeMount) container.Modifica container.WithName(versionUpgradeHookName), container.WithCommand([]string{"cp", "version-upgrade-hook", "/hooks/version-upgrade"}), container.WithImage(os.Getenv(VersionUpgradeHookImageEnv)), + container.WithResourceRequirements(resourcerequirements.Defaults()), container.WithImagePullPolicy(corev1.PullAlways), container.WithVolumeMounts(volumeMount), containerSecurityContext, @@ -324,6 +325,7 @@ func readinessProbeInit(volumeMount []corev1.VolumeMount) container.Modification container.WithImage(os.Getenv(ReadinessProbeImageEnv)), container.WithImagePullPolicy(corev1.PullAlways), container.WithVolumeMounts(volumeMount), + container.WithResourceRequirements(resourcerequirements.Defaults()), containerSecurityContext, ) }