From f3ff4f75c3b064b1128adb79b4f41f0a2671884b Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Thu, 10 Feb 2022 17:21:30 +0300 Subject: [PATCH] Fix Helm templates for empty bucket parameter --- deploy/helm/templates/storageclass.yaml | 2 ++ pkg/driver/controllerserver.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/deploy/helm/templates/storageclass.yaml b/deploy/helm/templates/storageclass.yaml index d6cd263..57758a3 100644 --- a/deploy/helm/templates/storageclass.yaml +++ b/deploy/helm/templates/storageclass.yaml @@ -11,7 +11,9 @@ provisioner: ru.yandex.s3.csi parameters: mounter: geesefs options: "{{ .Values.storageClass.mountOptions }}" +{{- if .Values.storageClass.singleBucket }} bucket: "{{ .Values.storageClass.singleBucket }}" +{{- end }} csi.storage.k8s.io/provisioner-secret-name: {{ .Values.secret.name }} csi.storage.k8s.io/provisioner-secret-namespace: {{ .Release.Namespace }} csi.storage.k8s.io/controller-publish-secret-name: {{ .Values.secret.name }} diff --git a/pkg/driver/controllerserver.go b/pkg/driver/controllerserver.go index ae620db..8630c3e 100644 --- a/pkg/driver/controllerserver.go +++ b/pkg/driver/controllerserver.go @@ -47,8 +47,8 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol prefix := "" // check if bucket name is overridden - if nameOverride, ok := params[mounter.BucketKey]; ok { - bucketName = nameOverride + if params[mounter.BucketKey] != "" { + bucketName = params[mounter.BucketKey] prefix = volumeID volumeID = path.Join(bucketName, prefix) }