helm(minor): add service monitors
This commit is contained in:
parent
e4fbcd3735
commit
3d73aac3ab
|
@ -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
|
name: {{ include "passbook.fullname" . }}-web
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: {{ include "passbook.name" . }}
|
app.kubernetes.io/name: {{ include "passbook.name" . }}
|
||||||
helm.sh/chart: {{ include "passbook.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 }}
|
||||||
|
helm.sh/chart: {{ include "passbook.chart" . }}
|
||||||
|
k8s.passbook.io/component: web
|
||||||
spec:
|
spec:
|
||||||
type: {{ .Values.service.type }}
|
type: {{ .Values.service.type }}
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -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"""
|
"""Metrics view"""
|
||||||
from base64 import b64encode
|
from base64 import b64encode
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.http import Http404, HttpRequest, HttpResponse
|
||||||
from django.views import View
|
from django.views import View
|
||||||
from django.http import HttpRequest, HttpResponse, Http404
|
|
||||||
from django_prometheus.exports import ExportToDjangoView
|
from django_prometheus.exports import ExportToDjangoView
|
||||||
|
|
||||||
|
|
||||||
class MetricsView(View):
|
class MetricsView(View):
|
||||||
"""Wrapper around ExportToDjangoView, using http-basic auth"""
|
"""Wrapper around ExportToDjangoView, using http-basic auth"""
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ from django.views.generic import RedirectView
|
||||||
from structlog import get_logger
|
from structlog import get_logger
|
||||||
|
|
||||||
from passbook.core.views import error
|
from passbook.core.views import error
|
||||||
from passbook.root.monitoring import MetricsView
|
|
||||||
from passbook.lib.utils.reflection import get_apps
|
from passbook.lib.utils.reflection import get_apps
|
||||||
|
from passbook.root.monitoring import MetricsView
|
||||||
|
|
||||||
LOGGER = get_logger()
|
LOGGER = get_logger()
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
|
Reference in New Issue