From 35894700f45a90ca05d940c24756072f863fcd94 Mon Sep 17 00:00:00 2001 From: antares-sw <23400824+antares-sw@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:11:56 +0300 Subject: [PATCH] Update metrics config for w3s validators --- charts/web3signer-validators/Chart.yaml | 4 +- .../templates/servicemonitor.yaml | 44 +++++++++++-------- .../templates/statefulset.yaml | 3 ++ .../web3signer-validators/templates/svc.yaml | 14 ++++-- 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/charts/web3signer-validators/Chart.yaml b/charts/web3signer-validators/Chart.yaml index 9c45b7505..6793e919d 100644 --- a/charts/web3signer-validators/Chart.yaml +++ b/charts/web3signer-validators/Chart.yaml @@ -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 diff --git a/charts/web3signer-validators/templates/servicemonitor.yaml b/charts/web3signer-validators/templates/servicemonitor.yaml index 7316d81dc..e9e2aeed0 100644 --- a/charts/web3signer-validators/templates/servicemonitor.yaml +++ b/charts/web3signer-validators/templates/servicemonitor.yaml @@ -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 }} \ No newline at end of file diff --git a/charts/web3signer-validators/templates/statefulset.yaml b/charts/web3signer-validators/templates/statefulset.yaml index 8636e6695..1a82f4b13 100644 --- a/charts/web3signer-validators/templates/statefulset.yaml +++ b/charts/web3signer-validators/templates/statefulset.yaml @@ -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: diff --git a/charts/web3signer-validators/templates/svc.yaml b/charts/web3signer-validators/templates/svc.yaml index 824322a70..ef59ff908 100644 --- a/charts/web3signer-validators/templates/svc.yaml +++ b/charts/web3signer-validators/templates/svc.yaml @@ -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 }} \ No newline at end of file