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