helm(minor): add service monitors
This commit is contained in:
parent
e4fbcd3735
commit
3d73aac3ab
15
helm/passbook/templates/static-sm.yaml
Normal file
15
helm/passbook/templates/static-sm.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "passbook.name" . }}
|
||||
helm.sh/chart: {{ include "passbook.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
name: {{ include "passbook.fullname" . }}-static-monitoring
|
||||
spec:
|
||||
endpoints:
|
||||
- port: http
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s.passbook.io/component: static
|
|
@ -4,9 +4,10 @@ metadata:
|
|||
name: {{ include "passbook.fullname" . }}-web
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "passbook.name" . }}
|
||||
helm.sh/chart: {{ include "passbook.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
helm.sh/chart: {{ include "passbook.chart" . }}
|
||||
k8s.passbook.io/component: web
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
|
|
22
helm/passbook/templates/web-sm.yaml
Normal file
22
helm/passbook/templates/web-sm.yaml
Normal file
|
@ -0,0 +1,22 @@
|
|||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "passbook.name" . }}
|
||||
helm.sh/chart: {{ include "passbook.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
name: {{ include "passbook.fullname" . }}-web-monitoring
|
||||
spec:
|
||||
endpoints:
|
||||
- basicAuth:
|
||||
password:
|
||||
name: {{ include "passbook.fullname" . }}-secret-key
|
||||
key: secret_key
|
||||
username:
|
||||
name: {{ include "passbook.fullname" . }}-secret-key
|
||||
key: monitoring_username
|
||||
port: http
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s.passbook.io/component: web
|
|
@ -1,10 +1,12 @@
|
|||
"""Metrics view"""
|
||||
from base64 import b64encode
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import Http404, HttpRequest, HttpResponse
|
||||
from django.views import View
|
||||
from django.http import HttpRequest, HttpResponse, Http404
|
||||
from django_prometheus.exports import ExportToDjangoView
|
||||
|
||||
|
||||
class MetricsView(View):
|
||||
"""Wrapper around ExportToDjangoView, using http-basic auth"""
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ from django.views.generic import RedirectView
|
|||
from structlog import get_logger
|
||||
|
||||
from passbook.core.views import error
|
||||
from passbook.root.monitoring import MetricsView
|
||||
from passbook.lib.utils.reflection import get_apps
|
||||
from passbook.root.monitoring import MetricsView
|
||||
|
||||
LOGGER = get_logger()
|
||||
admin.autodiscover()
|
||||
|
|
Reference in a new issue