Skip to content

Commit

Permalink
feat(prometheus-mysql-exporter): modify values structure and now supp…
Browse files Browse the repository at this point in the history
…ort shared credentials pattern

Signed-off-by: Remy Mollandin <[email protected]>
  • Loading branch information
Remy-Mollandin-SK5 committed Oct 17, 2023
1 parent 76fa4dd commit 1f57b64
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions charts/prometheus-mysql-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ password=remote_password
```

The configuration file can be referenced using `mysql.existingConfigSecret`.
If all your target use the same credentials, you can set `serviceMonitor.sharedSecret.enabled` to `true` and define the key name in `serviceMonitor.sharedSecret.name`.

### From 1.x to 2.x

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ spec:
{{ toYaml . | trim | indent 4 -}}
{{- end }}
endpoints:
{{- if .Values.serviceMonitor.multipleTarget }}
{{- range .Values.serviceMonitor.targets }}
{{- if .Values.serviceMonitor.multipleTarget.enabled }}
{{- range .Values.serviceMonitor.multipleTarget.targets }}
- path: /probe
port: {{ $.Values.service.name }}
{{- if $.Values.serviceMonitor.interval }}
Expand All @@ -58,8 +58,13 @@ spec:
params:
target:
- {{ .endpoint }}:{{ .port | default 3306 }}
{{- if $.Values.serviceMonitor.multipleTarget.sharedSecret.enabled }}
auth_module:
- client.{{ $.Values.serviceMonitor.multipleTarget.sharedSecret.name }}
{{- else }}
auth_module:
- client.{{ .name }}
{{- end }}
{{- end }}
{{- else }}
- path: /metrics
Expand Down
9 changes: 7 additions & 2 deletions charts/prometheus-mysql-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,20 @@ serviceMonitor:
# Set relabel_configs as per https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
relabelings: []
# Enable multi target scraping.
multipleTarget: false
targets: []
multipleTarget:
enabled: false
targets: []
# target connection information with name (required), endpoint (required) and port (optionnal)
# the name must match an entry client.{{ name }} existing in the secret
# - endpoint: mysql1.dns.local
# name: mysql1
# port: 3307
# - endpoint: mysql2.dns.local
# name: mysql2
# Enable shared credentials for all targets
sharedSecret:
enabled: false
name: ""

serviceAccount:
# Specifies whether a ServiceAccount should be created
Expand Down

0 comments on commit 1f57b64

Please sign in to comment.