Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/meilisearch/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "v1.2.0"
description: A Helm chart for the Meilisearch search engine
name: meilisearch
version: 0.1.53
version: 0.1.54
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:
Expand Down
15 changes: 15 additions & 0 deletions charts/meilisearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ helm uninstall <your-service-name>
| | |
| `affinity` | Affinity for pod assignment | `{}`
| | |
| `serviceMonitor.enabled` | When set true then use a ServiceMonitor to configure scraping | `true`
| | |
| `serviceMonitor.additionalLabels` | Set of labels to transfer from the Kubernetes Service onto the target | `{}`
| | |
| `serviceMonitor.interval` | Set how frequently Prometheus should scrape | `"1m"`
| | |
| `serviceMonitor.metricRelabelings` | MetricRelabelConfigs to apply to samples before ingestion | `[]`
| | |
| `serviceMonitor.relabelings` | Set relabel_configs as per https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config | `[]`
| | |
| `serviceMonitor.scrapeTimeout` | Set timeout for scrape | `"10s"`
| | |
| `serviceMonitor.targetLabels` | Set of labels to transfer from the Kubernetes Service onto the target | `[]`
| | |
| `serviceMonitor.telemetryPath` | Set path to metrics path | `"/metrics"`


### Environment
Expand Down
42 changes: 42 additions & 0 deletions charts/meilisearch/templates/serviceMonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested this myself yet, but I was looking at adding a ServiceMonitor to my deployment, and I think you'd need something like this to support authentication, right?

  endpoints:
    - bearerTokenSecret:
        name: meilisearch-master-key
        key: MEILI_MASTER_KEY
...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mike-stewart,
You're absolutely right thanks! I'll add it to the PR as well as the flag for activated analytics.

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 .Values.serviceMonitor.targetLabels }}
targetLabels:
{{- range .Values.serviceMonitor.targetLabels }}
- {{ . }}
{{- end }}
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/meilisearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,22 @@ tolerations: []
affinity: {}

command: []

# -- Enable this to use with Prometheus Operator
serviceMonitor:
# -- When set true then use a ServiceMonitor to configure scraping
enabled: false
# -- Set of labels to transfer from the Kubernetes Service onto the target
additionalLabels: {}
# -- Set how frequently Prometheus should scrape
interval: 1m
# -- Set timeout for scrape
scrapeTimeout: 10s
# -- Set path to metrics path
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: []