From 2b23dae64b8b04ee985ea55e1763351f66b1fd2c Mon Sep 17 00:00:00 2001 From: Philipp Hellmich Date: Tue, 7 May 2019 16:25:52 +0200 Subject: [PATCH] [stable/home-assistant] added servicemonitor (#13524) * Added servicemonitor Signed-off-by: Philipp Hellmich * Update values.yaml Signed-off-by: Philipp Hellmich --- stable/home-assistant/Chart.yaml | 4 +-- .../templates/servicemonitor.yaml | 28 +++++++++++++++++++ stable/home-assistant/values.yaml | 17 +++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 stable/home-assistant/templates/servicemonitor.yaml diff --git a/stable/home-assistant/Chart.yaml b/stable/home-assistant/Chart.yaml index 001df4d9c3..0dd843d3cf 100644 --- a/stable/home-assistant/Chart.yaml +++ b/stable/home-assistant/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v1 -appVersion: 0.92.1 +appVersion: 0.92.2 description: Home Assistant name: home-assistant -version: 0.8.0 +version: 0.8.2 keywords: - home-assistant - hass diff --git a/stable/home-assistant/templates/servicemonitor.yaml b/stable/home-assistant/templates/servicemonitor.yaml new file mode 100644 index 0000000000..054a6aaa50 --- /dev/null +++ b/stable/home-assistant/templates/servicemonitor.yaml @@ -0,0 +1,28 @@ +{{- if and ( .Values.monitoring.serviceMonitor.enabled ) ( .Values.monitoring.enabled ) }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: +{{- if .Values.monitoring.serviceMonitor.labels }} + labels: +{{ toYaml .Values.monitoring.serviceMonitor.labels | indent 4}} +{{- end }} + name: {{ template "home-assistant.fullname" . }}-prometheus-exporter +{{- if .Values.monitoring.serviceMonitor.namespace }} + namespace: {{ .Values.monitoring.serviceMonitor.namespace }} +{{- end }} +spec: + endpoints: + - targetPort: api + path: /api/prometheus +{{- if .Values.monitoring.serviceMonitor.interval }} + interval: {{ .Values.monitoring.serviceMonitor.interval }} +{{- end }} + jobLabel: {{ template "home-assistant.fullname" . }}-prometheus-exporter + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "home-assistant.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/stable/home-assistant/values.yaml b/stable/home-assistant/values.yaml index 6a9504587e..2ff31b79c1 100644 --- a/stable/home-assistant/values.yaml +++ b/stable/home-assistant/values.yaml @@ -151,6 +151,23 @@ configurator: loadBalancerSourceRanges: [] # nodePort: 30000 +## Add support for Prometheus +# settings has to be enabled in configuration.yaml +# https://www.home-assistant.io/components/prometheus/ +monitoring: + enabled: false + serviceMonitor: + # When set true and if Prometheus Operator is installed then use a ServiceMonitor to configure scraping + enabled: true + # Set the namespace the ServiceMonitor should be deployed + # namespace: monitoring + # Set how frequently Prometheus should scrape + # interval: 30s + # Set path to beats-exporter telemtery-path + # telemetryPath: /metrics + # Set labels for the ServiceMonitor, use this to define your scrape label for Prometheus Operator + # labels: + resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little