Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitnami/redis] Add Redis Sentinel Exporter #4916

Merged
merged 20 commits into from
Mar 31, 2021
Merged

[bitnami/redis] Add Redis Sentinel Exporter #4916

merged 20 commits into from
Mar 31, 2021

Conversation

ricoberger
Copy link
Contributor

Description of the change

Add support to get Prometheus metrics via the Redis Sentinel Exporter. For that the sentinel configuration contains a new section metrics, which adds an additional sidecar with the Redis Sentinel Exporter, when enabled.

Benefits

This allows a user to monitor Redis Sentinel within the Helm chart.

Applicable issues

Additional information

Currently this uses the following image from Docker Hub: https://hub.docker.com/r/leominov/redis_sentinel_exporter. The corresponding GitHub repository can be found here: https://github.com/leominov/redis_sentinel_exporter.

As mentioned by @marcosbc in #4909 let me know when the Bitnami image is ready, so that I can adjust the values file.

Checklist

  • [ x] Chart version bumped in Chart.yaml according to semver.
  • [ x] Variables are documented in the README.md
  • [ x] Title of the PR starts with chart name (e.g. [bitnami/chart])
  • If the chart contains a values-production.yaml apart from values.yaml, ensure that you implement the changes in both files

Add support to get Prometheus metrics via the Redis Sentinel Exporter.
For that the sentinel configuration contains a new section metrics,
which adds an additional sidecar with the Redis Sentinel Exporter, when
enabled.
Copy link
Contributor

@juan131 juan131 left a comment

Choose a reason for hiding this comment

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

Thanks so much for your PR! Please check my comments

bitnami/redis/README.md Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-prometheus.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-svc.yaml Outdated Show resolved Hide resolved
bitnami/redis/values.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-svc.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/redis-node-statefulset.yaml Outdated Show resolved Hide resolved
bitnami/redis/values.yaml Outdated Show resolved Hide resolved
@ricoberger
Copy link
Contributor Author

Hi @juan131, thanks for your fast review, I will adjust the PR.

The Bitnami image isn't available yet. The creation of the image is tracked in #4909 and I would adjust the PR once it is ready.

@juan131
Copy link
Contributor

juan131 commented Jan 11, 2021

The Bitnami image isn't available yet. The creation of the image is tracked in #4909 and I would adjust the PR once it is ready.

Great! Thanks so much

@juan131 juan131 added the on-hold Issues or Pull Requests with this label will never be considered stale label Jan 11, 2021
@github-actions
Copy link

github-actions bot commented Mar 23, 2021

Great PR! Please pay attention to the following items before merging:

