Skip to content

Commit

Permalink
Configure memory (kserve#743)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bitscuit committed Apr 1, 2020
1 parent 305dfcf commit 7c941e5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions config/default/manager_resources_patch.yaml
Original file line number Diff line number Diff line change
@@ -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

12 changes: 12 additions & 0 deletions docs/DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<cpu_limit> KFSERVING_CONTROLLER_MEMORY_LIMIT=<memory_limit>
```

or
```bash
export KFSERVING_CONTROLLER_CPU_LIMIT=<cpu_limit>
export KFSERVING_CONTROLLER_MEMORY_LIMIT=<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
Expand Down

0 comments on commit 7c941e5

Please sign in to comment.