From f6f323b83ef81c117e9f94040e9cd13b3513fa86 Mon Sep 17 00:00:00 2001 From: jfcmartins Date: Wed, 13 Dec 2023 15:17:36 -0300 Subject: [PATCH 1/3] Add ability to template ServiceMonitor labels and add metrics port to Service --- weaviate/Chart.yaml | 2 +- weaviate/templates/weaviateService.yaml | 7 ++++++- weaviate/templates/weaviateServiceMonitor.yaml | 3 +++ weaviate/values.yaml | 4 +++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/weaviate/Chart.yaml b/weaviate/Chart.yaml index cd7b8b34..d97853d9 100644 --- a/weaviate/Chart.yaml +++ b/weaviate/Chart.yaml @@ -7,7 +7,7 @@ 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: 16.8.0 +version: 16.9.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 diff --git a/weaviate/templates/weaviateService.yaml b/weaviate/templates/weaviateService.yaml index ea9ab570..0ed6a068 100644 --- a/weaviate/templates/weaviateService.yaml +++ b/weaviate/templates/weaviateService.yaml @@ -15,8 +15,13 @@ spec: ports: {{- range .Values.service.ports }} - {{ toYaml . | indent 6 | trim }} - targetPort: 8080 {{- end }} +{{- if .Values.serviceMonitor.enabled }} + - name: metrics + protocol: TCP + port: {{ .Values.env.PROMETHEUS_MONITORING_PORT }} + targetPort: {{ .Values.env.PROMETHEUS_MONITORING_PORT }} +{{ end }} {{ if eq .Values.service.type "ClusterIP" -}} {{ if .Values.service.clusterIP }} clusterIP: {{ .Values.service.clusterIP }} diff --git a/weaviate/templates/weaviateServiceMonitor.yaml b/weaviate/templates/weaviateServiceMonitor.yaml index 2177250c..11a925de 100644 --- a/weaviate/templates/weaviateServiceMonitor.yaml +++ b/weaviate/templates/weaviateServiceMonitor.yaml @@ -8,6 +8,9 @@ metadata: app: weaviate app.kubernetes.io/name: weaviate app.kubernetes.io/managed-by: helm +{{- if .Values.serviceMonitor.additionalLabels }} + {{- toYaml .Values.serviceMonitor.additionalLabels | nindent 4 }} +{{- end }} spec: jobLabel: weaviate selector: diff --git a/weaviate/values.yaml b/weaviate/values.yaml index 9d6145b4..233b226a 100644 --- a/weaviate/values.yaml +++ b/weaviate/values.yaml @@ -106,7 +106,7 @@ service: - name: http protocol: TCP port: 80 - # Target port is going to be the same for every port + targetPort: 8080 type: LoadBalancer loadBalancerSourceRanges: [] # optionally set cluster IP if you want to set a static IP @@ -137,6 +137,7 @@ serviceMonitor: enabled: false interval: 30s scrapeTimeout: 10s + additionalLabels: {} # Adjust liveness, readiness and startup probes configuration startupProbe: @@ -229,6 +230,7 @@ env: # Expose metrics on port 2112 for Prometheus to scrape PROMETHEUS_MONITORING_ENABLED: false PROMETHEUS_MONITORING_GROUP: false + PROMETHEUS_MONITORING_PORT: 2112 # Set a MEM limit for the Weaviate Pod so it can help you both increase GC-related # performance as well as avoid GC-related out-of-memory (“OOM”) situations From e5b2da1a2f46bf303be16d62db7c896ca8e4fca5 Mon Sep 17 00:00:00 2001 From: jfcmartins Date: Sat, 1 Nov 2025 11:48:38 +0000 Subject: [PATCH 2/3] Update Statefulset containerport with prom monitor port env var --- weaviate/templates/weaviateStatefulset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weaviate/templates/weaviateStatefulset.yaml b/weaviate/templates/weaviateStatefulset.yaml index c785ffa9..2294f524 100644 --- a/weaviate/templates/weaviateStatefulset.yaml +++ b/weaviate/templates/weaviateStatefulset.yaml @@ -484,7 +484,7 @@ spec: - containerPort: 8080 {{- if .Values.env.PROMETHEUS_MONITORING_ENABLED }} - name: metrics - containerPort: 2112 + containerPort: {{ .Values.env.PROMETHEUS_MONITORING_PORT }} protocol: TCP {{- end }} {{ if .Values.grpcService.enabled }} From e1bc49240fed7e2ccaf2c3f66ba7cb443ae0a09a Mon Sep 17 00:00:00 2001 From: jfcmartins Date: Sat, 1 Nov 2025 11:56:47 +0000 Subject: [PATCH 3/3] Fix Helm indentation --- weaviate/templates/weaviateService.yaml | 4 ++-- weaviate/templates/weaviateServiceMonitor.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/weaviate/templates/weaviateService.yaml b/weaviate/templates/weaviateService.yaml index 7427d503..ea940d5e 100644 --- a/weaviate/templates/weaviateService.yaml +++ b/weaviate/templates/weaviateService.yaml @@ -19,12 +19,12 @@ spec: {{- range .Values.service.ports }} - {{ toYaml . | indent 6 | trim }} {{- end }} -{{- if .Values.serviceMonitor.enabled }} + {{- if .Values.serviceMonitor.enabled }} - name: metrics protocol: TCP port: {{ .Values.env.PROMETHEUS_MONITORING_PORT }} targetPort: {{ .Values.env.PROMETHEUS_MONITORING_PORT }} -{{ end }} + {{ end }} {{ if eq .Values.service.type "ClusterIP" -}} {{ if .Values.service.clusterIP }} clusterIP: {{ .Values.service.clusterIP }} diff --git a/weaviate/templates/weaviateServiceMonitor.yaml b/weaviate/templates/weaviateServiceMonitor.yaml index d7d8ac66..f9147091 100644 --- a/weaviate/templates/weaviateServiceMonitor.yaml +++ b/weaviate/templates/weaviateServiceMonitor.yaml @@ -8,9 +8,9 @@ metadata: app: weaviate app.kubernetes.io/name: weaviate app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- if .Values.serviceMonitor.additionalLabels }} + {{- if .Values.serviceMonitor.additionalLabels }} {{- toYaml .Values.serviceMonitor.additionalLabels | nindent 4 }} -{{- end }} + {{- end }} spec: jobLabel: weaviate selector: