Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
template service monitor for prometheus stack
Browse files Browse the repository at this point in the history
  • Loading branch information
WafflesVonMaple authored and WafflesVonMaple committed Jan 5, 2024
1 parent 358ece5 commit 96d9454
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 1 deletion.
24 changes: 24 additions & 0 deletions charts/rollup/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "rollup.name" -}}
{{- default .Values.config.rollup.name | trunc 63 | trimSuffix "-" }}-astria-dev-cluster
{{- end }}

{{/*
Common labels
*/}}
{{- define "rollup.labels" -}}
{{ include "rollup.selectorLabels" . }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "rollup.selectorLabels" -}}
app: {{ include "rollup.name" . }}
name: geth-metrics
{{- end }}



{{/*
Return if ingress is stable.
*/}}
Expand Down
4 changes: 4 additions & 0 deletions charts/rollup/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ spec:
name: ws-rpc
- containerPort: {{ .Values.ports.executionGRPC }}
name: execution-grpc
{{- if .Values.config.rollup.metrics.enabled }}
- containerPort: {{ .Values.ports.metrics }}
name: geth-metrics
{{- end }}
- name: composer
image: {{ .Values.images.composer }}
command: [ "/usr/local/bin/astria-composer" ]
Expand Down
15 changes: 15 additions & 0 deletions charts/rollup/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,18 @@ spec:
- name: blockscout-svc
port: {{ .Values.ports.blockscout }}
targetPort: blockscout
---
{{- if .Values.config.rollup.metrics.enabled }}
kind: Service
apiVersion: v1
metadata:
name: {{ .Values.config.rollup.name }}-metrics
namespace: {{ .Values.global.namespace }}
spec:
selector:
app: {{ .Values.config.rollup.name }}-astria-dev-cluster
ports:
- name: geth-metrics
port: {{ .Values.ports.metrics }}
targetPort: geth-metrics
{{- end }}
28 changes: 28 additions & 0 deletions charts/rollup/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.config.rollup.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: geth-metrics
labels:
{{- include "rollup.labels" . | nindent 4 }}
{{- with .Values.config.rollup.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
jobLabel: geth-metrics
namespaceSelector:
matchNames:
- {{ .Values.global.namespace }}
selector:
matchLabels:
app: {{ .Values.config.rollup.name }}-astria-dev-cluster
endpoints:
- port: {{ .Values.config.rollup.serviceMonitor.port }}
path: /debug/metrics/prometheus
{{- with .Values.config.rollup.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.config.rollup.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- end }}
9 changes: 8 additions & 1 deletion charts/rollup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ config:
# OptimismPortal contract was deployed at.
initialEthereumL1BlockHeight: 1
metrics:
# set to enable prometheus metrics
# set to enable prometheus metrics
enabled: false
serviceMonitor:
# set to enable port svc and service monitor
enabled: false
port: 6060
additionalLabels:
release: kube-prometheus-stack

faucet:
proxyCount: 1
Expand Down Expand Up @@ -222,3 +228,4 @@ ports:
gossipnet: 2451
faucet: 8080
blockscout: 4000
metrics: 6060

0 comments on commit 96d9454

Please sign in to comment.