enable prometheus servicemonitor (#164)

also enable proper healthchecks

Fixes #160
Fixes #161

Signed-off-by: Jeff Billimek <jeff@billimek.com>
This commit is contained in:
Jeff Billimek 2020-03-08 20:10:57 -04:00 committed by GitHub
parent 018c383c7c
commit a2f4de737f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 65 additions and 41 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "v0.5" appVersion: "v0.5"
description: DNS proxy as ad-blocker for local network description: DNS proxy as ad-blocker for local network
name: blocky name: blocky
version: 1.1.2 version: 2.0.0
keywords: keywords:
- blocky - blocky
- dbs - dbs

View File

@ -19,6 +19,10 @@ spec:
labels: labels:
app.kubernetes.io/name: {{ include "blocky.name" . }} app.kubernetes.io/name: {{ include "blocky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
{{- with .Values.podAnnotations }}
annotations:
{{ toYaml . | nindent 8 }}
{{- end }}
spec: spec:
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
@ -36,34 +40,34 @@ spec:
- name: logs - name: logs
mountPath: /logs mountPath: /logs
ports: ports:
- name: prometheus ports:
- name: monitoring
containerPort: 4000 containerPort: 4000
- name: dns
containerPort: 53
protocol: TCP protocol: TCP
- containerPort: 53 - name: dns-udp
name: dns containerPort: 53
protocol: TCP
- containerPort: 53
name: dns-udp
protocol: UDP protocol: UDP
# livenessProbe: livenessProbe:
# httpGet: httpGet:
# path: / path: /metrics
# port: http port: monitoring
# failureThreshold: {{ .Values.probes.liveness.failureThreshold }} failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
# periodSeconds: {{ .Values.probes.liveness.periodSeconds }} periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
# readinessProbe: readinessProbe:
# httpGet: httpGet:
# path: / path: /metrics
# port: http port: monitoring
# failureThreshold: {{ .Values.probes.readiness.failureThreshold }} failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
# periodSeconds: {{ .Values.probes.readiness.periodSeconds }} periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
# startupProbe: startupProbe:
# httpGet: httpGet:
# path: / path: /metrics
# port: http port: monitoring
# initialDelaySeconds: {{ .Values.probes.startup.initialDelaySeconds }} initialDelaySeconds: {{ .Values.probes.startup.initialDelaySeconds }}
# failureThreshold: {{ .Values.probes.startup.failureThreshold }} failureThreshold: {{ .Values.probes.startup.failureThreshold }}
# periodSeconds: {{ .Values.probes.startup.periodSeconds }} periodSeconds: {{ .Values.probes.startup.periodSeconds }}
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
volumes: volumes:

View File

@ -1,21 +1,18 @@
{{- if .Values.servicePrometheus.enabled }}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ include "blocky.fullname" . }}-prometheus name: {{ include "blocky.fullname" . }}-headless
labels: labels:
app.kubernetes.io/name: {{ include "blocky.name" . }} app.kubernetes.io/name: {{ include "blocky.name" . }}
helm.sh/chart: {{ include "blocky.chart" . }} helm.sh/chart: {{ include "blocky.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
spec: spec:
type: {{ .Values.servicePrometheus.type }} clusterIP: None
ports: ports:
- port: {{ .Values.servicePrometheus.port }} - name: monitoring
targetPort: prometheus port: 4000
protocol: TCP targetPort: monitoring
name: prometheus
selector: selector:
app.kubernetes.io/name: {{ include "blocky.name" . }} app.kubernetes.io/name: {{ include "blocky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@ -0,0 +1,23 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "blocky.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "blocky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "blocky.chart" . }}
{{- with .Values.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app.kubernetes.io/name: {{ include "blocky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
endpoints:
- port: monitoring
interval: 30s
path: /metrics
{{- end }}

View File

@ -152,14 +152,14 @@ serviceUDP:
# metallb.universe.tf/address-pool: network-services # metallb.universe.tf/address-pool: network-services
# metallb.universe.tf/allow-shared-ip: blocky-svc # metallb.universe.tf/allow-shared-ip: blocky-svc
servicePrometheus: serviceMonitor:
enabled: false enabled: false
port: 4000 additionalLabels: {}
type: ClusterIP
externalTrafficPolicy: Local ## Pod Annotations
loadBalancerIP: "" podAnnotations:
# a fixed LoadBalancer IP prometheus.io/scrape: "true"
annotations: {} prometheus.io/port: "monitoring"
resources: {} resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious # We usually recommend not to specify default resources and to leave this as a conscious