Skip to content

Commit

Permalink
feat: add servicemonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrokiefer committed Mar 19, 2021
1 parent 7ec886a commit a4954de
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/conntrack-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
appVersion: 0.6.0
description: Prometheus Conntrack Exporter
name: conntrack-exporter
version: 0.1.2
version: 0.1.3
2 changes: 1 addition & 1 deletion charts/conntrack-exporter/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ClusterRole
metadata:
name: {{ template "conntrack-exporter.fullname" . }}
labels:
app: {{ template "conntrack-exporter.name" . }}-operator
app: {{ template "conntrack-exporter.name" . }}
{{ include "conntrack-exporter.labels" . | indent 4 }}
rules:
- apiGroups: [""]
Expand Down
33 changes: 33 additions & 0 deletions charts/conntrack-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "conntrack-exporter.fullname" . }}
namespace: {{ template "conntrack-exporter.namespace" . }}
labels:
{{ include "conntrack-exporter.labels" . | indent 4 }}
{{- if .Values.serviceMonitor.additionalLabels }}
{{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app: {{ template "conntrack-exporter.name" . }}
release: {{ .Release.Name }}
endpoints:
- port: http-metrics
scheme: {{ $.Values.serviceMonitor.scheme }}
{{- if $.Values.serviceMonitor.bearerTokenFile }}
bearerTokenFile: {{ $.Values.serviceMonitor.bearerTokenFile }}
{{- end }}
{{- if $.Values.serviceMonitor.tlsConfig }}
tlsConfig: {{ toYaml $.Values.serviceMonitor.tlsConfig | nindent 8 }}
{{- end }}
{{- if .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.serviceMonitor.relabelings }}
relabelings:
{{ toYaml .Values.serviceMonitor.relabelings | indent 8 }}
{{- end }}
{{- end }}
11 changes: 11 additions & 0 deletions charts/conntrack-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name: ""

serviceMonitor:
enabled: true
additionalLabels: []

scheme: http
bearerTokenFile:
tlsConfig: {}

scrapeTimeout: 10s
relabelings: []

podAnnotations: {}

podLabels: {}
Expand Down

0 comments on commit a4954de

Please sign in to comment.