Skip to content

Commit b12e2f1

Browse files
author
Hantao (Will) Wang
committed
Revert "Merge pull request kubernetes-sigs#317 from davidz627/feature/resize"
This reverts commit e59f47e, reversing changes made to 41f103f.
1 parent e59f47e commit b12e2f1

File tree

23 files changed

+32
-1689
lines changed

23 files changed

+32
-1689
lines changed

Gopkg.lock

+2-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ This plugin is compatible with CSI versions [v1.0.0](https://github.com/containe
3434

3535
### Kubernetes Compatibility
3636

37-
| GCE PD CSI Driver\Kubernetes Version | 1.10.5 - 1.11 | 1.12 | 1.13 | 1.14 | 1.15+|
38-
|--------------------------------------|---------------|------|------|------|------|
39-
| v0.1.x.alpha | yes | no | no | no | no |
40-
| v0.2.x (alpha) | no | yes | no | no | no |
41-
| v0.3.x (beta) | no | no | yes | yes | yes |
42-
| v0.4.x (beta) | no | no | yes | yes | yes |
43-
| v0.5.x (beta) | no | no | no | yes | yes |
44-
| dev | no | no | no | no | yes |
37+
| GCE PD CSI Driver\Kubernetes Version | 1.10.5 - 1.11 | 1.12 | 1.13 | 1.14+
38+
|--------------------------------------|---------------|------|------|------|
39+
| v0.1.x.alpha | yes | no | no | no |
40+
| v0.2.x (alpha) | no | yes | no | no |
41+
| v0.3.x (beta) | no | no | yes | yes |
42+
| v0.4.x (beta) | no | no | yes | yes |
43+
| v0.5.x (beta) | no | no | no | yes |
44+
| dev | no | no | no | yes |
4545

4646
### Known Issues
4747

@@ -62,13 +62,14 @@ This driver supports only one topology key:
6262
`topology.gke.io/zone`
6363
that represents availability by zone.
6464

65-
### Features in Development
65+
### Kubernetes Beta Features
6666

67-
| Feature | Stage | Min Kubernetes Master Version | Min Kubernetes Nodes Version | Min Driver Version | Deployment Overlay |
68-
|-----------------|-------|-------------------------------|------------------------------|--------------------|--------------------|
69-
| Topology | Beta | 1.14 | 1.14 | v0.5.0 | Stable |
70-
| Snapshots | Alpha | 1.13 | Any | v0.3.0 | Alpha |
71-
| Resize (Expand) | Alpha | 1.14 | 1.14 | dev | Alpha |
67+
* Topology: Requires K8s 1.14+ on Master and Nodes and PD driver v0.5.0+
68+
69+
### Kubernetes Alpha Features
70+
71+
* Snapshots: Requires K8s 1.13+ on Master and PD driver v0.3.0+ with the alpha
72+
overlay
7273

7374
### Future Features
7475

deploy/kubernetes/overlays/alpha/controller_add_resizer.yaml

-17
This file was deleted.

deploy/kubernetes/overlays/alpha/kustomization.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ bases:
44
- ../stable
55
patches:
66
- controller_add_snapshotter.yaml
7-
- controller_add_resizer.yaml
87
patchesJson6902:
98
- target:
109
group: rbac.authorization.k8s.io
@@ -14,4 +13,3 @@ patchesJson6902:
1413
path: rbac_add_snapshots_to_provisioner.yaml
1514
resources:
1615
- rbac_add_snapshotter.yaml
17-
- rbac_add_resizer.yaml

deploy/kubernetes/overlays/alpha/rbac_add_resizer.yaml

-32
This file was deleted.

docs/kubernetes/user-guides/resize.md

-101
This file was deleted.

pkg/gce-cloud-provider/compute/cloud-disk.go

-11
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,6 @@ func (d *CloudDisk) GetSizeGb() int64 {
124124
}
125125
}
126126

