Skip to content

Commit

Permalink
Set GOMAXPROCS and GOMEMLIMIT environment variables based on containe…
Browse files Browse the repository at this point in the history
…r resources (#8989)
  • Loading branch information
jnoordsij committed May 22, 2024
1 parent 5d6805d commit 0b35416
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
14 changes: 14 additions & 0 deletions charts/kubernetes-dashboard/templates/deployments/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ spec:
secretKeyRef:
name: {{ template "kubernetes-dashboard.app.csrf.secret.name" . }}
key: {{ template "kubernetes-dashboard.app.csrf.secret.key" . }}

{{- if .Values.api.containers.resources.limits.cpu }}
- name: GOMAXPROCS
valueFrom:
resourceFieldRef:
resource: limits.cpu
{{- end }}
{{- if .Values.api.containers.resources.limits.memory }}
- name: GOMEMLIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
{{- end }}

{{- with .Values.api.containers.env }}
{{ toYaml . | nindent 12 }}
{{- end }}
Expand Down
14 changes: 14 additions & 0 deletions charts/kubernetes-dashboard/templates/deployments/auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ spec:
secretKeyRef:
name: {{ template "kubernetes-dashboard.app.csrf.secret.name" . }}
key: {{ template "kubernetes-dashboard.app.csrf.secret.key" . }}

{{- if .Values.auth.containers.resources.limits.cpu }}
- name: GOMAXPROCS
valueFrom:
resourceFieldRef:
resource: limits.cpu
{{- end }}
{{- if .Values.auth.containers.resources.limits.memory }}
- name: GOMEMLIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
{{- end }}

{{- with .Values.auth.containers.env }}
{{ toYaml . | nindent 12 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,21 @@ spec:
{{ toYaml . | nindent 12 }}
{{- end }}

{{- with .Values.web.containers.env }}
env:
{{- if .Values.metricsScraper.containers.resources.limits.cpu }}
- name: GOMAXPROCS
valueFrom:
resourceFieldRef:
resource: limits.cpu
{{- end }}
{{- if .Values.metricsScraper.containers.resources.limits.memory }}
- name: GOMEMLIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
{{- end }}

{{- with .Values.metricsScraper.containers.env }}
{{ toYaml . | nindent 12 }}
{{- end }}

Expand Down
15 changes: 14 additions & 1 deletion charts/kubernetes-dashboard/templates/deployments/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,21 @@ spec:
{{ toYaml . | nindent 12 }}
{{- end }}

{{- with .Values.web.containers.env }}
env:
{{- if .Values.web.containers.resources.limits.cpu }}
- name: GOMAXPROCS
valueFrom:
resourceFieldRef:
resource: limits.cpu
{{- end }}
{{- if .Values.web.containers.resources.limits.memory }}
- name: GOMEMLIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
{{- end }}

{{- with .Values.web.containers.env }}
{{ toYaml . | nindent 12 }}
{{- end }}

Expand Down

0 comments on commit 0b35416

Please sign in to comment.