Skip to content

[chart/redis-ha][BUG] Duplicate secret in Service Account manifest if same existing secret used for Redis and Sentinel #363

@Magnus010

Description

@Magnus010

Describe the bug
When defining the same existingSecret key for both Redis and Sentinel, the Service Account template will create two lines with the same existingSecret name.

To Reproduce
Use the same existingSecret for Redis and Sentinel. Helm will template the file with no issues, but the dry run against our Rancher cluster shows an error.

Expected behavior
I expected the Service Account manifest to not generate duplicate lines in the secrets key.

Additional context
I believe a preceding if statement that checks if both auth and sentinel auth are true, as well as a check to see if the two names are the same could resolve it. Something like this:

{{- if and (and (.Values.auth) (.Values.sentinel.auth)) (eq (.Values.existingSecret) (.Values.sentinel.existingSecret)) }}
- name: {{ default (include "redis-ha.fullname" .) (tpl (.Values.existingSecret | default "" ) . ) }}
{{- else }}
{{- if .Values.auth }}
- name: {{ default (include "redis-ha.fullname" .) (tpl (.Values.existingSecret | default "" ) . ) }}
{{- end }}
{{- if .Values.sentinel.auth }}
- name: {{ default (printf "%s-sentinel" (include "redis-ha.fullname" .)) (tpl (.Values.sentinel.existingSecret | default "" ) . ) }}
{{- end }}
{{- end }}

Updating the Service Account manifest (https://github.com/DandyDeveloper/charts/blob/master/charts/redis-ha/templates/redis-ha-serviceaccount.yaml#L22) with the above resolves the issue in our test Rancher cluster.

Thank you!

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions