Skip to content

Commit

Permalink
[prometheus-json-exporter]: Allow additional container args and servi…
Browse files Browse the repository at this point in the history
…ce monitor relabelings

Signed-off-by: Faisal K <[email protected]>
  • Loading branch information
faisal-khalique committed Mar 30, 2024
1 parent e908c1a commit 9adef80
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/prometheus-json-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.11.0
version: 0.12.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
7 changes: 7 additions & 0 deletions charts/prometheus-json-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ spec:
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- if .Values.extraArgs }}
args:
{{- range .Values.extraArgs }}
- {{ .name | quote }}
- {{ .value | quote }}
{{- end }}
{{- end }}
{{- with .Values.environmentVariables }}
env:
{{- toYaml . | nindent 12}}
Expand Down
5 changes: 5 additions & 0 deletions charts/prometheus-json-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ spec:
- targetLabel: {{ $targetLabel }}
replacement: {{ $replacement }}
{{- end }}
{{- $relabelings := .additionalRelabels | default $.Values.serviceMonitor.defaults.additionalRelabels }}
{{- if $relabelings }}
relabelings:
{{- toYaml $relabelings | nindent 6 }}
{{- end }}
jobLabel: "{{ $.Release.Name }}"
selector:
matchLabels:
Expand Down
7 changes: 7 additions & 0 deletions charts/prometheus-json-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ serviceMonitor:
# Default values that will be used for all ServiceMonitors created by `targets`
defaults:
additionalMetricsRelabels: {}
additionalRelabels: []
interval: 10s
labels: {}
scrapeTimeout: 30s
Expand All @@ -73,6 +74,7 @@ serviceMonitor:
# interval: 60s # Scraping interval. Overrides value set in `defaults`
# scrapeTimeout: 60s # Scrape timeout. Overrides value set in `defaults`
# additionalMetricsRelabels: {} # Map of metric labels and values to add
# additionalRelabels: [] # relabelings of metrics
# module: example_module # Name of the module to pick up from `config.yaml` for scraping this target. Optional. Default is `default` provided by the exporter itself.

ingress:
Expand Down Expand Up @@ -203,3 +205,8 @@ extraInitContainers: []
# - name: init-myservice
# image: busybox:1.28
# command: [ 'sh', '-c', "sleep 10; done" ]

## Additional container arguments
extraArgs: []
# - name: --config.file
# value: /app/config/myconfig.yml

0 comments on commit 9adef80

Please sign in to comment.