migtools / pvc-migrate

Standalone PVC migration
Apache License 2.0
5 stars 13 forks source link

Wrong volume size being reported in Stage 1 #111

Closed pranavgaikwad closed 4 years ago

pranavgaikwad commented 4 years ago

Related to #92

Current implementation relies on requested volume size on the source cluster. It is computed from the requests fields in the PVC. Requested PVC size is not necessarily the same as the provisioned volume size. We should instead use the actual provisioned volume size for PVC creation.

See following example :

[pranav@localhost 2_pvc_destination_gen]$ oc get pvc pvc-0 -o yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    pv.kubernetes.io/bind-completed: "yes"
    pv.kubernetes.io/bound-by-controller: "yes"
    volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/glusterfs
  creationTimestamp: "2020-07-15T18:53:56Z"
  finalizers:
  - kubernetes.io/pvc-protection
  name: pvc-0
  namespace: pgaikwad-bmark-1
  resourceVersion: "44576"
  selfLink: /api/v1/namespaces/pgaikwad-bmark-1/persistentvolumeclaims/pvc-0
  uid: 8957a4ea-c6cc-11ea-98b3-0af2d1cb77bb
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1100Mi
  storageClassName: glusterfs-storage
  volumeName: pvc-8957a4ea-c6cc-11ea-98b3-0af2d1cb77bb
status:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 2Gi
  phase: Bound

The requested volume size above is 1100Mi. However, the actual provisioned size is 2Gi.