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 (#4408)

* [prometheus-json-exporter]: Allow additional container args and service monitor relabelings

Signed-off-by: Faisal K <[email protected]>

* Updates and incorporating review comments

Signed-off-by: Faisal K <[email protected]>

---------

Signed-off-by: Faisal K <[email protected]>
Signed-off-by: MH <[email protected]>
Co-authored-by: MH <[email protected]>
  • Loading branch information
faisal-khalique and zanhsieh authored Jun 27, 2024
1 parent bde2327 commit 96c694a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
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.1
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
9 changes: 8 additions & 1 deletion charts/prometheus-json-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,17 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.extraInitContainers }}
initContainers:
{{ toYaml . | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- with .Values.extraArgs }}
args:
{{- range . }}
- {{ .name | quote }}
- {{ .value | quote }}
{{- end }}
{{- end }}
{{- with .Values.environmentVariables }}
env:
{{- toYaml . | nindent 12}}
Expand Down
4 changes: 4 additions & 0 deletions charts/prometheus-json-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ spec:
replacement: {{ $replacement }}
action: replace
{{- end }}
{{- with .additionalRelabels | default $.Values.serviceMonitor.defaults.additionalRelabels }}
relabelings:
{{- toYaml . | 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 96c694a

Please sign in to comment.