From c06d434d949cc6f171775df662203ead0b086b0a Mon Sep 17 00:00:00 2001 From: Siddharth Rawat Date: Fri, 1 Dec 2023 16:21:20 -0500 Subject: [PATCH 1/2] feat: add resource limits to consumer, kafka brokers and namespace --- templates/consumer_limitrange.yaml | 14 ++++++++++++++ templates/deployment.yaml | 7 +++++++ values.yaml | 22 ++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 templates/consumer_limitrange.yaml diff --git a/templates/consumer_limitrange.yaml b/templates/consumer_limitrange.yaml new file mode 100644 index 0000000..d108f4e --- /dev/null +++ b/templates/consumer_limitrange.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: LimitRange +metadata: + name: {{ .Release.Name }}-limit-range + namespace: {{ .Values.namespace }} +spec: + limits: + - default: + memory: {{.Values.resources.limits.memory}} + cpu: {{.Values.resources.limits.cpu}} + defaultRequest: + memory: {{.Values.resources.requests.memory}} + cpu: {{.Values.resources.requests.cpu}} + type: Container diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 43ecf7b..59962e4 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -48,6 +48,13 @@ spec: - name: {{ .Chart.Name }}-consumer image: "{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + resources: + requests: + memory: {{ .Values.resources.requests.memory}} + cpu: {{ .Values.resources.requests.cpu}} + limits: + memory: {{ .Values.resources.limits.memory}} + cpu: {{ .Values.resources.limits.cpu}} env: - name: BROKER_0 valueFrom: diff --git a/values.yaml b/values.yaml index 05ff6c8..5cc2b9e 100644 --- a/values.yaml +++ b/values.yaml @@ -50,6 +50,14 @@ service: type: ClusterIP port: 80 +resources: + limits: + memory: "512Mi" + cpu: "0.6" + requests: + memory: "128Mi" + cpu: "0.2" + psql: enabled: true @@ -67,6 +75,13 @@ postgresql: app: consumer-db podLabels: app: consumer-db + resources: + limits: + memory: "1024Mi" + cpu: "1" + requests: + memory: "512Mi" + cpu: "0.5" kafka: listeners: @@ -84,6 +99,13 @@ kafka: replicaCount: 3 persistence: size: 1Gi + resources: + limits: + memory: "1024Mi" + cpu: "1" + requests: + memory: "512Mi" + cpu: "0.5" serviceAccount: create: false provisioning: From f932ed1ea81385ff6d97095d3e36a25e9abdeedb Mon Sep 17 00:00:00 2001 From: Siddharth Rawat Date: Fri, 1 Dec 2023 16:25:50 -0500 Subject: [PATCH 2/2] fix: update cpu limits and requests to consumer app --- values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/values.yaml b/values.yaml index 5cc2b9e..f6697b9 100644 --- a/values.yaml +++ b/values.yaml @@ -53,10 +53,10 @@ service: resources: limits: memory: "512Mi" - cpu: "0.6" + cpu: "0.8" requests: memory: "128Mi" - cpu: "0.2" + cpu: "0.4" psql: enabled: true