Files matching bitnami/*/values.yaml:

  • Is the PR adding a new container? Please reviewer, add it to the models (internal process)
  • Is the PR adding a new parameter? Please, ensure it’s documented in the README.md

This is an automatically generated QA checklist based on modified files

@migruiz4
Copy link
Member

Hi @ricoberger ,

The bitnami/redis-sentinel-exporter image is now ready so we can merge this PR.

@juan131 would you mind re-reviewing it?

@migruiz4 migruiz4 requested a review from juan131 March 23, 2021 16:44
@ricoberger
Copy link
Contributor Author

Hi @ricoberger ,

The bitnami/redis-sentinel-exporter image is now ready so we can merge this PR.

@juan131 would you mind re-reviewing it?

Awesome thank you very much 🙂🎉

Copy link
Contributor

@juan131 juan131 left a comment

Choose a reason for hiding this comment

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

Some minor suggestions

bitnami/redis/README.md Outdated Show resolved Hide resolved
bitnami/redis/README.md Outdated Show resolved Hide resolved
bitnami/redis/README.md Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-prometheus.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-prometheus.yaml Outdated Show resolved Hide resolved
bitnami/redis/values.yaml Show resolved Hide resolved
bitnami/redis/values.yaml Outdated Show resolved Hide resolved
@ricoberger
Copy link
Contributor Author

ricoberger commented Mar 24, 2021

Some minor suggestions

@juan131 thank you, I applied your suggestions.

Edit: Regarding my comment with the port name for the Sentinel Exporter: I would come up with an adjustment in a following PR, because I think this should also be changed for the Redis Exporter, if this is ok.

Copy link
Contributor

@miguelaeh miguelaeh left a comment

Choose a reason for hiding this comment

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

Thank you very much for the PR!

Comment on lines 12 to 18
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- range $key, $value := .Values.sentinel.metrics.serviceMonitor.selector }}
{{ $key }}: {{ $value | quote }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

These are the old labels, please use the common.labels function

Comment on lines 8 to 15
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
app.kubernetes.io/component: "sentinel-metrics"
{{- if .Values.sentinel.metrics.service.labels -}}
{{- toYaml .Values.sentinel.metrics.service.labels | nindent 4 }}
{{- end -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

Comment on lines 33 to 34
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
Copy link
Contributor

Choose a reason for hiding this comment

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

After changing the labels you will need to change the selector as well

bitnami/redis/templates/redis-node-statefulset.yaml Outdated Show resolved Hide resolved
@ricoberger
Copy link
Contributor Author

Thank you very much for the PR!

@miguelaeh before I add your suggestions, I just want to make sure that this is really the way to go, because this would increase the inconsistent in this chart even more.

@migruiz4
Copy link
Member

Hi @miguelaeh ,

In this case I agree with @ricoberger.

Please notice that all the changes you suggested are imported from the metrics (redis-exporter) configuration:

app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- range $key, $value := .Values.metrics.serviceMonitor.selector }}
{{ $key }}: {{ $value | quote }}
{{- end }}

{{- if and .Values.usePassword (not .Values.usePasswordFile) }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redis.secretName" . }}
key: {{ template "redis.secretPasswordKey" . }}
{{- end }}

{{- if .Values.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "redis.fullname" . }}-metrics
namespace: {{ .Release.Namespace | quote }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
app.kubernetes.io/component: "metrics"
{{- if .Values.metrics.service.labels -}}
{{- toYaml .Values.metrics.service.labels | nindent 4 }}
{{- end -}}
{{- if .Values.metrics.service.annotations }}
annotations: {{- toYaml .Values.metrics.service.annotations | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.metrics.service.type }}
{{ if eq .Values.metrics.service.type "LoadBalancer" }}
externalTrafficPolicy: {{ .Values.metrics.service.externalTrafficPolicy }}
{{- end }}
{{ if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }}
{{- end }}
ports:
- name: metrics
port: 9121
targetPort: metrics
selector:
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
{{- end }}

@migruiz4
Copy link
Member

migruiz4 commented Mar 25, 2021

We could adapt those things in this PR, but I'd incline for being consistent at the moment with the content of the chart and then make a second PR to standardize the Redis chart with a major release.

@halradaideh
Copy link

when it is expected to be merged ?

bitnami/redis/values.yaml Outdated Show resolved Hide resolved
bitnami/redis/values.yaml Outdated Show resolved Hide resolved
bitnami/redis/values.yaml Show resolved Hide resolved
bitnami/redis/values.yaml Show resolved Hide resolved
bitnami/redis/templates/redis-node-statefulset.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/redis-node-statefulset.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/redis-node-statefulset.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-svc.yaml Outdated Show resolved Hide resolved
@miguelaeh
Copy link
Contributor

Hi guys, sorry I didn't notice about we were still using the old labels on this chart. I thought we updated them in the last major change. Forget about those labels comments

@ricoberger
Copy link
Contributor Author

@miguelaeh thanks for your review. I applied your suggestions, hopefully I didn't forgot sth.

Copy link
Contributor

@miguelaeh miguelaeh left a comment

Choose a reason for hiding this comment

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

Hi @ricoberger,
I added just some minor comments again, after that it look good to me

bitnami/redis/Chart.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-prometheus.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-prometheus.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-prometheus.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-svc.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-svc.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/metrics-sentinel-svc.yaml Outdated Show resolved Hide resolved
bitnami/redis/templates/redis-node-statefulset.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@miguelaeh miguelaeh left a comment

Choose a reason for hiding this comment

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

LGTM!

@miguelaeh miguelaeh merged commit b27be24 into bitnami:master Mar 31, 2021
miguelaeh added a commit that referenced this pull request Mar 31, 2021
@carrodher carrodher removed the on-hold Issues or Pull Requests with this label will never be considered stale label Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bitnami/redis] Add support for Redis Sentinel metrics
6 participants