kubernetes-csi / external-provisioner

Sidecar container that watches Kubernetes PersistentVolumeClaim objects and triggers CreateVolume/DeleteVolume against a CSI endpoint
Apache License 2.0
328 stars 318 forks source link

Publishing PVC response in GB, MB and KB too #1165

Open GunaKKIBM opened 4 months ago

GunaKKIBM commented 4 months ago

Currently, if the user provides input for pvc creation in Kilobytes, Gigabytes, Megabytes (10^3, 10^6, 10^9) and the respective cloud provider creates the same in GB and returns response, it would be better if csi provisioner has the capability to convert the response published in pvc to GB accordingly. Elaborating more with an example

Cloud provider could created the volume in either Gibibytes (1024 x), or Gigabytes (1000 x) and send the response to csi provisioner accordingly. Example: Current behavior If the response sent by csi driver of the cloud provider is - 100000000000 bytes, currently the response published is - 97656250Ki which is derived from the code, https://github.com/kubernetes-csi/external-provisioner/blob/ef83836bc21e5a737ded6d0f37f8a5f6a97d8973/pkg/controller/controller.go#L1863 .

Expected and more readable response: 100G

  1. Rather than publishing unreadable value, it would better to figure out whether the response returned to csi provisioner from driver is in 1024 ^ x, or 1000 ^ x, accordingly use Binary or Decimal constants - https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#pkg-constants and publish the response so that correct value is seen in pvc. OR
  2. Provide a parameter in CreateCSIVolumeResponse where the cloud provider can provide the units in which they want the response to be published which provides driver with more control.

https://github.com/kubernetes-csi/external-provisioner/blob/ef83836bc21e5a737ded6d0f37f8a5f6a97d8973/pkg/controller/controller.go#L1863

Thank you!

k8s-triage-robot commented 1 month ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 1 week ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten