Skip to content

Commit

Permalink
feat: add ServiceMonitor/Scrape (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrPsychick authored Mar 13, 2023
1 parent d845537 commit 34174d2
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 1 deletion.
4 changes: 3 additions & 1 deletion charts/athens-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: athens-proxy
version: 0.5.7
version: 0.5.8
appVersion: v0.11.0
description: The proxy server for Go modules
icon: https://raw.githubusercontent.com/gomods/athens/main/docs/static/banner.png
Expand All @@ -19,4 +19,6 @@ maintainers:
email: [email protected]
- name: DrPsychick
email: [email protected]
- name: nrwiersma
email: [email protected]
engine: gotpl
40 changes: 40 additions & 0 deletions charts/athens-proxy/templates/service-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- if .Values.metrics.serviceMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
prometheus: default
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "fullname" . }}
{{- if .Values.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
{{- end }}
spec:
endpoints:
- path: /metrics
port: http
{{- if .Values.basicAuth.enabled }}
basicAuth:
password:
name: {{ .Values.basicAuth.secretName }}
key: {{ .Values.basicAuth.passwordSecretKey }}
username:
name: {{ .Values.basicAuth.secretName }}
key: {{ .Values.basicAuth.usernameSecretKey }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app: {{ template "fullname" . }}
release: "{{ .Release.Name }}"
{{- end }}
41 changes: 41 additions & 0 deletions charts/athens-proxy/templates/service-scrape.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.metrics.serviceScrape.enabled }}
---
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
metadata:
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
prometheus: default
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "fullname" . }}
{{- if .Values.metrics.serviceScrape.namespace }}
namespace: {{ .Values.metrics.serviceScrape.namespace }}
{{- end }}
spec:
endpoints:
- path: /metrics
port: http
{{- if .Values.basicAuth.enabled }}
basicAuth:
password:
name: {{ .Values.basicAuth.secretName }}
key: {{ .Values.basicAuth.passwordSecretKey }}
username:
name: {{ .Values.basicAuth.secretName }}
key: {{ .Values.basicAuth.usernameSecretKey }}
{{- end }}
jobLabel: {{ template "fullname" . }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app: {{ template "fullname" . }}
release: "{{ .Release.Name }}"
{{- end }}
13 changes: 13 additions & 0 deletions charts/athens-proxy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,19 @@ sshGitServers: {}

goGetWorkers: 3

metrics:
# create ServiceMonitor for prometheus
serviceMonitor:
enabled: false
# namespace: "monitoring"
# labels:
# prometheus: default

# create VMServiceScrape for victoria
serviceScrape:
enabled: false
# namespace: "monitoring"

serviceAccount:
create: true
annotations: {}
Expand Down

0 comments on commit 34174d2

Please sign in to comment.