diff --git a/charts/prometheus-mysql-exporter/Chart.yaml b/charts/prometheus-mysql-exporter/Chart.yaml index 94a59fc30064..a8cab66c58a6 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.0.0 +version: 2.1.0 home: https://github.com/prometheus/mysqld_exporter appVersion: v0.15.0 sources: diff --git a/charts/prometheus-mysql-exporter/templates/_helpers.tpl b/charts/prometheus-mysql-exporter/templates/_helpers.tpl index 6b23984296f3..1428208b4bcc 100644 --- a/charts/prometheus-mysql-exporter/templates/_helpers.tpl +++ b/charts/prometheus-mysql-exporter/templates/_helpers.tpl @@ -91,6 +91,17 @@ Secret key for config {{- end -}} */}} +{{/* +Define overriding namespace +*/}} +{{- define "prometheus-mysql-exporter.namespace" -}} + {{- if .Values.namespaceOverride -}} + {{- .Values.namespaceOverride -}} + {{- else -}} + {{- .Release.Namespace -}} + {{- end -}} +{{- end -}} + {{/* CloudSqlProxy Workload Identity Service Account Annotation */}} diff --git a/charts/prometheus-mysql-exporter/templates/deployment.yaml b/charts/prometheus-mysql-exporter/templates/deployment.yaml index 7a99a0464553..d83c9b3bb007 100644 --- a/charts/prometheus-mysql-exporter/templates/deployment.yaml +++ b/charts/prometheus-mysql-exporter/templates/deployment.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "prometheus-mysql-exporter.fullname" . }} + namespace: {{ include "prometheus-mysql-exporter.namespace" . }} labels: {{- include "prometheus-mysql-exporter.labels" . | nindent 4 }} spec: diff --git a/charts/prometheus-mysql-exporter/templates/secret-config.yaml b/charts/prometheus-mysql-exporter/templates/secret-config.yaml index be4652ba8c9b..2a0528e8c8f2 100644 --- a/charts/prometheus-mysql-exporter/templates/secret-config.yaml +++ b/charts/prometheus-mysql-exporter/templates/secret-config.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: Secret metadata: name: {{ template "prometheus-mysql-exporter.secretName" . }} + namespace: {{ include "prometheus-mysql-exporter.namespace" . }} labels: {{- include "prometheus-mysql-exporter.labels" . | nindent 4 }} type: Opaque diff --git a/charts/prometheus-mysql-exporter/templates/secret.yaml b/charts/prometheus-mysql-exporter/templates/secret.yaml index b10e0ac8de43..cbff3671bf66 100644 --- a/charts/prometheus-mysql-exporter/templates/secret.yaml +++ b/charts/prometheus-mysql-exporter/templates/secret.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: Secret metadata: name: {{ template "prometheus-mysql-exporter.cloudsqlsecret" . }} + namespace: {{ include "prometheus-mysql-exporter.namespace" . }} labels: {{- include "prometheus-mysql-exporter.labels" . | nindent 4 }} type: Opaque diff --git a/charts/prometheus-mysql-exporter/templates/service.yaml b/charts/prometheus-mysql-exporter/templates/service.yaml index c0846bfc4a54..afc2b2b283b7 100644 --- a/charts/prometheus-mysql-exporter/templates/service.yaml +++ b/charts/prometheus-mysql-exporter/templates/service.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: Service metadata: name: {{ template "prometheus-mysql-exporter.fullname" . }} + namespace: {{ include "prometheus-mysql-exporter.namespace" . }} labels: {{- include "prometheus-mysql-exporter.labels" . | nindent 4 }} {{- if .Values.service.labels }} diff --git a/charts/prometheus-mysql-exporter/templates/serviceaccount.yaml b/charts/prometheus-mysql-exporter/templates/serviceaccount.yaml index 8c0b53962a96..22859fdd74dd 100644 --- a/charts/prometheus-mysql-exporter/templates/serviceaccount.yaml +++ b/charts/prometheus-mysql-exporter/templates/serviceaccount.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ template "prometheus-mysql-exporter.serviceAccountName" . }} + namespace: {{ include "prometheus-mysql-exporter.namespace" . }} labels: app: {{ template "prometheus-mysql-exporter.name" . }} chart: {{ template "prometheus-mysql-exporter.chart" . }} diff --git a/charts/prometheus-mysql-exporter/templates/servicemonitor.yaml b/charts/prometheus-mysql-exporter/templates/servicemonitor.yaml index c75010447087..dba2bfdd6359 100644 --- a/charts/prometheus-mysql-exporter/templates/servicemonitor.yaml +++ b/charts/prometheus-mysql-exporter/templates/servicemonitor.yaml @@ -14,7 +14,7 @@ metadata: spec: namespaceSelector: matchNames: - - {{ .Release.Namespace }} + - {{ include "prometheus-mysql-exporter.namespace" . }} selector: matchLabels: {{- include "prometheus-mysql-exporter.selectorLabels" . | nindent 6 }} diff --git a/charts/prometheus-mysql-exporter/values.yaml b/charts/prometheus-mysql-exporter/values.yaml index 6ad9dcd85a7a..b0011bf47b18 100644 --- a/charts/prometheus-mysql-exporter/values.yaml +++ b/charts/prometheus-mysql-exporter/values.yaml @@ -2,6 +2,9 @@ ## This is a YAML-formatted file. ## Declare variables to be passed into your templates. +## namespaceOverride overrides the namespace which the resources will be deployed in +namespaceOverride: "" + ## override release name fullnameOverride: ""