Commit c6a84324 by frank Committed by Craig Jellick

Add resources quota to Grafana

**Problem:** Can't enable project level monitoring without resources quota **Solution:** Add resource quota to workload spec **Issue:** https://github.com/rancher/rancher/issues/16993
parent d210a505
...@@ -30,6 +30,10 @@ spec: ...@@ -30,6 +30,10 @@ spec:
subPath: copy-datasource-plugin-json.sh subPath: copy-datasource-plugin-json.sh
- name: grafana-static-contents - name: grafana-static-contents
mountPath: /host mountPath: /host
{{- if and .Values.resources .Values.resources.inits }}
resources:
{{ toYaml .Values.resources.inits | indent 10 }}
{{- end }}
- name: grafana-init-plugin-json-modify - name: grafana-init-plugin-json-modify
image: {{ .Values.image.inits.tools.repository }}:{{ .Values.image.inits.tools.tag }} image: {{ .Values.image.inits.tools.repository }}:{{ .Values.image.inits.tools.tag }}
command: command:
...@@ -40,6 +44,10 @@ spec: ...@@ -40,6 +44,10 @@ spec:
subPath: modify-datasource-plugin-json.sh subPath: modify-datasource-plugin-json.sh
- name: grafana-static-contents - name: grafana-static-contents
mountPath: /host mountPath: /host
{{- if and .Values.resources .Values.resources.inits }}
resources:
{{ toYaml .Values.resources.inits | indent 10 }}
{{- end }}
containers: containers:
- name: grafana - name: grafana
image: {{ .Values.image.repository }}:{{ .Values.image.tag }} image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
...@@ -83,9 +91,9 @@ spec: ...@@ -83,9 +91,9 @@ spec:
timeoutSeconds: 1 timeoutSeconds: 1
successThreshold: 1 successThreshold: 1
failureThreshold: 10 failureThreshold: 10
{{- if .Values.resources }} {{- if and .Values.resources .Values.resources.core }}
resources: resources:
{{ toYaml .Values.resources | indent 12 }} {{ toYaml .Values.resources.core | indent 10 }}
{{- end }} {{- end }}
- name: grafana-watcher - name: grafana-watcher
image: {{ .Values.grafanaWatcher.repository }}:{{ .Values.grafanaWatcher.tag }} image: {{ .Values.grafanaWatcher.repository }}:{{ .Values.grafanaWatcher.tag }}
...@@ -106,9 +114,9 @@ spec: ...@@ -106,9 +114,9 @@ spec:
secretKeyRef: secretKeyRef:
name: {{ template "app.fullname" . }} name: {{ template "app.fullname" . }}
key: password key: password
{{- if .Values.grafanaWatcher.resources }} {{- if and .Values.resources .Values.resources.watcher }}
resources: resources:
{{ toYaml .Values.grafanaWatcher.resources | indent 12 }} {{ toYaml .Values.resources.watcher | indent 10 }}
{{- end }} {{- end }}
volumeMounts: volumeMounts:
- name: grafana-dashboards - name: grafana-dashboards
...@@ -132,6 +140,10 @@ spec: ...@@ -132,6 +140,10 @@ spec:
volumeMounts: volumeMounts:
- mountPath: /nginx/ - mountPath: /nginx/
name: grafana-nginx name: grafana-nginx
{{- if and .Values.resources .Values.resources.proxy }}
resources:
{{ toYaml .Values.resources.proxy | indent 10 }}
{{- end }}
{{- if .Values.nodeSelector }} {{- if .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{ toYaml .Values.nodeSelector | indent 4 }} {{ toYaml .Values.nodeSelector | indent 4 }}
......
...@@ -72,13 +72,35 @@ persistence: {} ...@@ -72,13 +72,35 @@ persistence: {}
## Resource limits & requests ## Resource limits & requests
## Ref: https://kubernetes.io/docs/user-guide/compute-resources/ ## Ref: https://kubernetes.io/docs/user-guide/compute-resources/
resources: {} resources:
# limits: inits:
# memory: 200Mi limits:
# cpu: 200m memory: 50Mi
# requests: cpu: 50m
# memory: 100Mi requests:
# cpu: 100m memory: 50Mi
cpu: 50m
core:
limits:
memory: 200Mi
cpu: 200m
requests:
memory: 100Mi
cpu: 100m
proxy:
limits:
memory: 100Mi
cpu: 100m
requests:
memory: 50Mi
cpu: 50m
watcher:
limits:
memory: 50Mi
cpu: 50m
requests:
memory: 50Mi
cpu: 50m
## A list of additional configmaps that contain -dashboard.json and/or -datasource.json files ## A list of additional configmaps that contain -dashboard.json and/or -datasource.json files
......
...@@ -196,6 +196,35 @@ grafana: ...@@ -196,6 +196,35 @@ grafana:
tag: v0.1.0 tag: v0.1.0
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux
resources:
inits:
limits:
memory: 50Mi
cpu: 50m
requests:
memory: 50Mi
cpu: 50m
core:
limits:
memory: 200Mi
cpu: 200m
requests:
memory: 100Mi
cpu: 100m
proxy:
limits:
memory: 100Mi
cpu: 100m
requests:
memory: 50Mi
cpu: 50m
watcher:
limits:
memory: 50Mi
cpu: 50m
requests:
memory: 50Mi
cpu: 50m
persistence: persistence:
enabled: false enabled: false
storageClass: "" storageClass: ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment