From 63a5514b29d44520058260cfb64c9fbf256e366a Mon Sep 17 00:00:00 2001
From: Alex Nordlund <deep.alexander@gmail.com>
Date: Thu, 25 Aug 2022 04:39:11 +0200
Subject: [PATCH] Allow S3 to use an existing secret (#18997)

---
 chart/templates/deployment-web.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/chart/templates/deployment-web.yaml b/chart/templates/deployment-web.yaml
index 5e22ca5393..ab722c77b1 100644
--- a/chart/templates/deployment-web.yaml
+++ b/chart/templates/deployment-web.yaml
@@ -70,6 +70,18 @@ spec:
                   key: redis-password
             - name: "PORT"
               value: {{ .Values.mastodon.web.port | quote }}
+            {{- if (and .Values.mastodon.s3.enabled .Values.mastodon.s3.existingSecret) }}
+            - name: "AWS_SECRET_ACCESS_KEY"
+              valueFrom:
+                secretKeyRef:
+                  name: {{ .Values.mastodon.s3.existingSecret }}
+                  key: AWS_SECRET_ACCESS_KEY
+            - name: "AWS_ACCESS_KEY_ID"
+              valueFrom:
+                secretKeyRef:
+                  name: {{ .Values.mastodon.s3.existingSecret }}
+                  key: AWS_ACCESS_KEY_ID
+            {{- end -}}
           {{- if (not .Values.mastodon.s3.enabled) }}
           volumeMounts:
             - name: assets
-- 
GitLab