Skip to content

Commit

Permalink
Add promtail ServiceMonitor and headless Service (grafana#856)
Browse files Browse the repository at this point in the history
These are optional objects guarded by `serviceMonitor.enabled`.

Chart minor version also receives a bump.
  • Loading branch information
martinbaillie authored and cyriltovena committed Aug 7, 2019
1 parent 06d5770 commit cc92f49
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
22 changes: 22 additions & 0 deletions production/helm/promtail/templates/service-headless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "promtail.fullname" . }}-headless
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "promtail.name" . }}
chart: {{ template "promtail.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
clusterIP: None
ports:
- port: {{ .Values.config.server.http_listen_port }}
protocol: TCP
name: http-metrics
targetPort: http-metrics
selector:
app: {{ template "promtail.name" . }}
release: {{ .Release.Name }}
{{- end }}
24 changes: 24 additions & 0 deletions production/helm/promtail/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "promtail.fullname" . }}
labels:
app: {{ template "promtail.name" . }}
chart: {{ template "promtail.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
selector:
matchLabels:
app: {{ template "promtail.name" . }}
release: {{ .Release.Name | quote }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
endpoints:
- port: http-metrics
{{- if .Values.serviceMonitor.interval }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
{{- end }}
4 changes: 4 additions & 0 deletions production/helm/promtail/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,7 @@ config:
target_config:
# Period to resync directories being watched and files being tailed
sync_period: 10s

serviceMonitor:
enabled: false
interval: ""

0 comments on commit cc92f49

Please sign in to comment.