From 9714ddfeed476c354c30b911ec4bc95b83d581a4 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Tue, 16 Jul 2024 10:53:13 +0200 Subject: [PATCH] [prometheus-mysql-exporter] Set GOMAXPROCS and GOMEMLIMIT environment variables based on container resources Signed-off-by: Jesper Noordsij --- charts/prometheus-mysql-exporter/Chart.yaml | 2 +- .../templates/deployment.yaml | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/charts/prometheus-mysql-exporter/Chart.yaml b/charts/prometheus-mysql-exporter/Chart.yaml index c706deb4f736..928ca8684c35 100644 --- a/charts/prometheus-mysql-exporter/Chart.yaml +++ b/charts/prometheus-mysql-exporter/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: A Helm chart for prometheus mysql exporter with cloudsqlproxy name: prometheus-mysql-exporter -version: 2.5.3 +version: 2.6.0 home: https://github.com/prometheus/mysqld_exporter appVersion: v0.15.1 sources: diff --git a/charts/prometheus-mysql-exporter/templates/deployment.yaml b/charts/prometheus-mysql-exporter/templates/deployment.yaml index 3daa8fa7eb85..49b27d950365 100644 --- a/charts/prometheus-mysql-exporter/templates/deployment.yaml +++ b/charts/prometheus-mysql-exporter/templates/deployment.yaml @@ -66,8 +66,20 @@ spec: {{- end }} {{- end }} {{- end }} - {{- if and (not .Values.mysql.existingConfigSecret.name) (.Values.mysql.existingPasswordSecret.name) }} env: + {{- if (.Values.resources.limits).cpu }} + - name: GOMAXPROCS + valueFrom: + resourceFieldRef: + resource: limits.cpu + {{- end }} + {{- if (.Values.resources.limits).memory }} + - name: GOMEMLIMIT + valueFrom: + resourceFieldRef: + resource: limits.memory + {{- end }} + {{- if and (not .Values.mysql.existingConfigSecret.name) (.Values.mysql.existingPasswordSecret.name) }} - name: MYSQLD_EXPORTER_PASSWORD valueFrom: secretKeyRef: