Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 8 additions & 1 deletion deploy/helm/clickhouse-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,14 @@ crdHook:
| serviceMonitor.clickhouseMetrics.metricRelabelings | list | `[]` | |
| serviceMonitor.clickhouseMetrics.relabelings | list | `[]` | |
| serviceMonitor.clickhouseMetrics.scrapeTimeout | string | `""` | |
| serviceMonitor.enabled | bool | `false` | ServiceMonitor Custom resource is created for a [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator) In serviceMonitor will be created two endpoints ch-metrics on port 8888 and op-metrics # 9999. Ypu can specify interval, scrapeTimeout, relabelings, metricRelabelings for each endpoint below |
| serviceMonitor.enabled | bool | `false` | ServiceMonitor Custom resource is created for a [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator) In serviceMonitor will be created two endpoints ch-metrics on port 8888 and op-metrics # 9999 and separate ServiceMonitor for keeper-metrics. You can specify interval, scrapeTimeout, relabelings, metricRelabelings for each endpoint below |
| serviceMonitor.keeperMetrics.enabled | bool | `true` | create separate ServiceMonitor for scrape native ClickHouse Keeper prometheus endpoint from every keeper service managed by operator (matched by `clickhouse-keeper.altinity.com/app: chop` label). Keeper shall expose prometheus endpoint via `prometheus/*` settings in CHK manifest and named port in serviceTemplate |
| serviceMonitor.keeperMetrics.interval | string | `"30s"` | |
| serviceMonitor.keeperMetrics.metricRelabelings | list | `[]` | |
| serviceMonitor.keeperMetrics.namespaceSelector | object | `{"any":true}` | namespaces where prometheus-operator will discover keeper services, `any: true` means all namespaces |
| serviceMonitor.keeperMetrics.port | string | `"metrics"` | name of the port in keeper Service which expose native keeper prometheus endpoint |
| serviceMonitor.keeperMetrics.relabelings | list | `[]` | |
| serviceMonitor.keeperMetrics.scrapeTimeout | string | `""` | |
| serviceMonitor.operatorMetrics.interval | string | `"30s"` | |
| serviceMonitor.operatorMetrics.metricRelabelings | list | `[]` | |
| serviceMonitor.operatorMetrics.relabelings | list | `[]` | |
Expand Down
36 changes: 36 additions & 0 deletions deploy/helm/clickhouse-operator/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,40 @@ spec:
selector:
matchLabels:
{{- include "altinity-clickhouse-operator.selectorLabels" . | nindent 6 }}
{{- if .Values.serviceMonitor.keeperMetrics.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ printf "%s-keeper-metrics" (include "altinity-clickhouse-operator.fullname" .) }}
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels:
{{- include "altinity-clickhouse-operator.labels" . | nindent 4 }}
{{- if .Values.serviceMonitor.additionalLabels }}
{{- toYaml .Values.serviceMonitor.additionalLabels | nindent 4 }}
{{- end }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
spec:
endpoints:
- port: {{ .Values.serviceMonitor.keeperMetrics.port }} # native keeper prometheus endpoint, requires prometheus/* settings in CHK and `metrics` port in serviceTemplate
{{- with .Values.serviceMonitor.keeperMetrics.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.keeperMetrics.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.keeperMetrics.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.serviceMonitor.keeperMetrics.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
namespaceSelector:
{{- toYaml .Values.serviceMonitor.keeperMetrics.namespaceSelector | nindent 4 }}
selector:
matchLabels:
clickhouse-keeper.altinity.com/app: chop
{{- end }}
{{- end }}
31 changes: 30 additions & 1 deletion deploy/helm/clickhouse-operator/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -979,9 +979,38 @@
}
},
"enabled": {
"description": "ServiceMonitor Custom resource is created for a [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator) In serviceMonitor will be created two endpoints ch-metrics on port 8888 and op-metrics # 9999. Ypu can specify interval, scrapeTimeout, relabelings, metricRelabelings for each endpoint below",
"description": "ServiceMonitor Custom resource is created for a [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator) In serviceMonitor will be created two endpoints ch-metrics on port 8888 and op-metrics # 9999 and separate ServiceMonitor for keeper-metrics. You can specify interval, scrapeTimeout, relabelings, metricRelabelings for each endpoint below",
"type": "boolean"
},
"keeperMetrics": {
"type": "object",
"properties": {
"enabled": {
"description": "create separate ServiceMonitor for scrape native ClickHouse Keeper prometheus endpoint from every keeper service managed by operator (matched by `clickhouse-keeper.altinity.com/app: chop` label). Keeper shall expose prometheus endpoint via `prometheus/*` settings in CHK manifest and named port in serviceTemplate",
"type": "boolean"
},
"interval": {
"type": "string"
},
"metricRelabelings": {
"type": "array"
},
"namespaceSelector": {
"description": "namespaces where prometheus-operator will discover keeper services, `any: true` means all namespaces",
"type": "object"
},
"port": {
"description": "name of the port in keeper Service which expose native keeper prometheus endpoint",
"type": "string"
},
"relabelings": {
"type": "array"
},
"scrapeTimeout": {
"type": "string"
}
}
},
"operatorMetrics": {
"type": "object",
"properties": {
Expand Down
18 changes: 17 additions & 1 deletion deploy/helm/clickhouse-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ podSecurityContext: {}
topologySpreadConstraints: []
serviceMonitor:
# serviceMonitor.enabled -- ServiceMonitor Custom resource is created for a [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator)
# In serviceMonitor will be created two endpoints ch-metrics on port 8888 and op-metrics # 9999. Ypu can specify interval, scrapeTimeout, relabelings, metricRelabelings for each endpoint below
# In serviceMonitor will be created two endpoints ch-metrics on port 8888 and op-metrics # 9999 and separate ServiceMonitor for keeper-metrics. You can specify interval, scrapeTimeout, relabelings, metricRelabelings for each endpoint below
enabled: false
# serviceMonitor.additionalLabels -- additional labels for service monitor
additionalLabels: {}
Expand All @@ -222,6 +222,22 @@ serviceMonitor:
relabelings: []
# serviceMonitor.metricRelabelings for op-metrics endpoint -- Prometheus [MetricRelabelConfigs] to apply to samples before ingestio
metricRelabelings: []
keeperMetrics:
# serviceMonitor.keeperMetrics.enabled -- create separate ServiceMonitor for scrape native ClickHouse Keeper prometheus endpoint from every keeper service managed by operator (matched by `clickhouse-keeper.altinity.com/app: chop` label). Keeper shall expose prometheus endpoint via `prometheus/*` settings in CHK manifest and named port in serviceTemplate
enabled: true
# serviceMonitor.keeperMetrics.port -- name of the port in keeper Service which expose native keeper prometheus endpoint
port: metrics
# serviceMonitor.keeperMetrics.namespaceSelector -- namespaces where prometheus-operator will discover keeper services, `any: true` means all namespaces
namespaceSelector:
any: true
# serviceMonitor.interval for keeper-metrics endpoint --
interval: 30s
# serviceMonitor.scrapeTimeout for keeper-metrics endpoint -- Prometheus ServiceMonitor scrapeTimeout. If empty, Prometheus uses the global scrape timeout unless it is less than the target's scrape interval value in which the latter is used.
scrapeTimeout: ""
# serviceMonitor.relabelings for keeper-metrics endpoint -- Prometheus [RelabelConfigs] to apply to samples before scraping
relabelings: []
# serviceMonitor.metricRelabelings for keeper-metrics endpoint -- Prometheus [MetricRelabelConfigs] to apply to samples before ingestio
metricRelabelings: []
# configs -- clickhouse operator configs
# @default -- check the `values.yaml` file for the config content (auto-generated from latest operator release)
configs:
Expand Down
Loading