Skip to content

Commit 0db1d41

Browse files
committed
Support GCP JSON Creds
1 parent a2f079b commit 0db1d41

File tree

5 files changed

+75
-5
lines changed

5 files changed

+75
-5
lines changed

charts/s3proxy/override-values.example.yaml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,37 @@ config:
8282
googleCloudStorage:
8383
enabled: false # Set to true to use GCS backend
8484
projectId: "my-project"
85-
privateKey: "-----BEGIN RSA PRIVATE KEY-----\n..."
85+
86+
# Service account email or user email (required for both authentication methods)
8687
clientEmail: "[email protected]"
8788

89+
# Option 1: Using privateKey directly
90+
privateKey: "-----BEGIN RSA PRIVATE KEY-----\n..."
91+
92+
# Option 2: Using JSON credentials file (preferred for GCP)
93+
# This provides the credential (privateKey) via a mounted file
94+
jsonCredentials:
95+
enabled: false # Set to true to use JSON credentials
96+
97+
# Either provide the JSON content directly:
98+
# jsonContent: |
99+
# {
100+
# "type": "service_account",
101+
# "project_id": "my-project",
102+
# "private_key_id": "key-id",
103+
# "private_key": "-----BEGIN RSA PRIVATE KEY-----\n...",
104+
# "client_email": "[email protected]",
105+
# "client_id": "...",
106+
# "auth_uri": "https://accounts.google.com/o/oauth2/auth",
107+
# "token_uri": "https://oauth2.googleapis.com/token",
108+
# "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
109+
# "client_x509_cert_url": "..."
110+
# }
111+
112+
# Or reference an existing secret containing the JSON:
113+
# existingSecret: "my-gcp-credentials-secret"
114+
# secretKey: "credentials.json" # Key in the secret containing the JSON (default: credentials.json)
115+
88116
# Backblaze B2 backend
89117
b2:
90118
enabled: false # Set to true to use B2 backend

charts/s3proxy/templates/deployment.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ spec:
157157
mountPath: {{ .Values.config.backends.filesystem.basedir }}
158158
{{- end }}
159159
{{- end }}
160+
{{- if and .Values.config.backends.googleCloudStorage.enabled .Values.config.backends.googleCloudStorage.jsonCredentials.enabled }}
161+
- name: gcp-json-credentials
162+
mountPath: /gcp-credentials
163+
readOnly: true
164+
{{- end }}
160165
{{- with .Values.extraVolumeMounts }}
161166
{{- toYaml . | nindent 12 }}
162167
{{- end }}
@@ -176,6 +181,15 @@ spec:
176181
claimName: {{ .Values.persistence.existingClaim | default (include "s3proxy.fullname" .) }}
177182
{{- end }}
178183
{{- end }}
184+
{{- if and .Values.config.backends.googleCloudStorage.enabled .Values.config.backends.googleCloudStorage.jsonCredentials.enabled }}
185+
- name: gcp-json-credentials
186+
secret:
187+
{{- if .Values.config.backends.googleCloudStorage.jsonCredentials.jsonContent }}
188+
secretName: {{ include "s3proxy.fullname" . }}-gcp-json
189+
{{- else if .Values.config.backends.googleCloudStorage.jsonCredentials.existingSecret }}
190+
secretName: {{ .Values.config.backends.googleCloudStorage.jsonCredentials.existingSecret }}
191+
{{- end }}
192+
{{- end }}
179193
{{- with .Values.extraVolumes }}
180194
{{- toYaml . | nindent 8 }}
181195
{{- end }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if and .Values.config.backends.googleCloudStorage.enabled .Values.config.backends.googleCloudStorage.jsonCredentials.enabled .Values.config.backends.googleCloudStorage.jsonCredentials.jsonContent }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ include "s3proxy.fullname" . }}-gcp-json
6+
labels:
7+
{{- include "s3proxy.labels" . | nindent 4 }}
8+
type: Opaque
9+
stringData:
10+
{{ .Values.config.backends.googleCloudStorage.jsonCredentials.secretKey }}: |
11+
{{- .Values.config.backends.googleCloudStorage.jsonCredentials.jsonContent | nindent 4 }}
12+
{{- end }}

charts/s3proxy/templates/secret.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,14 @@ stringData:
3939
{{- if .Values.config.backends.googleCloudStorage.clientEmail }}
4040
jclouds.identity={{ .Values.config.backends.googleCloudStorage.clientEmail }}
4141
{{- end }}
42-
{{- if .Values.config.backends.googleCloudStorage.privateKey }}
42+
{{- if .Values.config.backends.googleCloudStorage.jsonCredentials.enabled }}
43+
# Using JSON credentials file
44+
jclouds.credential=/gcp-credentials/{{ .Values.config.backends.googleCloudStorage.jsonCredentials.secretKey }}
45+
{{- else }}
46+
# Using privateKey directly
47+
{{- if .Values.config.backends.googleCloudStorage.privateKey }}
4348
jclouds.credential={{ .Values.config.backends.googleCloudStorage.privateKey }}
49+
{{- end }}
4450
{{- end }}
4551
{{- else if .Values.config.backends.b2.enabled }}
4652
# Backblaze B2 backend credentials

charts/s3proxy/values.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ affinity: {}
112112
config:
113113
# -- Log level for S3Proxy (DEBUG, INFO, WARN, ERROR)
114114
logLevel: "INFO"
115-
115+
116116
auth:
117117
# -- Authorization type (none, aws-v2, aws-v4, aws-v2-or-v4)
118118
type: "aws-v4"
@@ -205,10 +205,20 @@ config:
205205
enabled: false
206206
# -- GCP project ID
207207
projectId: ""
208-
# -- Private key
208+
# -- Private key (only used when jsonCredentials.enabled is false)
209209
privateKey: ""
210-
# -- Service account email
210+
# -- Service account email or user email (used with both privateKey and jsonCredentials methods)
211211
clientEmail: ""
212+
# -- JSON credentials configuration
213+
jsonCredentials:
214+
# -- Use JSON credentials file instead of privateKey
215+
enabled: false
216+
# -- JSON content for creating a new secret (takes precedence over existingSecret)
217+
jsonContent: ""
218+
# -- Name of existing secret containing GCP credentials JSON
219+
existingSecret: ""
220+
# -- Key in the secret containing the JSON credentials (default: credentials.json)
221+
secretKey: "credentials.json"
212222

213223
b2:
214224
# -- Enable Backblaze B2 backend

0 commit comments

Comments
 (0)