You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user specify a storage resources size in a PVC, the value gets treated as an integer internally and passed down to the Docker Volume API socket as an integer type in JSON.
Since neither a StorageClass or PVC annotation accepts any other data types than strings. It would be more coherent to pass claimSizeInGiB as a string to the Docker Volume API socket.
I'm having trouble following the code that determines where size should be picked from (I tried setting "size" in the StorageClass, with no effect) so this crude patch solved my immediate problem:
diff --git a/common/k8s/provisioner/volume.go b/common/k8s/provisioner/volume.go
index 243c1b2..3041eac 100644
--- a/common/k8s/provisioner/volume.go
+++ b/common/k8s/provisioner/volume.go
@@ -28,6 +28,7 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/reference"
"strings"
+ "strconv"
)
func (p *Provisioner) listAllVolumes(options meta_v1.ListOptions) (runtime.Object, error) {
@@ -152,7 +153,7 @@ func (p *Provisioner) getDockerOptions(params map[string]string, class *storage_
for _, option := range listOfOptions {
if key == option {
util.LogInfo.Printf("storageclass option matched storage resource option:%s ,overriding the value to %d", key, claimSizeinGiB)
- dockOpts[key] = claimSizeinGiB
+ dockOpts[key] = strconv.Itoa(claimSizeinGiB)
break
}
}
The text was updated successfully, but these errors were encountered:
datamattsson
changed the title
dockOpts["size"] need to be converted to integer
dockOpts["size"] need to be converted to string
Dec 7, 2018
When a user specify a storage resources size in a PVC, the value gets treated as an integer internally and passed down to the Docker Volume API socket as an integer type in JSON.
Plugins that may be written using the official Go bindings from Docker will not work as the library only accepts strings in the value. https://github.com/docker/go-plugins-helpers/tree/master/volume (https://github.com/docker/go-plugins-helpers/blob/1e6269c305b8c75cfda1c8aa91349c38d7335814/volume/api.go#L26)
Since neither a StorageClass or PVC annotation accepts any other data types than strings. It would be more coherent to pass claimSizeInGiB as a string to the Docker Volume API socket.
I'm having trouble following the code that determines where size should be picked from (I tried setting "size" in the StorageClass, with no effect) so this crude patch solved my immediate problem:
The text was updated successfully, but these errors were encountered: