Skip to content

Commit

Permalink
[stackdriver-exporter] feat: Adding relabeling config to serviceMonit…
Browse files Browse the repository at this point in the history
…or (prometheus-community#605)

* feat: Adding relabeling config to stackdriver-export serviceMonitor

Signed-off-by: Cleber Benjamin Warmling <cleberben.warmling@gmail.com>

* improving chart readability

Signed-off-by: Cleber Benjamin Warmling <cleberben.warmling@gmail.com>
  • Loading branch information
cleberwarmling authored Jan 22, 2021
1 parent a6a0b51 commit db5b735
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 19 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-stackdriver-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Stackdriver exporter for Prometheus
name: prometheus-stackdriver-exporter
version: 1.6.1
version: 1.7.0
appVersion: 0.6.0
home: https://www.stackdriver.com/
sources:
Expand Down
26 changes: 13 additions & 13 deletions charts/prometheus-stackdriver-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ spec:
labels:
app: {{ template "stackdriver-exporter.name" . }}
release: "{{ .Release.Name }}"
{{- if .Values.annotations }}
{{- if .Values.annotations }}
annotations:
{{ toYaml .Values.annotations | indent 8 }}
{{- end }}
{{- toYaml .Values.annotations | nindent 8 }}
{{- end }}
spec:
{{- if .Values.affinity }}
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
{{- toYaml .Values.affinity | nindent 8 }}
{{- end }}
serviceAccount: {{ template "stackdriver-exporter.serviceAccountName" . }}
restartPolicy: {{ .Values.restartPolicy }}
volumes:
Expand Down Expand Up @@ -84,7 +84,7 @@ spec:
- name: STACKDRIVER_EXPORTER_DROP_DELEGATED_PROJECTS
value: {{ .Values.stackdriver.dropDelegatedProjects | quote}}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- toYaml .Values.resources | nindent 12 }}
ports:
- containerPort: {{ .Values.service.httpPort }}
name: http
Expand All @@ -100,12 +100,12 @@ spec:
port: http
initialDelaySeconds: 10
timeoutSeconds: 10
{{- if .Values.nodeSelector }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
{{- toYaml .Values.nodeSelector | nindent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- toYaml .Values.tolerations | nindent 8 }}
{{- end }}

6 changes: 3 additions & 3 deletions charts/prometheus-stackdriver-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ metadata:
app: {{ template "stackdriver-exporter.name" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.service.annotations }}
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
{{- toYaml .Values.service.annotations | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ metadata:
name: {{ template "stackdriver-exporter.serviceAccountName" . }}
{{- if .Values.serviceAccount.annotations }}
annotations:
{{ toYaml .Values.serviceAccount.annotations | indent 4 }}
{{- toYaml .Values.serviceAccount.annotations | nindent 4 }}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.serviceMonitor.additionalLabels }}
{{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }}
{{- toYaml .Values.serviceMonitor.additionalLabels | nindent 4 }}
{{- end }}
spec:
endpoints:
Expand All @@ -22,6 +22,14 @@ spec:
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
{{- end }}
honorLabels: {{ .Values.serviceMonitor.honorLabels }}
{{- if .Values.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml .Values.serviceMonitor.metricRelabelings | nindent 4 }}
{{- end }}
{{- if .Values.serviceMonitor.relabelings }}
relabelings:
{{- toYaml .Values.serviceMonitor.relabelings | nindent 4 }}
{{- end }}
selector:
matchLabels:
chart: {{ template "stackdriver-exporter.chart" . }}
Expand Down
4 changes: 4 additions & 0 deletions charts/prometheus-stackdriver-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,7 @@ serviceMonitor:
# interval: 10s
## Defaults to what's used if you follow CoreOS [Prometheus Install Instructions](https://github.com/helm/charts/tree/master/stable/prometheus-operator#tldr)
honorLabels: true
# MetricRelabelConfigs to apply to samples before ingestion https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#relabelconfig
metricRelabelings: []
# RelabelConfigs to apply to samples before scraping. https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#relabelconfig
relabelings: []

0 comments on commit db5b735

Please sign in to comment.