11{{- define "s3proxy.main.config" -}}
2- # S3Proxy configuration
3- s3proxy.endpoint=http://0.0.0.0:{{ .Values.service.targetPort }}
4- s3proxy.authorization={{ .Values.config.auth.type }}
5- {{- if .Values.config.virtualHost }}
6- s3proxy.virtual-host={{ .Values.config.virtualHost }}
7- {{- end }}
8-
9- {{- if ne .Values.config.auth.type "none" }}
10- # Authentication credentials will be merged from the secret properties file
11- # s3proxy.identity and s3proxy.credential will be provided by the secret
12- {{- end }}
13-
14- {{- if .Values.config.cors.enabled }}
15- # CORS configuration
16- {{- if .Values.config.cors.allowOrigins }}
17- s3proxy.cors-allow-origins={{ join " " .Values.config.cors.allowOrigins }}
2+ # S3Proxy configuration
3+ s3proxy.endpoint=http://0.0.0.0:{{ .Values.service.targetPort }}
4+ s3proxy.authorization={{ .Values.config.auth.type }}
5+ {{- if .Values.config.virtualHost }}
6+ s3proxy.virtual-host={{ .Values.config.virtualHost }}
187 {{- end }}
19- {{- if .Values.config.cors.allowMethods }}
20- s3proxy.cors-allow-methods={{ join " " .Values.config.cors.allowMethods }}
8+
9+ {{- if ne .Values.config.auth.type "none" }}
10+ # Authentication credentials will be merged from the secret properties file
11+ # s3proxy.identity and s3proxy.credential will be provided by the secret
2112 {{- end }}
22- {{- if .Values.config.cors.allowHeaders }}
23- s3proxy.cors-allow-headers={{ join " " .Values.config.cors.allowHeaders }}
13+
14+ {{- if .Values.config.cors.enabled }}
15+ # CORS configuration
16+ {{- if .Values.config.cors.allowOrigins }}
17+ s3proxy.cors-allow-origins={{ join " " .Values.config.cors.allowOrigins }}
18+ {{- end }}
19+ {{- if .Values.config.cors.allowMethods }}
20+ s3proxy.cors-allow-methods={{ join " " .Values.config.cors.allowMethods }}
21+ {{- end }}
22+ {{- if .Values.config.cors.allowHeaders }}
23+ s3proxy.cors-allow-headers={{ join " " .Values.config.cors.allowHeaders }}
24+ {{- end }}
25+ s3proxy.cors-allow-credential={{ .Values.config.cors.allowCredential }}
2426 {{- end }}
25- s3proxy.cors-allow-credential={{ .Values.config.cors.allowCredential }}
26- {{- end }}
2727
28- {{- if .Values.config.buckets.alias }}
29- # Bucket aliasing
30- {{- range $key, $value := .Values.config.buckets.alias }}
31- s3proxy.alias.{{ $key }}={{ $value }}
28+ {{- if .Values.config.buckets.alias }}
29+ # Bucket aliasing
30+ {{- range $key, $value := .Values.config.buckets.alias }}
31+ s3proxy.alias.{{ $key }}={{ $value }}
32+ {{- end }}
3233 {{- end }}
33- {{- end }}
3434
35- {{- if .Values.config.buckets.locator }}
36- # Bucket locator
37- {{- range $index, $bucket := .Values.config.buckets.locator }}
38- s3proxy.bucket-locator.{{ add $index 1 }}={{ $bucket }}
35+ {{- if .Values.config.buckets.locator }}
36+ # Bucket locator
37+ {{- range $index, $bucket := .Values.config.buckets.locator }}
38+ s3proxy.bucket-locator.{{ add $index 1 }}={{ $bucket }}
39+ {{- end }}
3940 {{- end }}
40- {{- end }}
4141
42- {{- if .Values.config.middlewares.readOnly }}
43- # Read-only middleware
44- s3proxy.read-only-blobstore=true
45- {{- end }}
42+ {{- if .Values.config.middlewares.readOnly }}
43+ # Read-only middleware
44+ s3proxy.read-only-blobstore=true
45+ {{- end }}
4646
47- {{- if .Values.config.middlewares.eventualConsistency }}
48- # Eventual consistency middleware
49- s3proxy.eventual-consistency=true
50- {{- end }}
47+ {{- if .Values.config.middlewares.eventualConsistency }}
48+ # Eventual consistency middleware
49+ s3proxy.eventual-consistency=true
50+ {{- end }}
5151
52- {{- if .Values.config.middlewares.shardedBackend }}
53- # Sharded backend middleware
54- s3proxy.sharded-blobstore=true
55- s3proxy.sharded-blobstore.prefix=2
56- s3proxy.sharded-blobstore.levels=2
57- {{- end }}
52+ {{- if .Values.config.middlewares.shardedBackend }}
53+ # Sharded backend middleware
54+ s3proxy.sharded-blobstore=true
55+ s3proxy.sharded-blobstore.prefix=2
56+ s3proxy.sharded-blobstore.levels=2
57+ {{- end }}
5858
59- {{- if .Values.config.middlewares.largeObjectMocking }}
60- # Large object mocking middleware
61- s3proxy.large-object-mocking=true
62- {{- end }}
59+ {{- if .Values.config.middlewares.largeObjectMocking }}
60+ # Large object mocking middleware
61+ s3proxy.large-object-mocking=true
62+ {{- end }}
6363{{- end }}
64-
6564apiVersion : v1
6665kind : ConfigMap
6766metadata :
@@ -70,8 +69,8 @@ metadata:
7069 {{- include "s3proxy.labels" . | nindent 4 }}
7170data :
7271{{- if .Values.config.backends.filesystem.enabled }}
73- backend-filesystem.properties : |
74- {{- include "s3proxy.main.config" . | nindent 4 }}
72+ backend-filesystem.properties : |-
73+ {{ include "s3proxy.main.config" . | nindent 4 }}
7574
7675 # Filesystem backend configuration
7776 {{- if .Values.config.backends.filesystem.nio2 }}
8382{{- end }}
8483
8584{{- if .Values.config.backends.transient.enabled }}
86- backend-transient.properties : |
87- {{- include "s3proxy.main.config" . | nindent 4 }}
85+ backend-transient.properties : |-
86+ {{ include "s3proxy.main.config" . | nindent 4 }}
8887
8988 # Transient backend configuration
9089 {{- if .Values.config.backends.transient.nio2 }}
9594{{- end }}
9695
9796{{- if .Values.config.backends.s3.enabled }}
98- backend-s3.properties : |
99- {{- include "s3proxy.main.config" . | nindent 4 }}
97+ backend-s3.properties : |-
98+ {{ include "s3proxy.main.config" . | nindent 4 }}
10099
101100 # S3 backend configuration
102101 {{- if .Values.config.backends.s3.aws }}
@@ -110,49 +109,69 @@ data:
110109 {{- if .Values.config.backends.s3.endpoint }}
111110 jclouds.endpoint={{ .Values.config.backends.s3.endpoint }}
112111 {{- end }}
113- # Credentials will be merged from the secret properties file
114- # jclouds.identity and jclouds.credential will be provided by the secret
112+ {{- if .Values.config.backends.s3.accessKeyID }}
113+ jclouds.identity={{ .Values.config.backends.s3.accessKeyID }}
114+ {{- end }}
115+ {{- if .Values.config.backends.s3.secretAccessKey.value }}
116+ # Credential will be merged from the secret properties file
117+ {{- end }}
115118{{- end }}
116119
117120{{- if .Values.config.backends.azureblob.enabled }}
118- backend-azureblob.properties : |
119- {{- include "s3proxy.main.config" . | nindent 4 }}
121+ backend-azureblob.properties : |-
122+ {{ include "s3proxy.main.config" . | nindent 4 }}
120123
121124 # Azure Blob backend configuration
122125 jclouds.provider={{ .Values.config.backends.azureblob.provider }}
123126 {{- if .Values.config.backends.azureblob.endpoint }}
124127 jclouds.azureblob.endpoint={{ .Values.config.backends.azureblob.endpoint }}
125128 {{- end }}
129+ {{- if .Values.config.backends.azureblob.account }}
130+ jclouds.identity={{ .Values.config.backends.azureblob.account }}
131+ {{- end }}
132+ {{- if or .Values.config.backends.azureblob.key.value .Values.config.backends.azureblob.sasToken.value }}
126133 # Credentials will be merged from the secret properties file
127- # jclouds.identity, jclouds.credential, and jclouds.azureblob.sas will be provided by the secret
134+ {{- end }}
128135{{- end }}
129136
130137{{- if .Values.config.backends.googleCloudStorage.enabled }}
131- backend-google-cloud-storage.properties : |
132- {{- include "s3proxy.main.config" . | nindent 4 }}
138+ backend-google-cloud-storage.properties : |-
139+ {{ include "s3proxy.main.config" . | nindent 4 }}
133140
134141 # Google Cloud Storage backend configuration
135142 jclouds.provider=google-cloud-storage
136143 {{- if .Values.config.backends.googleCloudStorage.projectID }}
137144 jclouds.project-id={{ .Values.config.backends.googleCloudStorage.projectID }}
138145 {{- end }}
139- # Credentials will be merged from the secret properties file
140- # jclouds.identity and jclouds.credential will be provided by the secret
146+ {{- if .Values.config.backends.googleCloudStorage.clientEmail }}
147+ jclouds.identity={{ .Values.config.backends.googleCloudStorage.clientEmail }}
148+ {{- end }}
149+ {{- if .Values.config.backends.googleCloudStorage.privateKey.existingSecret }}
150+ # Using privateKey from mounted secret file
151+ jclouds.credential=/credentials/gcs-private.key
152+ {{- else if .Values.config.backends.googleCloudStorage.privateKey.value }}
153+ # Private key credential will be merged from the secret properties file
154+ # jclouds.credential will be provided by the secret
155+ {{- end }}
141156{{- end }}
142157
143158{{- if .Values.config.backends.b2.enabled }}
144- backend-b2.properties : |
145- {{- include "s3proxy.main.config" . | nindent 4 }}
159+ backend-b2.properties : |-
160+ {{ include "s3proxy.main.config" . | nindent 4 }}
146161
147162 # Backblaze B2 backend configuration
148163 jclouds.provider=b2
149- # Credentials will be merged from the secret properties file
150- # jclouds.identity and jclouds.credential will be provided by the secret
164+ {{- if .Values.config.backends.b2.account }}
165+ jclouds.identity={{ .Values.config.backends.b2.account }}
166+ {{- end }}
167+ {{- if .Values.config.backends.b2.applicationKey.value }}
168+ # Credential will be merged from the secret properties file
169+ {{- end }}
151170{{- end }}
152171
153172{{- if .Values.config.backends.openstackSwift.enabled }}
154- backend-openstack-swift.properties : |
155- {{- include "s3proxy.main.config" . | nindent 4 }}
173+ backend-openstack-swift.properties : |-
174+ {{ include "s3proxy.main.config" . | nindent 4 }}
156175
157176 # OpenStack Swift backend configuration
158177 jclouds.provider=openstack-swift
@@ -162,20 +181,28 @@ data:
162181 {{- if .Values.config.backends.openstackSwift.region }}
163182 jclouds.region={{ .Values.config.backends.openstackSwift.region }}
164183 {{- end }}
165- # Credentials will be merged from the secret properties file
166- # jclouds.identity and jclouds.credential will be provided by the secret
184+ {{- if and .Values.config.backends.openstackSwift.tenantName .Values.config.backends.openstackSwift.userName }}
185+ jclouds.identity={{ printf "%s:%s" .Values.config.backends.openstackSwift.tenantName .Values.config.backends.openstackSwift.userName }}
186+ {{- end }}
187+ {{- if .Values.config.backends.openstackSwift.password.value }}
188+ # Credential will be merged from the secret properties file
189+ {{- end }}
167190{{- end }}
168191
169192{{- if .Values.config.backends.rackspaceCloudfiles.enabled }}
170- backend-rackspace-cloudfiles.properties : |
171- {{- include "s3proxy.main.config" . | nindent 4 }}
193+ backend-rackspace-cloudfiles.properties : |-
194+ {{ include "s3proxy.main.config" . | nindent 4 }}
172195
173196 # Rackspace Cloud Files backend configuration
174197 {{- if eq .Values.config.backends.rackspaceCloudfiles.region "uk" }}
175198 jclouds.provider=rackspace-cloudfiles-uk
176199 {{- else }}
177200 jclouds.provider=rackspace-cloudfiles-us
178201 {{- end }}
179- # Credentials will be merged from the secret properties file
180- # jclouds.identity and jclouds.credential will be provided by the secret
202+ {{- if .Values.config.backends.rackspaceCloudfiles.userName }}
203+ jclouds.identity={{ .Values.config.backends.rackspaceCloudfiles.userName }}
204+ {{- end }}
205+ {{- if .Values.config.backends.rackspaceCloudfiles.apiKey.value }}
206+ # Credential will be merged from the secret properties file
207+ {{- end }}
181208{{- end }}
0 commit comments