Skip to content

Commit

Permalink
Update metrics config for w3s validators (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
antares-sw authored Nov 13, 2024
1 parent 46fe0da commit 1e3ca0e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 25 deletions.
4 changes: 2 additions & 2 deletions charts/web3signer-validators/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 6.2.4
version: 6.3.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v6.2.4"
appVersion: "v6.3.0"

keywords:
- ethereum
Expand Down
44 changes: 25 additions & 19 deletions charts/web3signer-validators/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
{{- $root := . -}}
{{- range (untilStep (int .Values.validatorsKeyIndex) (int (add .Values.validatorsKeyIndex .Values.validatorsCount)) 1) }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "validators.fullname" . }}
{{- if .Values.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
name: {{ template "validators.fullname" $root }}-validator{{ . }}
{{- if $root.Values.metrics.serviceMonitor.namespace }}
namespace: {{ $root.Values.metrics.serviceMonitor.namespace }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
namespace: {{ $root.Release.Namespace | quote }}
{{- end }}
labels:
{{- include "validators.labels" . | nindent 4 }}
{{- if .Values.metrics.serviceMonitor.additionalLabels }}
{{- toYaml .Values.metrics.serviceMonitor.additionalLabels | nindent 4 }}
{{- include "validators.labels" $root | nindent 4 }}
{{- if $root.Values.metrics.serviceMonitor.additionalLabels }}
{{- toYaml $root.Values.metrics.serviceMonitor.additionalLabels | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: metrics
path: /metrics
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- if $root.Values.metrics.serviceMonitor.interval }}
interval: {{ $root.Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- if $root.Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ $root.Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- if $root.Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ $root.Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- if $root.Values.metrics.serviceMonitor.relabelings }}
relabelings: {{- toYaml $root.Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- if $root.Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml $root.Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
- {{ $root.Release.Namespace }}
selector:
matchLabels:
{{- include "validators.selectorLabels" . | nindent 6 }}
{{- include "validators.selectorLabels" $root | nindent 6 }}
index: {{ template "validators.fullname" $root }}-validator{{ . }}

{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/web3signer-validators/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ metadata:
name: {{ template "validators.fullname" $root }}-validator{{.}}
labels:
{{- include "validator.labels" $root | nindent 4 }}
index: {{ template "validators.fullname" $root }}-validator{{.}}
spec:
replicas: 1
selector:
matchLabels:
{{- include "validators.selectorLabels" $root | nindent 6 }}
index: {{ template "validators.fullname" $root }}-validator{{.}}
serviceName: {{ template "validators.fullname" $root }}
template:
metadata:
labels:
{{- include "validators.selectorLabels" $root | nindent 8 }}
index: {{ template "validators.fullname" $root }}-validator{{.}}
spec:
{{- with (concat $root.Values.imagePullSecrets $root.Values.global.imagePullSecrets) }}
imagePullSecrets:
Expand Down
14 changes: 10 additions & 4 deletions charts/web3signer-validators/templates/svc.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{{- if .Values.metrics.enabled }}
{{- $root := . -}}
{{- range (untilStep (int .Values.validatorsKeyIndex) (int (add .Values.validatorsKeyIndex .Values.validatorsCount)) 1) }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "validators.fullname" . }}
name: {{ template "validators.fullname" $root }}-validator{{ . }}
labels:
{{- include "validators.selectorLabels" . | nindent 4 }}
{{- include "validators.selectorLabels" $root | nindent 4 }}
index: {{ template "validators.fullname" $root }}-validator{{.}}
spec:
selector:
{{- include "validators.selectorLabels" . | nindent 4 }}
{{- include "validators.selectorLabels" $root | nindent 4 }}
index: {{ template "validators.fullname" $root }}-validator{{.}}
type: ClusterIP
ports:
- name: metrics
port: {{ .Values.metrics.port }}
port: {{ $.Values.metrics.port }}
targetPort: metrics
{{- end }}
{{- end }}

0 comments on commit 1e3ca0e

Please sign in to comment.