Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual PV name by dynamically required PVC. #155

Open
alexz0nder opened this issue Jan 27, 2025 · 2 comments
Open

Manual PV name by dynamically required PVC. #155

alexz0nder opened this issue Jan 27, 2025 · 2 comments

Comments

@alexz0nder
Copy link

alexz0nder commented Jan 27, 2025

Good day

Currently, I'm using version 0.42.1 of CSI-S3 Driver Helm Chart to have a Persistent Volume for every user Jupyter POD.
And, according to the README, this driver creates a HASH-named PV for every dynamically requested PVC. So I do have a HASH-named directories located in S3 bucket, which is inconvenient.
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECL claim-testuser Bound pvc-714f477a-0304-4f21-9aaa-47f17e85968d 150Mi RWO csi-s3
It would be a lot more usable if the PV name template could be passed as well to have every PV created with the same name as PVC.
For example:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECL claim-testuser Bound volume-testuser 150Mi RWO csi-s3

@alexz0nder alexz0nder changed the title Manual PV name by dynamocally required PVC. Manual PV name by dynamically required PVC. Jan 27, 2025
@livingroot
Copy link

livingroot commented Feb 3, 2025

You need to create StorageClass, PVC and PersistentVolume by yourself.

Here is example:

apiVersion: v1
kind: PersistentVolume
metadata:
  annotations:
    pv.kubernetes.io/provisioned-by: ru.yandex.s3.csi
  name: *WANTED_PV_NAME*
spec:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 10Gi
  claimRef:
    apiVersion: v1
    kind: PersistentVolumeClaim
    name: csi-s3-pvc
    namespace: **YOUR_NAMESPACE**
  csi:
    controllerPublishSecretRef:
      name: csi-s3-secret
      namespace: csi-s3
    driver: ru.yandex.s3.csi
    nodePublishSecretRef:
      name: csi-s3-secret
      namespace: csi-s3
    nodeStageSecretRef:
      name: csi-s3-secret
      namespace: csi-s3
    volumeAttributes:
      bucket: **YOUR_BUCKET_NAME**
      capacity: "10737418240"
      mounter: geesefs
      options: --memory-limit 1000 --dir-mode 0777 --file-mode 0666 --no-systemd --setuid 0
      storage.kubernetes.io/csiProvisionerIdentity: 1734780824694-8081-ru.yandex.s3.csi
    volumeHandle: **YOUR_BUCKET_NAME**/ # Don't forget slash here. You can define your custom folder name here
  persistentVolumeReclaimPolicy: Retain
  storageClassName: csi-s3-custom
  volumeMode: Filesystem
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: csi-s3-custom
parameters:
  bucket: **YOUR_BUCKET_NAME**
  csi.storage.k8s.io/controller-publish-secret-name: csi-s3-secret
  csi.storage.k8s.io/controller-publish-secret-namespace: csi-s3
  csi.storage.k8s.io/node-publish-secret-name: csi-s3-secret
  csi.storage.k8s.io/node-publish-secret-namespace: csi-s3
  csi.storage.k8s.io/node-stage-secret-name: csi-s3-secret
  csi.storage.k8s.io/node-stage-secret-namespace: csi-s3
  csi.storage.k8s.io/provisioner-secret-name: csi-s3-secret
  csi.storage.k8s.io/provisioner-secret-namespace: csi-s3
  mounter: geesefs
  options: --memory-limit 1000 --dir-mode 0777 --file-mode 0666 --no-systemd --setuid 0
provisioner: ru.yandex.s3.csi
reclaimPolicy: Retain
volumeBindingMode: Immediate
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: csi-s3-pvc
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Gi
  storageClassName: "" # yes, this must be empty

And in deployment:

      volumes:
        - name: s3-storage
          persistentVolumeClaim:
            claimName: csi-s3-pvc

@livingroot
Copy link

livingroot commented Feb 3, 2025

And also provide secrets by yourself:

apiVersion: v1
kind: Secret
metadata:
  name: csi-s3-secret
type: Opaque
data:
  accessKeyID: *YOUR VALUE*
  endpoint: *YOUR VALUE*
  region: *YOUR VALUE*
  secretAccessKey: *YOUR VALUE*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants