Huawei / eSDK_K8S_Plugin

Container-Storage-Interface (CSI) for Huawei storage
https://huawei.github.io/css-docs/
Apache License 2.0
85 stars 47 forks source link

Réuse dynamic provisioned volume #119

Closed solune closed 1 year ago

solune commented 1 year ago

Hello, Dynamic provisioning is really interesting because I don't need to précrate volume on storage before. But when helm update it create a new volume.

I try to use selector in pvc:

selector:
    matchLabels:
      for_app: my-app

but csi say "failed to provision volume with StorageClass "dorado-nfs": claim Selector is not supported"

So How can i reuse dynamic provisioned volume in my app ?

YeYoot commented 1 year ago

Hello, Dynamic provisioning is really interesting because I don't need to précrate volume on storage before. But when helm update it create a new volume.

I try to use selector in pvc:

selector:
    matchLabels:
      for_app: my-app

but csi say "failed to provision volume with StorageClass "dorado-nfs": claim Selector is not supported"

So How can i reuse dynamic provisioned volume in my app ?

Please provide the sc file and pvc file used, the error information is also described in detail, so that we can better help you.

solune commented 1 year ago

Hello, My storage-class:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: "dorado-nfs"
provisioner: csi.huawei.com
allowVolumeExpansion: true
reclaimPolicy: Retain
parameters:
  backend: "doradorc9-nfs"
  pool: "StoragePool001"
  volumeType: fs
  hyperMetro: "true"
  allocType: thin
  authClient: "10.35.0.0/16"
mountOptions:
  - nfsvers=4.1

and my pvc:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: dsiadmin-file-uploader-huawei-pvc
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  storageClassName: dorado-nfs
  resources:
    requests:
      storage: 100Gi
  selector:
    matchLabels:
      for_app: fileuploader
YeYoot commented 1 year ago

selector

Dynamically provisioning does not support the use of "selector" because it is meaningless. "Selector" are useful only in statically provisioning scenarios.

solune commented 1 year ago

So how can I ré-use dynamically provided volume ?

YeYoot commented 1 year ago

So how can I ré-use dynamically provided volume ?

One SC can be used to create multiple PVCs. Each PVC is bound to a PV(one-to-one mapping). One PVC can be used by multiple pods. For details, PVC:https://kubernetes.io/docs/concepts/storage/persistent-volumes/ Pod:https://kubernetes.io/docs/concepts/workloads/pods/