oauth2-proxy/manifests

redis.existingSecret doesn't take effect when redis.password is set to empty string

Closed this issue · 2 comments

coy2k commented

Can't use an existingSecret for redis session storage in order to set OAUTH2_PROXY_REDIS_PASSWORD when the password has a empty string assigned.

Doesn't work:

# values.yaml
...
sessionStorage:
  type: redis
  redis:
    existingSecret: oauth2-proxy-redis-access
    password: ""
...

Works:

# values.yaml
...
sessionStorage:
  type: redis
  redis:
    existingSecret: oauth2-proxy-redis-access
    password: someValue
...

Fix suggestion:

# templates/deployment.yaml
...
        {{- if or .Values.sessionStorage.redis.password .Values.sessionStorage.redis.existingSecret }}
        - name: OAUTH2_PROXY_REDIS_PASSWORD
          valueFrom:
            secretKeyRef:
              name: {{ if .Values.sessionStorage.redis.existingSecret }} {{ .Values.sessionStorage.redis.existingSecret }}{{ else }} {{ template "oauth2-proxy.fullname" . }}-redis-access{{ end }}
              key: redis-password
        {{- end }}
...

@coy2k could you please open a PR to propose your solution?

I just discovered the same and was about to open an issue for my PR. I am using this issue instead.