From 7c941e51a62b59010bdc5fbb8fa5793b1c348129 Mon Sep 17 00:00:00 2001 From: Henry Li Date: Wed, 1 Apr 2020 12:29:28 -0400 Subject: [PATCH] Configure memory (#743) * added resources patch for controller-manager updated default kustomization to include patch modified Makefile to replace patch's resources * only need to configure limits, not requests * Makefile replaced resource values in wrong file * took out extra fields in patch * update developer guide doc with new deploy process * format doc to emphasize optional step * switched sed to perl * namespace variables with KFSERVING_CONTROLLER --- Makefile | 6 ++++++ config/default/kustomization.yaml | 1 + config/default/manager_resources_patch.yaml | 15 +++++++++++++++ docs/DEVELOPER_GUIDE.md | 12 ++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 config/default/manager_resources_patch.yaml diff --git a/Makefile b/Makefile index 7928d784a4..186c8eaa25 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,12 @@ STORAGE_INIT_IMG ?= storage-initializer:latest CRD_OPTIONS ?= "crd:trivialVersions=true" KFSERVING_ENABLE_SELF_SIGNED_CA ?= false +# CPU/Memory limits for controller-manager +KFSERVING_CONTROLLER_CPU_LIMIT ?= 100m +KFSERVING_CONTROLLER_MEMORY_LIMIT ?= 300Mi +$(shell perl -pi -e 's/cpu:.*/cpu: $(KFSERVING_CONTROLLER_CPU_LIMIT)/' config/default/manager_resources_patch.yaml) +$(shell perl -pi -e 's/memory:.*/memory: $(KFSERVING_CONTROLLER_MEMORY_LIMIT)/' config/default/manager_resources_patch.yaml) + all: test manager logger # Run tests diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 94029cca7c..b0b2c33efa 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -42,3 +42,4 @@ patchesStrategicMerge: # manager_prometheus_metrics_patch.yaml should be enabled. #- manager_prometheus_metrics_patch.yaml - webhookcainjection_patch.yaml +- manager_resources_patch.yaml diff --git a/config/default/manager_resources_patch.yaml b/config/default/manager_resources_patch.yaml new file mode 100644 index 0000000000..5a918afc43 --- /dev/null +++ b/config/default/manager_resources_patch.yaml @@ -0,0 +1,15 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: kfserving-controller-manager + namespace: kfserving-system +spec: + template: + spec: + containers: + - name: manager + resources: + limits: + cpu: 100m + memory: 300Mi + \ No newline at end of file diff --git a/docs/DEVELOPER_GUIDE.md b/docs/DEVELOPER_GUIDE.md index 21a96f40af..d3368813d1 100644 --- a/docs/DEVELOPER_GUIDE.md +++ b/docs/DEVELOPER_GUIDE.md @@ -150,6 +150,18 @@ After that you can run following command to deploy `KFServing`, you can skip abo make deploy ``` +**Optional**: you can set CPU and memory limits when deploying `KFServing`. +```bash +make deploy KFSERVING_CONTROLLER_CPU_LIMIT= KFSERVING_CONTROLLER_MEMORY_LIMIT= +``` + +or +```bash +export KFSERVING_CONTROLLER_CPU_LIMIT= +export KFSERVING_CONTROLLER_MEMORY_LIMIT= +make deploy +``` + After above step you can see things running with: ```console $ kubectl get pods -n kfserving-system -l control-plane=kfserving-controller-manager