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: parameters:
mounter: geesefs mounter: geesefs
options: "{{ .Values.storageClass.mountOptions }}" options: "{{ .Values.storageClass.mountOptions }}"
{{- if .Values.storageClass.singleBucket }}
bucket: "{{ .Values.storageClass.singleBucket }}" bucket: "{{ .Values.storageClass.singleBucket }}"
{{- end }}
csi.storage.k8s.io/provisioner-secret-name: {{ .Values.secret.name }} csi.storage.k8s.io/provisioner-secret-name: {{ .Values.secret.name }}
csi.storage.k8s.io/provisioner-secret-namespace: {{ .Release.Namespace }} csi.storage.k8s.io/provisioner-secret-namespace: {{ .Release.Namespace }}
csi.storage.k8s.io/controller-publish-secret-name: {{ .Values.secret.name }} 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 := "" prefix := ""
// check if bucket name is overridden // check if bucket name is overridden
if nameOverride, ok := params[mounter.BucketKey]; ok { if params[mounter.BucketKey] != "" {
bucketName = nameOverride bucketName = params[mounter.BucketKey]
prefix = volumeID prefix = volumeID
volumeID = path.Join(bucketName, prefix) volumeID = path.Join(bucketName, prefix)
} }