Fix Helm templates for empty bucket parameter

This commit is contained in:
Vitaliy Filippov 2022-02-10 17:21:30 +03:00
parent 6331bb840b
commit f3ff4f75c3
2 changed files with 4 additions and 2 deletions

View file

@ -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 }}

View file

@ -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)
}