Skip to content

Commit

Permalink
feat: add prometheus service monitor to kratos (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
Demonsthere authored Jan 31, 2022
1 parent 8c931e6 commit 0ccb71d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions helm/charts/kratos/templates/service-admin.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.service.admin.enabled -}}
---
apiVersion: v1
kind: Service
metadata:
Expand All @@ -24,4 +25,27 @@ spec:
selector:
app.kubernetes.io/name: {{ include "kratos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "kratos.fullname" . }}-admin
namespace: {{ .Release.Namespace }}
labels:
{{ include "kratos.labels" . | indent 4 }}
{{- with .Values.service.admin.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- path: /metrics/prometheus
port: {{ .Values.service.admin.name }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "kratos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: admin
{{- end -}}
{{- end }}
1 change: 1 addition & 0 deletions helm/charts/kratos/templates/statefulset-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
app.kubernetes.io/component: courier
{{ include "kratos.labels" . | indent 4 }}
{{- with .Values.deployment.labels }}
{{- toYaml . | nindent 4 }}
Expand Down

0 comments on commit 0ccb71d

Please sign in to comment.