Skip to content

Commit

Permalink
Add promtail ServiceMonitor and headless Service
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 committed Aug 7, 2019
1 parent 2464ee7 commit a6a9bf1
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion production/helm/promtail/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: promtail
version: 0.10.0
version: 0.11.0
appVersion: 0.0.1
kubeVersion: "^1.10.0-0"
description: "Responsible for gathering logs and sending them to Loki"
Expand Down
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 a6a9bf1

Please sign in to comment.