diff --git a/helm-charts/common/data-prep/README.md b/helm-charts/common/data-prep/README.md index 4a05e2f34..ca7e2a9f8 100644 --- a/helm-charts/common/data-prep/README.md +++ b/helm-charts/common/data-prep/README.md @@ -46,12 +46,13 @@ curl http://localhost:6007/v1/dataprep \ ## Values -| Key | Type | Default | Description | -| ---------------------- | ------ | ----------------------- | ----------- | -| image.repository | string | `"opea/dataprep-redis"` | | -| service.port | string | `"6007"` | | -| REDIS_URL | string | `""` | | -| TEI_EMBEDDING_ENDPOINT | string | `""` | | +| Key | Type | Default | Description | +| ---------------------- | ------ | ----------------------- | ---------------------------------------- | +| image.repository | string | `"opea/dataprep-redis"` | | +| service.port | string | `"6007"` | | +| REDIS_URL | string | `""` | | +| TEI_EMBEDDING_ENDPOINT | string | `""` | | +| global.monitoring | bool | `false` | See ../../monitoring.md before enabling! | ## Milvus support diff --git a/helm-charts/common/data-prep/templates/servicemonitor.yaml b/helm-charts/common/data-prep/templates/servicemonitor.yaml new file mode 100644 index 000000000..9afc9ec24 --- /dev/null +++ b/helm-charts/common/data-prep/templates/servicemonitor.yaml @@ -0,0 +1,18 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +{{- if .Values.global.monitoring }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "data-prep.fullname" . }} + labels: + release: {{ .Values.global.prometheusRelease }} +spec: + selector: + matchLabels: + {{- include "data-prep.selectorLabels" . | nindent 6 }} + endpoints: + - port: data-prep + interval: 5s +{{- end }} diff --git a/helm-charts/common/data-prep/values.yaml b/helm-charts/common/data-prep/values.yaml index a8f1327c1..9073ca606 100644 --- a/helm-charts/common/data-prep/values.yaml +++ b/helm-charts/common/data-prep/values.yaml @@ -128,3 +128,9 @@ global: # If set, it will overwrite serviceAccount.name. # If set, and serviceAccount.create is false, it will assume this service account is already created by others. sharedSAName: "" + + # Install Prometheus serviceMonitors for service components + monitoring: false + + # Prometheus Helm install release name needed for serviceMonitors + prometheusRelease: prometheus-stack diff --git a/helm-charts/docsum/templates/m2t.yaml b/helm-charts/docsum/templates/m2t.yaml index 897dabf88..583156e22 100644 --- a/helm-charts/docsum/templates/m2t.yaml +++ b/helm-charts/docsum/templates/m2t.yaml @@ -85,6 +85,7 @@ metadata: name: {{ .Release.Name }}-m2t labels: {{- include "docsum.labels" . | nindent 4 }} + app: {{ .Release.Name }}-m2t spec: type: {{ .Values.m2t.service.type }} ports: @@ -95,3 +96,20 @@ spec: selector: {{- include "docsum.selectorLabels" . | nindent 4 }} app: {{ .Release.Name }}-m2t +--- +{{- if .Values.global.monitoring }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "docsum.fullname" . }}-m2t + labels: + release: {{ .Values.global.prometheusRelease }} +spec: + selector: + matchLabels: + {{- include "docsum.selectorLabels" . | nindent 6 }} + app: {{ .Release.Name }}-m2t + endpoints: + - port: m2t + interval: 5s +{{- end }} diff --git a/helm-charts/docsum/templates/v2a.yaml b/helm-charts/docsum/templates/v2a.yaml index db192bfdc..9057f415d 100644 --- a/helm-charts/docsum/templates/v2a.yaml +++ b/helm-charts/docsum/templates/v2a.yaml @@ -80,6 +80,7 @@ metadata: name: {{ .Release.Name }}-v2a labels: {{- include "docsum.labels" . | nindent 4 }} + app: {{ .Release.Name }}-v2a spec: type: {{ .Values.v2a.service.type }} ports: @@ -90,3 +91,20 @@ spec: selector: {{- include "docsum.selectorLabels" . | nindent 4 }} app: {{ .Release.Name }}-v2a +--- +{{- if .Values.global.monitoring }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "docsum.fullname" . }}-v2a + labels: + release: {{ .Values.global.prometheusRelease }} +spec: + selector: + matchLabels: + {{- include "docsum.selectorLabels" . | nindent 6 }} + app: {{ .Release.Name }}-v2a + endpoints: + - port: v2a + interval: 5s +{{- end }}