127-
// setSizeGb sets the size of the disk used ONLY
128-
// for testing purposes.
129-
func (d *CloudDisk) setSizeGb(size int64) {
130-
switch d.Type() {
131-
case Zonal:
132-
d.ZonalDisk.SizeGb = size
133-
case Regional:
134-
d.RegionalDisk.SizeGb = size
135-
}
136-
}
137-
138127
func (d *CloudDisk) GetZone() string {
139128
switch d.Type() {
140129
case Zonal:

pkg/gce-cloud-provider/compute/fake-gce.go

-12
Original file line numberDiff line numberDiff line change
@@ -367,18 +367,6 @@ func (cloud *FakeCloudProvider) CreateSnapshot(ctx context.Context, volKey *meta
367367
return snapshotToCreate, nil
368368
}
369369

370-
func (cloud *FakeCloudProvider) ResizeDisk(ctx context.Context, volKey *meta.Key, requestBytes int64) (int64, error) {
371-
disk, ok := cloud.disks[volKey.Name]
372-
if !ok {
373-
return -1, notFoundError()
374-
}
375-
376-
disk.setSizeGb(common.BytesToGb(requestBytes))
377-
378-
return requestBytes, nil
379-
380-
}
381-
382370
// Snapshot Methods
383371
func (cloud *FakeCloudProvider) DeleteSnapshot(ctx context.Context, snapshotName string) error {
384372
delete(cloud.snapshots, snapshotName)

pkg/gce-cloud-provider/compute/gce-compute.go

-60
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ type GCECompute interface {
5050
GetDiskSourceURI(volKey *meta.Key) string
5151
GetDiskTypeURI(volKey *meta.Key, diskType string) string
5252
WaitForAttach(ctx context.Context, volKey *meta.Key, instanceZone, instanceName string) error
53-
ResizeDisk(ctx context.Context, volKey *meta.Key, requestBytes int64) (int64, error)
5453
// Regional Disk Methods
5554
GetReplicaZoneURI(zone string) string
5655
// Instance Methods
@@ -594,65 +593,6 @@ func (cloud *CloudProvider) CreateSnapshot(ctx context.Context, volKey *meta.Key
594593
}
595594
}
596595

597-
func (cloud *CloudProvider) ResizeDisk(ctx context.Context, volKey *meta.Key, requestBytes int64) (int64, error) {
598-
cloudDisk, err := cloud.GetDisk(ctx, volKey)
599-
if err != nil {
600-
return -1, fmt.Errorf("failed to get disk: %v", err)
601-
}
602-
603-
sizeGb := cloudDisk.GetSizeGb()
604-
requestGb := common.BytesToGb(requestBytes)
605-
606-
// If disk is already of size equal or greater than requested size, we simply return
607-
if sizeGb >= requestGb {
608-
return requestBytes, nil
609-
}
610-
611-
switch volKey.Type() {
612-
case meta.Zonal:
613-
return cloud.resizeZonalDisk(ctx, volKey, requestGb)
614-
case meta.Regional:
615-
return cloud.resizeRegionalDisk(ctx, volKey, requestGb)
616-
default:
617-
return -1, fmt.Errorf("could not resize disk, key was neither zonal nor regional, instead got: %v", volKey.String())
618-
}
619-
}
620-
621-
func (cloud *CloudProvider) resizeZonalDisk(ctx context.Context, volKey *meta.Key, requestGb int64) (int64, error) {
622-
resizeReq := &compute.DisksResizeRequest{
623-
SizeGb: requestGb,
624-
}
625-
op, err := cloud.service.Disks.Resize(cloud.project, volKey.Zone, volKey.Name, resizeReq).Context(ctx).Do()
626-
if err != nil {
627-
return -1, fmt.Errorf("failed to resize zonal volume %v: %v", volKey.String(), err)
628-
}
629-
630-
err = cloud.waitForZonalOp(ctx, op, volKey.Zone)
631-
if err != nil {
632-
return -1, fmt.Errorf("failed waiting for op for zonal resize for %s: %v", volKey.String(), err)
633-
}
634-
635-
return requestGb, nil
636-
}
637-
638-
func (cloud *CloudProvider) resizeRegionalDisk(ctx context.Context, volKey *meta.Key, requestGb int64) (int64, error) {
639-
resizeReq := &computebeta.RegionDisksResizeRequest{
640-
SizeGb: requestGb,
641-
}
642-
643-
op, err := cloud.betaService.RegionDisks.Resize(cloud.project, volKey.Region, volKey.Name, resizeReq).Context(ctx).Do()
644-
if err != nil {
645-
return -1, fmt.Errorf("failed to resize regional volume %v: %v", volKey.String(), err)
646-
}
647-
648-
err = cloud.waitForRegionalOp(ctx, op, volKey.Region)
649-
if err != nil {
650-
return -1, fmt.Errorf("failed waiting for op for regional resize for %s: %v", volKey.String(), err)
651-
}
652-
653-
return requestGb, nil
654-
}
655-
656596
func (cloud *CloudProvider) createZonalDiskSnapshot(ctx context.Context, volKey *meta.Key, snapshotName string) (*compute.Snapshot, error) {
657597
snapshotToCreate := &compute.Snapshot{
658598
Name: snapshotName,

pkg/gce-pd-csi-driver/controller.go

+1-24
Original file line numberDiff line numberDiff line change
@@ -659,30 +659,7 @@ func (gceCS *GCEControllerServer) ListSnapshots(ctx context.Context, req *csi.Li
659659
}
660660

661661
func (gceCS *GCEControllerServer) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) {
662-
volumeID := req.GetVolumeId()
663-
if len(volumeID) == 0 {
664-
return nil, status.Error(codes.InvalidArgument, "ControllerExpandVolume volume ID must be provided")
665-
}
666-
capacityRange := req.GetCapacityRange()
667-
reqBytes, err := getRequestCapacity(capacityRange)
668-
if err != nil {
669-
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("ControllerExpandVolume capacity range is invalid: %v", err))
670-
}
671-
672-
volKey, err := common.VolumeIDToKey(volumeID)
673-
if err != nil {
674-
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("ControllerExpandVolume volume ID is invalid: %v", err))
675-
}
676-
677-
resizedGb, err := gceCS.CloudProvider.ResizeDisk(ctx, volKey, reqBytes)
678-
if err != nil {
679-
return nil, status.Error(codes.Internal, fmt.Sprintf("ControllerExpandVolume failed to resize disk: %v", err))
680-
}
681-
682-
return &csi.ControllerExpandVolumeResponse{
683-
CapacityBytes: common.GbToBytes(resizedGb),
684-
NodeExpansionRequired: true,
685-
}, nil
662+
return nil, status.Error(codes.Unimplemented, "ControllerExpandVolume is not yet implemented")
686663
}
687664

688665
func (gceCS *GCEControllerServer) getSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {

pkg/gce-pd-csi-driver/gce-pd-driver.go

-2
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,10 @@ func (gceDriver *GCEDriver) SetupGCEDriver(cloudProvider gce.GCECompute, mounter
6666
csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT,
6767
csi.ControllerServiceCapability_RPC_LIST_SNAPSHOTS,
6868
csi.ControllerServiceCapability_RPC_PUBLISH_READONLY,
69-
csi.ControllerServiceCapability_RPC_EXPAND_VOLUME,
7069
}
7170
gceDriver.AddControllerServiceCapabilities(csc)
7271
ns := []csi.NodeServiceCapability_RPC_Type{
7372
csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
74-
csi.NodeServiceCapability_RPC_EXPAND_VOLUME,
7573
}
7674
gceDriver.AddNodeServiceCapabilities(ns)
7775

0 commit comments

Comments
 (0)