Skip to content

Commit 078bcf9

Browse files
authored
chore: update exporter for falkordb (#2291)
Co-authored-by: shanshanying <shanshanying@users.noreply.github.com>
1 parent 973e6c0 commit 078bcf9

File tree

10 files changed

+30
-142
lines changed

10 files changed

+30
-142
lines changed

addons/falkordb/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ When the cluster is running, each POD should have a sidecar container, named `me
10841084
You can retrieve the `scrapePath` and `scrapePort` from pod's exporter container.
10851085

10861086
```bash
1087-
get po falkordb-replication-falkordb-0 -oyaml | yq '.spec.containers[] | select(.name=="metrics") | .ports'
1087+
kubectl get po falkordb-replication-falkordb-0 -oyaml | yq '.spec.containers[] | select(.name=="metrics") | .ports'
10881088
```
10891089

10901090
And the expected output is like:
@@ -1154,7 +1154,6 @@ spec:
11541154
- demo
11551155
selector:
11561156
matchLabels:
1157-
app.kubernetes.io/instance: falkordb-replication
11581157
apps.kubeblocks.io/component-name: falkordb
11591158
```
11601159
@@ -1166,7 +1165,7 @@ kubectl apply -f examples/falkordb/pod-monitor.yaml
11661165

11671166
Login to the Grafana dashboard and import the dashboard.
11681167

1169-
There is a pre-configured dashboard for PostgreSQL under the `FalkorDB` folder in the Grafana dashboard. And more dashboards can be found in the Grafana dashboard store[^5].
1168+
The `redis_exporter` used here is provided by [redis_exporter](https://github.com/oliver006/redis_exporter)[^3], and more dashboards can be found in the Grafana dashboard store[^2].
11701169

11711170
> [!NOTE]
11721171
> Make sure the labels are set correctly in the `PodMonitor` file to match the dashboard.
@@ -1490,4 +1489,5 @@ spec:
14901489
## Reference
14911490
14921491
[^1]: Sentinel: <https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/>
1493-
[^5]: Grafana Dashboard Store: <https://grafana.com/grafana/dashboards/>
1492+
[^2]: Grafana Dashboard Store: <https://grafana.com/grafana/dashboards/>
1493+
[^3]: Redis Exporter Metrics: <https://github.com/oliver006/redis_exporter>

addons/falkordb/templates/_helpers.tpl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,6 @@ Define falkordb cluster component script template name
105105
falkordb-cluster-scripts-template-{{ .Chart.Version }}
106106
{{- end -}}
107107

108-
{{/*
109-
Define falkordb metrics config name
110-
*/}}
111-
{{- define "falkordb.metricsConfiguration" -}}
112-
falkordb-metrics-config
113-
{{- end -}}
114-
115108
{{- define "falkordb4.image" -}}
116109
{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag.major4.minor12 }}
117110
{{- end }}

addons/falkordb/templates/cmpd-falkordb-cluster.yaml

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ spec:
7575
namespace: {{ $.Release.Namespace }}
7676
volumeName: falkordb-cluster-config
7777
externalManaged: true
78-
- name: falkordb-metrics-config
79-
template: {{ include "falkordb.metricsConfiguration" $ }}
80-
namespace: {{ $.Release.Namespace }}
81-
volumeName: falkordb-metrics-config
82-
defaultMode: 0444
8378
scripts:
8479
- name: falkordb-cluster-scripts
8580
template: {{ include "falkordbCluster.scriptsTemplate" $ }}
@@ -106,7 +101,6 @@ spec:
106101
- container: metrics
107102
ports:
108103
- http-metrics
109-
- server-metrics
110104
{{- end }}
111105
vars:
112106
## the name of current cluster instance
@@ -356,19 +350,6 @@ spec:
356350
- name: REDIS_METRICS_HTTP_PORT
357351
value: "9121"
358352
expression: {{ `{{if ne (index . "REDIS_METRICS_HOST_NETWORK_PORT") ""}}{{.REDIS_METRICS_HOST_NETWORK_PORT}}{{else}}{{.REDIS_METRICS_HTTP_PORT}}{{end}}` | toYaml }}
359-
## the falkordb server metrics container host network server port when using host network mode, the port will be allocated automatically by KubeBlocks
360-
- name: REDIS_METRICS_HOST_NETWORK_SERVER_PORT
361-
valueFrom:
362-
hostNetworkVarRef:
363-
optional: true
364-
container:
365-
name: metrics
366-
port:
367-
name: server-metrics
368-
option: Required
369-
- name: REDIS_METRICS_SERVER_PORT
370-
value: "8888"
371-
expression: {{ `{{if ne (index . "REDIS_METRICS_HOST_NETWORK_SERVER_PORT") ""}}{{.REDIS_METRICS_HOST_NETWORK_SERVER_PORT}}{{else}}{{.REDIS_METRICS_SERVER_PORT}}{{end}}` | toYaml }}
372353
## the falkordb cluster host network port list for all shard pods, the all pods in same shard has the same host network port allocated automatically by KubeBlocks.
373354
## the value format is like "shard-chg:1057,shard-khh:1056,shard-mpg:1053"
374355
- name: REDIS_CLUSTER_ALL_SHARDS_HOST_NETWORK_PORT
@@ -566,29 +547,21 @@ spec:
566547
- name: metrics
567548
imagePullPolicy: {{ $.Values.metrics.image.pullPolicy | quote }}
568549
securityContext:
569-
runAsNonRoot: true
570-
runAsUser: 1001
550+
runAsUser: 59000
551+
runAsGroup: 59000
552+
allowPrivilegeEscalation: false
553+
capabilities:
554+
drop:
555+
- ALL
571556
env:
572-
- name: ENDPOINT
557+
- name: REDIS_ADDR
573558
value: "localhost:$(SERVICE_PORT)"
574-
- name: METRICS_HTTP_PORT
575-
value: $(REDIS_METRICS_HTTP_PORT)
576-
- name: METRICS_SERVER_PORT
577-
value: $(REDIS_METRICS_SERVER_PORT)
578559
- name: REDIS_USER
579560
value: $(REDIS_DEFAULT_USER)
580561
- name: REDIS_PASSWORD
581562
value: $(REDIS_DEFAULT_PASSWORD)
582-
command:
583-
- "/bin/agamotto"
584-
- "--config=/opt/conf/metrics-config.yaml"
585563
ports:
586564
- name: http-metrics
587-
containerPort: {{ $.Values.metrics.service.port }}
588-
- name: server-metrics
589-
containerPort: {{ $.Values.metrics.service.serverPort }}
590-
volumeMounts:
591-
- name: falkordb-metrics-config
592-
mountPath: /opt/conf
565+
containerPort: 9121
593566
{{- end }}
594567
{{- end }}

addons/falkordb/templates/cmpd-falkordb.yaml

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ spec:
7575
namespace: {{ $.Release.Namespace }}
7676
volumeName: falkordb-config
7777
externalManaged: true
78-
- name: falkordb-metrics-config
79-
template: {{ include "falkordb.metricsConfiguration" $ }}
80-
namespace: {{ $.Release.Namespace }}
81-
volumeName: falkordb-metrics-config
82-
defaultMode: 0444
8378
scripts:
8479
- name: falkordb-scripts
8580
template: {{ include "falkordb.scriptsTemplate" $ }}
@@ -104,7 +99,6 @@ spec:
10499
- container: metrics
105100
ports:
106101
- http-metrics
107-
- server-metrics
108102
{{- end }}
109103
vars:
110104
## the name of current cluster instance
@@ -224,19 +218,6 @@ spec:
224218
- name: REDIS_METRICS_HTTP_PORT
225219
value: "9121"
226220
expression: {{ `{{if ne (index . "REDIS_METRICS_HOST_NETWORK_PORT") ""}}{{.REDIS_METRICS_HOST_NETWORK_PORT}}{{else}}{{.REDIS_METRICS_HTTP_PORT}}{{end}}` | toYaml }}
227-
## the falkordb server metrics container host network server port when using host network mode, the port will be allocated automatically by KubeBlocks, if not set, the default value is 8888
228-
- name: REDIS_METRICS_HOST_NETWORK_SERVER_PORT
229-
valueFrom:
230-
hostNetworkVarRef:
231-
optional: true
232-
container:
233-
name: metrics
234-
port:
235-
name: server-metrics
236-
option: Required
237-
- name: REDIS_METRICS_SERVER_PORT
238-
value: "8888"
239-
expression: {{ `{{if ne (index . "REDIS_METRICS_HOST_NETWORK_SERVER_PORT") ""}}{{.REDIS_METRICS_HOST_NETWORK_SERVER_PORT}}{{else}}{{.REDIS_METRICS_SERVER_PORT}}{{end}}` | toYaml }}
240221
{{- end }}
241222
## the component name of falkordb sentinel when falkordb sentinel is enabled, it's the fullname of falkordb-sent component
242223
- name: SENTINEL_COMPONENT_NAME
@@ -440,29 +421,21 @@ spec:
440421
- name: metrics
441422
imagePullPolicy: {{ $.Values.metrics.image.pullPolicy | quote }}
442423
securityContext:
443-
runAsNonRoot: true
444-
runAsUser: 1001
424+
runAsUser: 59000
425+
runAsGroup: 59000
426+
allowPrivilegeEscalation: false
427+
capabilities:
428+
drop:
429+
- ALL
445430
env:
446-
- name: ENDPOINT
431+
- name: REDIS_ADDR
447432
value: "localhost:$(SERVICE_PORT)"
448-
- name: METRICS_HTTP_PORT
449-
value: $(REDIS_METRICS_HTTP_PORT)
450-
- name: METRICS_SERVER_PORT
451-
value: $(REDIS_METRICS_SERVER_PORT)
452433
- name: REDIS_USER
453434
value: $(REDIS_DEFAULT_USER)
454435
- name: REDIS_PASSWORD
455436
value: $(REDIS_DEFAULT_PASSWORD)
456-
command:
457-
- "/bin/agamotto"
458-
- "--config=/opt/conf/metrics-config.yaml"
459437
ports:
460438
- name: http-metrics
461-
containerPort: {{ $.Values.metrics.service.port }}
462-
- name: server-metrics
463-
containerPort: {{ $.Values.metrics.service.serverPort }}
464-
volumeMounts:
465-
- name: falkordb-metrics-config
466-
mountPath: /opt/conf
439+
containerPort: 9121
467440
{{- end }}
468441
{{- end }}

addons/falkordb/templates/cmpv-falkordb-cluster.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
switchover: {{ $falkordbRepository }}:{{ .imageTag }}
3131
preTerminate: {{ $falkordbRepository }}:{{ .imageTag }}
3232
memberLeave: {{ $falkordbRepository }}:{{ .imageTag }}
33-
metrics: {{ include "metrics.repository" $ }}:0.1.2-beta.1
33+
metrics: {{ include "metrics.repository" $ }}:{{ $.Values.metrics.image.tag }}
3434
init-dbctl: {{ $.Values.dbctlImage.registry | default ( $.Values.image.registry | default "docker.io" ) }}/{{ $.Values.dbctlImage.repository }}:{{ $.Values.dbctlImage.tag }}
3535
{{- end }}
3636
{{- end }}

addons/falkordb/templates/cmpv-falkordb.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spec:
2525
serviceVersion: {{ .version }}
2626
images:
2727
falkordb: {{ $falkordbRepository }}:{{ .imageTag }}
28-
metrics: {{ include "metrics.repository" $ }}:0.1.2-beta.1
28+
metrics: {{ include "metrics.repository" $ }}:{{ $.Values.metrics.image.tag }}
2929
init-dbctl: {{ $.Values.dbctlImage.registry | default ( $.Values.image.registry | default "docker.io" ) }}/{{ $.Values.dbctlImage.repository }}:{{ $.Values.dbctlImage.tag }}
3030
postProvision: {{ $falkordbRepository }}:{{ .imageTag }}
3131
accountProvision: {{ $falkordbRepository }}:{{ .imageTag }}

addons/falkordb/templates/metrics-configmap.yaml

Lines changed: 0 additions & 51 deletions
This file was deleted.

addons/falkordb/values.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ busyboxImage:
6161
metrics:
6262
image:
6363
# if the value of metrics.image.registry is not specified using `--set`, it will be set to the value of 'image.registry' by default
64-
registry: ""
65-
repository: apecloud/agamotto
66-
tag: 0.1.2-beta.1
64+
registry: docker.io
65+
repository: oliver006/redis_exporter
66+
tag: v1.80.0
6767
pullPolicy: IfNotPresent
6868
service:
6969
port: 9121
@@ -78,4 +78,4 @@ logConfigs:
7878
# cluster domain without . prefix
7979
clusterDomain: "cluster.local"
8080

81-
enableMetrics: false
81+
enableMetrics: true

examples/falkordb/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ When the cluster is running, each POD should have a sidecar container, named `me
570570
You can retrieve the `scrapePath` and `scrapePort` from pod's exporter container.
571571

572572
```bash
573-
get po falkordb-replication-falkordb-0 -oyaml | yq '.spec.containers[] | select(.name=="metrics") | .ports'
573+
kubectl get po falkordb-replication-falkordb-0 -oyaml | yq '.spec.containers[] | select(.name=="metrics") | .ports'
574574
```
575575

576576
And the expected output is like:
@@ -619,7 +619,7 @@ kubectl apply -f examples/falkordb/pod-monitor.yaml
619619

620620
Login to the Grafana dashboard and import the dashboard.
621621

622-
There is a pre-configured dashboard for PostgreSQL under the `FalkorDB` folder in the Grafana dashboard. And more dashboards can be found in the Grafana dashboard store[^5].
622+
The `redis_exporter` used here is provided by [redis_exporter](https://github.com/oliver006/redis_exporter)[^3], and more dashboards can be found in the Grafana dashboard store[^2].
623623

624624
> [!NOTE]
625625
> Make sure the labels are set correctly in the `PodMonitor` file to match the dashboard.
@@ -777,4 +777,5 @@ spec:
777777
## Reference
778778
779779
[^1]: Sentinel: <https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/>
780-
[^5]: Grafana Dashboard Store: <https://grafana.com/grafana/dashboards/>
780+
[^2]: Grafana Dashboard Store: <https://grafana.com/grafana/dashboards/>
781+
[^3]: Redis Exporter Metrics: <https://github.com/oliver006/redis_exporter>

examples/falkordb/pod-monitor.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ spec:
2525
- demo
2626
selector:
2727
matchLabels:
28-
app.kubernetes.io/instance: falkordb-replication
2928
apps.kubeblocks.io/component-name: falkordb

0 commit comments

Comments
 (0)