{{- range $key, $value := .Values.backup.storages }} {{- if and (hasKey $value "type") (eq $value.type "s3") (hasKey $value "s3") (hasKey (index $value "s3") "credentialsAccessKey") (hasKey (index $value "s3") "credentialsSecretKey") }} --- apiVersion: v1 kind: Secret metadata: name: {{ include "pxc-database.fullname" $ }}-s3-{{ $key }} namespace: {{ $.Release.Namespace }} labels: {{ include "pxc-database.labels" $ | indent 4 }} type: Opaque data: AWS_ACCESS_KEY_ID: {{ index $value "s3" "credentialsAccessKey" | b64enc }} AWS_SECRET_ACCESS_KEY: {{ index $value "s3" "credentialsSecretKey" | b64enc }} {{- end }} {{- end }}