diff --git a/charts/meilisearch/Chart.yaml b/charts/meilisearch/Chart.yaml index 5e27bec..85f52fd 100644 --- a/charts/meilisearch/Chart.yaml +++ b/charts/meilisearch/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: "v1.2.0" description: A Helm chart for the Meilisearch search engine name: meilisearch -version: 0.2.0 +version: 0.2.1 icon: https://res.cloudinary.com/meilisearch/image/upload/v1597822872/Logo/logo_img.svg home: https://github.com/meilisearch/meilisearch-kubernetes/tree/main/charts/meilisearch maintainers: diff --git a/charts/meilisearch/README.md b/charts/meilisearch/README.md index bdec0cc..64c09c4 100644 --- a/charts/meilisearch/README.md +++ b/charts/meilisearch/README.md @@ -2,7 +2,7 @@ A Helm chart for the Meilisearch search engine -![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![AppVersion: v1.2.0](https://img.shields.io/badge/AppVersion-v1.2.0-informational?style=flat-square) +![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![AppVersion: v1.2.0](https://img.shields.io/badge/AppVersion-v1.2.0-informational?style=flat-square) Helm works as a package manager to run pre-configured Kubernetes resources. @@ -106,6 +106,15 @@ You can also use `auth.existingMasterKeySecret` to use an existing secret that h | serviceAccount.annotations | object | `{}` | Additional annotations for created service account | | serviceAccount.create | bool | `true` | Should this chart create a service account | | serviceAccount.name | string | `""` | Custom service account name, if not created by this chart | +| serviceMonitor | object | `{"additionalLabels":{},"enabled":false,"interval":"1m","metricRelabelings":[],"relabelings":[],"scrapeTimeout":"10s","targetLabels":[],"telemetryPath":"/metrics"}` | Monitoring with Prometheus Operator | +| serviceMonitor.additionalLabels | object | `{}` | Set of labels to transfer from the Kubernetes Service onto the target | +| serviceMonitor.enabled | bool | `false` | Enable ServiceMonitor to configure scraping | +| serviceMonitor.interval | string | `"1m"` | Set scraping frequency | +| serviceMonitor.metricRelabelings | list | `[]` | MetricRelabelConfigs to apply to samples before ingestion | +| serviceMonitor.relabelings | list | `[]` | Set relabel_configs as per https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config | +| serviceMonitor.scrapeTimeout | string | `"10s"` | Set scraping timeout | +| serviceMonitor.targetLabels | list | `[]` | Set of labels to transfer from the Kubernetes Service onto the target | +| serviceMonitor.telemetryPath | string | `"/metrics"` | Set path to metrics | | startupProbe.InitialDelaySeconds | int | `1` | | | startupProbe.failureThreshold | int | `60` | | | startupProbe.periodSeconds | int | `1` | | diff --git a/charts/meilisearch/templates/configmap.yaml b/charts/meilisearch/templates/configmap.yaml index 9bf9871..c8f7bcd 100644 --- a/charts/meilisearch/templates/configmap.yaml +++ b/charts/meilisearch/templates/configmap.yaml @@ -6,5 +6,8 @@ metadata: {{- include "meilisearch.labels" . | nindent 4 }} data: {{- range $key, $value := .Values.environment }} - {{ $key }}: {{ $value | quote}} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if $.Values.serviceMonitor.enabled }} + MEILI_EXPERIMENTAL_ENABLE_METRICS: "true" {{- end }} diff --git a/charts/meilisearch/templates/serviceMonitor.yaml b/charts/meilisearch/templates/serviceMonitor.yaml new file mode 100644 index 0000000..3036ecf --- /dev/null +++ b/charts/meilisearch/templates/serviceMonitor.yaml @@ -0,0 +1,47 @@ +{{- if.Values.serviceMonitor.enabled -}} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "meilisearch.fullname" . }} + labels: + {{- include "meilisearch.labels" . | nindent 4 }} + {{- with .Values.serviceMonitor.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + jobLabel: {{ .Release.Name }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: + {{- include "meilisearch.selectorLabels" . | nindent 6 }} + endpoints: + - port: http + path: {{ .Values.serviceMonitor.telemetryPath }} + {{- with .Values.serviceMonitor.interval }} + interval: {{ . }} + {{- end }} + {{- with .Values.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} + {{- if .Values.serviceMonitor.metricRelabelings }} + metricRelabelings: + {{ toYaml .Values.serviceMonitor.metricRelabelings | indent 4 }} + {{- end }} + {{- if .Values.serviceMonitor.relabelings }} + relabelings: + {{ toYaml .Values.serviceMonitor.relabelings | nindent 4 }} + {{- end }} + {{- if or (.Values.environment.MEILI_MASTER_KEY) (.Values.auth.existingMasterKeySecret) (eq .Values.environment.MEILI_ENV "production") }} + - bearerTokenSecret: + name: meilisearch-master-key + key: MEILI_MASTER_KEY + {{- end }} + {{- if .Values.serviceMonitor.targetLabels }} + targetLabels: + {{- range .Values.serviceMonitor.targetLabels }} + - {{ . }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/meilisearch/values.yaml b/charts/meilisearch/values.yaml index 8c2793f..c285fe0 100644 --- a/charts/meilisearch/values.yaml +++ b/charts/meilisearch/values.yaml @@ -175,3 +175,22 @@ affinity: {} # -- Pod command command: [] + +# -- Monitoring with Prometheus Operator +serviceMonitor: + # -- Enable ServiceMonitor to configure scraping + enabled: false + # -- Set of labels to transfer from the Kubernetes Service onto the target + additionalLabels: {} + # -- Set scraping frequency + interval: 1m + # -- Set scraping timeout + scrapeTimeout: 10s + # -- Set path to metrics + telemetryPath: /metrics + # -- Set of labels to transfer from the Kubernetes Service onto the target + targetLabels: [] + # -- MetricRelabelConfigs to apply to samples before ingestion + metricRelabelings: [] + # -- Set relabel_configs as per https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config + relabelings: [] diff --git a/manifests/meilisearch.yaml b/manifests/meilisearch.yaml index a25d845..c237ae6 100644 --- a/manifests/meilisearch.yaml +++ b/manifests/meilisearch.yaml @@ -75,7 +75,7 @@ spec: app.kubernetes.io/component: search-engine app.kubernetes.io/part-of: meilisearch annotations: - checksum/config: 2feedcfe9e2a9425200a2c547238c64e882bd9160bf3a521e1dbab0e83ee246f + checksum/config: 502c6defe0f829ec66f986679faf8ae9ac5866ca466c25a16b5c2be368015508 spec: serviceAccountName: meilisearch securityContext: