From 075accef2dc676fe65ed8e7f5e3a29683090323d Mon Sep 17 00:00:00 2001
From: Tamas Mohos <zerosuxx@gmail.com>
Date: Mon, 18 Sep 2023 17:27:59 +0000
Subject: [PATCH] s3 region now configurable by helm values

---
 deploy/helm/csi-s3/README.md             | 1 +
 deploy/helm/csi-s3/manifest.yaml         | 9 +++++++++
 deploy/helm/csi-s3/templates/secret.yaml | 3 +++
 deploy/helm/csi-s3/values.yaml           | 2 ++
 4 files changed, 15 insertions(+)

diff --git a/deploy/helm/csi-s3/README.md b/deploy/helm/csi-s3/README.md
index fe657cc..71abd1a 100644
--- a/deploy/helm/csi-s3/README.md
+++ b/deploy/helm/csi-s3/README.md
@@ -35,6 +35,7 @@ The following table lists all configuration parameters and their default values.
 | `secret.accessKey`           | S3 Access Key                                                          |                                                        |
 | `secret.secretKey`           | S3 Secret Key                                                          |                                                        |
 | `secret.endpoint`            | Endpoint                                                               | https://storage.yandexcloud.net                        |
+| `secret.region`              | Region                                                                 |                         |
 | `tolerations.all`            | Tolerate all taints by the CSI-S3 node driver (mounter)                | false                                                  |
 | `tolerations.node`           | Custom tolerations for the CSI-S3 node driver (mounter)                | []                                                     |
 | `tolerations.controller`     | Custom tolerations for the CSI-S3 controller (provisioner)             | []                                                     |
diff --git a/deploy/helm/csi-s3/manifest.yaml b/deploy/helm/csi-s3/manifest.yaml
index 1e18d03..04b188c 100644
--- a/deploy/helm/csi-s3/manifest.yaml
+++ b/deploy/helm/csi-s3/manifest.yaml
@@ -62,6 +62,15 @@ user_values:
       ru: Адрес S3-сервиса, который будет использоваться.
     string_value:
       default_value: "https://storage.yandexcloud.net"
+  - name: secret.region
+    title:
+      en: S3 region
+      ru: S3 регион
+    description:
+      en: S3 service region to use
+      ru: Регион используемого сервиса S3.
+    string_value:
+      default_value: ""
   - name: storageClass.mountOptions
     title:
       en: GeeseFS mount options
diff --git a/deploy/helm/csi-s3/templates/secret.yaml b/deploy/helm/csi-s3/templates/secret.yaml
index be7ac7d..7ff48f9 100644
--- a/deploy/helm/csi-s3/templates/secret.yaml
+++ b/deploy/helm/csi-s3/templates/secret.yaml
@@ -12,4 +12,7 @@ stringData:
   secretAccessKey: {{ .Values.secret.secretKey }}
 {{- end }}
   endpoint: {{ .Values.secret.endpoint }}
+{{- if .Values.secret.region }}
+  region: {{ .Values.secret.region }}
+{{- end }}
 {{- end -}}
diff --git a/deploy/helm/csi-s3/values.yaml b/deploy/helm/csi-s3/values.yaml
index c34505d..6c71b02 100644
--- a/deploy/helm/csi-s3/values.yaml
+++ b/deploy/helm/csi-s3/values.yaml
@@ -37,6 +37,8 @@ secret:
   secretKey: ""
   # Endpoint
   endpoint: https://storage.yandexcloud.net
+  # Region
+  region: ""
 
 tolerations:
   all: false