openshift / aws-efs-operator

Operator to manage AWS EFS on OpenShift
Apache License 2.0
3 stars 23 forks source link

How to create a custom named PVC ? #41

Closed ksingh7 closed 3 years ago

ksingh7 commented 3 years ago

Hi

Everything works in my setup, however, i have one question, how can I create a custom named PVC when creating a shared volume.

apiVersion: aws-efs.managed.openshift.io/v1alpha1
kind: SharedVolume
metadata:
  name: okd-efs-1
  namespace: 3scale
spec:
  accessPointID: fsap-024004066af9dfb96
  fileSystemID: fs-269990f7
status:
  claimRef:
    apiGroup: ''
    kind: PersistentVolumeClaim
    name: pvc-okd-efs-1
  phase: Ready

Suppose i wanted to have a PVC with name Shared-Storage how can i do that ?

ksingh7 commented 3 years ago

So here is how i manged to do that

apiVersion: v1
kind: PersistentVolume
metadata:
  name: shared-storage
spec:
  storageClassName: efs-sc
  capacity:
    storage: 1Gi # Doesn't really matter, as EFS does not enforce it anyway
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  csi:
    driver: efs.csi.aws.com
    volumeHandle: YOUR_FS_ID_HERE

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: shared-storage
  namespace: 3scale
  labels:
    app: 3scale-api-management
    threescale_component: system
    threescale_component_element: app
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  storageClassName: efs-sc
2uasimojo commented 3 years ago

Yup, that's what I would have suggested. The operator maintains all the framework necessary for the driver to work. SharedVolumes are a convenience to generate PV/PVC pairs, but you don't have to use them -- assuming your user has permission to create PVs and PVCs directly.

I'm going to close this issue. If there's anything else, feel free to reopen.