Skip to content

Commit

Permalink
Bugfix: PV should use capacity bytes returned by plugin, not PVC bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidz627 committed Mar 2, 2018
1 parent cc4e42b commit 4e969ba
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ package controller
import (
"context"
"fmt"
_ "k8s.io/apimachinery/pkg/util/json"
"net"
"strings"
"time"

"k8s.io/apimachinery/pkg/api/resource"
_ "k8s.io/apimachinery/pkg/util/json"

"github.com/golang/glog"

"github.com/kubernetes-incubator/external-storage/lib/controller"
Expand Down Expand Up @@ -242,6 +244,7 @@ func (p *csiProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis
for k, v := range rep.Volume.Attributes {
volumeAttributes[k] = v
}
repBytesString := fmt.Sprintf("%v", rep.GetVolume().GetCapacityBytes())
pv := &v1.PersistentVolume{
ObjectMeta: metav1.ObjectMeta{
Name: share,
Expand All @@ -250,7 +253,7 @@ func (p *csiProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis
PersistentVolumeReclaimPolicy: options.PersistentVolumeReclaimPolicy,
AccessModes: options.PVC.Spec.AccessModes,
Capacity: v1.ResourceList{
v1.ResourceName(v1.ResourceStorage): options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)],
v1.ResourceName(v1.ResourceStorage): resource.MustParse(repBytesString),
},
// TODO wait for CSI VolumeSource API
PersistentVolumeSource: v1.PersistentVolumeSource{
Expand Down

0 comments on commit 4e969ba

Please sign in to comment.