From 174b78d2a96cfcacd5cffc5331d0f638cf66775c Mon Sep 17 00:00:00 2001 From: Vatsal Parekh Date: Mon, 24 May 2021 13:16:27 +0530 Subject: [PATCH] Add Resource requests to pods Signed-off-by: Vatsal Parekh --- config/manager/manager.template.yaml | 4 ++++ internal/operands/template-validator/resources.go | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/config/manager/manager.template.yaml b/config/manager/manager.template.yaml index 4e6e269d2..48a70846f 100644 --- a/config/manager/manager.template.yaml +++ b/config/manager/manager.template.yaml @@ -43,3 +43,7 @@ spec: port: 9440 initialDelaySeconds: 5 terminationGracePeriodSeconds: 10 + resources: + requests: + memory: "150Mi" + cpu: "100m" diff --git a/internal/operands/template-validator/resources.go b/internal/operands/template-validator/resources.go index c29f37496..b3fc7259a 100644 --- a/internal/operands/template-validator/resources.go +++ b/internal/operands/template-validator/resources.go @@ -2,6 +2,7 @@ package template_validator import ( "fmt" + "k8s.io/apimachinery/pkg/api/resource" admission "k8s.io/api/admissionregistration/v1" apps "k8s.io/api/apps/v1" @@ -137,6 +138,12 @@ func newDeployment(namespace string, replicas int32, image string) *apps.Deploym Name: "webhook", Image: image, ImagePullPolicy: core.PullAlways, + Resources: core.ResourceRequirements{ + Requests: core.ResourceList{ + core.ResourceCPU: resource.MustParse("50m"), + core.ResourceMemory: resource.MustParse("150Mi"), + }, + }, Args: []string{ "-v=2", fmt.Sprintf("--port=%d", ContainerPort),