Skip to content

Commit 76d75b3

Browse files
committed
Removed fixed TODOs and tagged issue numbers in remaining ones
1 parent 432526c commit 76d75b3

File tree

17 files changed

+50
-68
lines changed

17 files changed

+50
-68
lines changed

Diff for: deploy/kubernetes/dev/node.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#TODO: Force DaemonSet to not run on master.
1+
#TODO(#40): Force DaemonSet to not run on master.
22
kind: DaemonSet
33
apiVersion: apps/v1
44
metadata:
@@ -52,7 +52,7 @@ spec:
5252
- name: device-dir
5353
mountPath: /host/dev
5454
volumes:
55-
# TODO(dependency): this will work when kublet registrar functionality exists
55+
# TODO(#92): this will work when kublet registrar functionality exists
5656
#- name: registrar-socket-dir
5757
# hostPath:
5858
# path: /var/lib/kubelet/device-plugins/

Diff for: pkg/gce-cloud-provider/compute/gce-compute.go

-2
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ func (cloud *CloudProvider) getRegionalDiskTypeURI(region, diskType string) stri
380380
func (cloud *CloudProvider) waitForZonalOp(ctx context.Context, op *compute.Operation, zone string) error {
381381
svc := cloud.service
382382
project := cloud.project
383-
// TODO: Double check that these timeouts are reasonable
384383
return wait.Poll(3*time.Second, 5*time.Minute, func() (bool, error) {
385384
pollOp, err := svc.ZoneOperations.Get(project, zone, op.Name).Context(ctx).Do()
386385
if err != nil {
@@ -393,7 +392,6 @@ func (cloud *CloudProvider) waitForZonalOp(ctx context.Context, op *compute.Oper
393392
}
394393

395394
func (cloud *CloudProvider) waitForRegionalOp(ctx context.Context, op *computebeta.Operation, region string) error {
396-
// TODO: Double check that these timeouts are reasonable
397395
return wait.Poll(3*time.Second, 5*time.Minute, func() (bool, error) {
398396
pollOp, err := cloud.betaService.RegionOperations.Get(cloud.project, region, op.Name).Context(ctx).Do()
399397
if err != nil {

Diff for: pkg/gce-cloud-provider/compute/gce.go

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ func createBetaCloudService(vendorVersion string) (*beta.Service, error) {
9494
}
9595

9696
func createCloudService(vendorVersion string) (*compute.Service, error) {
97-
// TODO: support alternate methods of authentication
9897
svc, err := createCloudServiceWithDefaultServiceAccount(vendorVersion)
9998
return svc, err
10099
}

Diff for: pkg/gce-pd-csi-driver/controller.go

+7-15
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ import (
3434
metadataservice "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/gce-cloud-provider/metadata"
3535
)
3636

37-
// TODO: Add noisy glog.V(5).Infof() EVERYWHERE
38-
// TODO: Improve errors to only expose codes at top level
39-
// TODO: Improve error prefix to explicitly state what function it is in.
40-
4137
type GCEControllerServer struct {
4238
Driver *GCEDriver
4339
CloudProvider gce.GCECompute
@@ -82,9 +78,10 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
8278
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("CreateVolume Request Capacity is invalid: %v", err))
8379
}
8480

85-
// TODO: Validate volume capabilities
81+
// TODO(#94): Validate volume capabilities
82+
83+
// TODO(#93): Support fs type parameter
8684

87-
// TODO: Support fs type. Can vendor in api-machinery stuff for sets etc.
8885
// Apply Parameters (case-insensitive). We leave validation of
8986
// the values to the cloud provider.
9087
diskType := "pd-standard"
@@ -180,8 +177,6 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
180177
}
181178

182179
func (gceCS *GCEControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
183-
// TODO: Only allow deletion of volumes that were created by the driver
184-
// Assuming ID is of form {zone}/{id}
185180
glog.V(4).Infof("DeleteVolume called with request %v", *req)
186181

187182
// Validate arguments
@@ -228,10 +223,9 @@ func (gceCS *GCEControllerServer) ControllerPublishVolume(ctx context.Context, r
228223
return nil, status.Error(codes.NotFound, fmt.Sprintf("Could not find volume with ID %v: %v", volumeID, err))
229224
}
230225

231-
// TODO: Check volume capability matches
226+
// TODO(#94): Check volume capability matches
232227

233228
pubVolResp := &csi.ControllerPublishVolumeResponse{
234-
// TODO: Info gets sent to NodePublishVolume. Send something if necessary.
235229
PublishInfo: nil,
236230
}
237231

@@ -336,7 +330,7 @@ func (gceCS *GCEControllerServer) ControllerUnpublishVolume(ctx context.Context,
336330
}
337331

338332
func (gceCS *GCEControllerServer) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
339-
// TODO: Factor out the volume capability functionality and use as validation in all other functions as well
333+
// TODO(#94): Factor out the volume capability functionality and use as validation in all other functions as well
340334
glog.V(5).Infof("Using default ValidateVolumeCapabilities")
341335
// Validate Arguments
342336
if req.GetVolumeCapabilities() == nil || len(req.GetVolumeCapabilities()) == 0 {
@@ -449,7 +443,6 @@ func (gceCS *GCEControllerServer) ListSnapshots(ctx context.Context, req *csi.Li
449443
}
450444

451445
func getRequestCapacity(capRange *csi.CapacityRange) (int64, error) {
452-
// TODO: Take another look at these casts/caps. Make sure this func is correct
453446
var capBytes int64
454447
// Default case where nothing is set
455448
if capRange == nil {
@@ -499,7 +492,7 @@ func diskIsAttachedAndCompatible(volume *gce.CloudDisk, instance *compute.Instan
499492
if disk.Mode != readWrite {
500493
return true, fmt.Errorf("disk mode does not match. Got %v. Want %v", disk.Mode, readWrite)
501494
}
502-
// TODO: Check volume_capability.
495+
// TODO(#94): Check volume_capability.
503496
return true, nil
504497
}
505498
}
@@ -532,7 +525,6 @@ func pickZonesFromTopology(top *csi.TopologyRequirement, numZones int) ([]string
532525
return nil, fmt.Errorf("need %v zones from topology, only got %v unique zones", numZones, reqSet.Union(prefSet).Len())
533526
}
534527
// Add the remaining number of zones into the set
535-
// TODO: Maybe we should pick a random set to get
536528
nSlice, err := pickRandAndConsecutive(remainingZones.List(), remainingNumZones)
537529
if err != nil {
538530
return nil, err
@@ -600,7 +592,7 @@ func getDefaultZonesInRegion(gceCS *GCEControllerServer, existingZones []string,
600592
return nil, fmt.Errorf("failed to get region from zones: %v", err)
601593
}
602594
needToGet := numZones - len(existingZones)
603-
totZones, err := gceCS.CloudProvider.ListZones(context.TODO(), region)
595+
totZones, err := gceCS.CloudProvider.ListZones(context.Background(), region)
604596
if err != nil {
605597
return nil, fmt.Errorf("failed to list zones from cloud provider: %v", err)
606598
}

Diff for: pkg/gce-pd-csi-driver/controller_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ func TestCreateVolumeArguments(t *testing.T) {
358358
}
359359

360360
// Start Test
361-
resp, err := gceDriver.cs.CreateVolume(context.TODO(), tc.req)
361+
resp, err := gceDriver.cs.CreateVolume(context.Background(), tc.req)
362362
//check response
363363
if err != nil {
364364
serverError, ok := status.FromError(err)
@@ -429,7 +429,7 @@ func TestCreateVolumeRandomRequisiteTopology(t *testing.T) {
429429
tZones := map[string]bool{}
430430
// Start Test
431431
for i := 0; i < 25; i++ {
432-
resp, err := gceDriver.cs.CreateVolume(context.TODO(), req)
432+
resp, err := gceDriver.cs.CreateVolume(context.Background(), req)
433433
if err != nil {
434434
t.Fatalf("CreateVolume did not expect error, but got %v", err)
435435
}
@@ -470,7 +470,7 @@ func TestDeleteVolume(t *testing.T) {
470470
// Setup new driver each time so no interference
471471
gceDriver := initGCEDriver(t)
472472

473-
_, err := gceDriver.cs.DeleteVolume(context.TODO(), tc.req)
473+
_, err := gceDriver.cs.DeleteVolume(context.Background(), tc.req)
474474
if err == nil && tc.expErr {
475475
t.Fatalf("Expected error but got none")
476476
}

Diff for: pkg/gce-pd-csi-driver/gce-pd-driver.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,10 @@ func (gceDriver *GCEDriver) Run(endpoint string) {
149149

150150
//Start the nonblocking GRPC
151151
s := NewNonBlockingGRPCServer()
152-
// TODO: Only start specific servers based on a flag.
152+
// TODO(#34): Only start specific servers based on a flag.
153153
// In the future have this only run specific combinations of servers depending on which version this is.
154154
// The schema for that was in util. basically it was just s.start but with some nil servers.
155+
155156
s.Start(endpoint, gceDriver.ids, gceDriver.cs, gceDriver.ns)
156157
s.Wait()
157158
}

Diff for: pkg/gce-pd-csi-driver/identity_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestGetPluginInfo(t *testing.T) {
3030
t.Fatalf("Failed to setup GCE Driver: %v", err)
3131
}
3232

33-
resp, err := gceDriver.ids.GetPluginInfo(context.TODO(), &csi.GetPluginInfoRequest{})
33+
resp, err := gceDriver.ids.GetPluginInfo(context.Background(), &csi.GetPluginInfoRequest{})
3434
if err != nil {
3535
t.Fatalf("GetPluginInfo returned unexpected error: %v", err)
3636
}
@@ -52,7 +52,7 @@ func TestGetPluginCapabilities(t *testing.T) {
5252
t.Fatalf("Failed to setup GCE Driver: %v", err)
5353
}
5454

55-
resp, err := gceDriver.ids.GetPluginCapabilities(context.TODO(), &csi.GetPluginCapabilitiesRequest{})
55+
resp, err := gceDriver.ids.GetPluginCapabilities(context.Background(), &csi.GetPluginCapabilitiesRequest{})
5656
if err != nil {
5757
t.Fatalf("GetPluginCapabilities returned unexpected error: %v", err)
5858
}
@@ -74,7 +74,7 @@ func TestProbe(t *testing.T) {
7474
t.Fatalf("Failed to setup GCE Driver: %v", err)
7575
}
7676

77-
_, err = gceDriver.ids.Probe(context.TODO(), &csi.ProbeRequest{})
77+
_, err = gceDriver.ids.Probe(context.Background(), &csi.ProbeRequest{})
7878
if err != nil {
7979
t.Fatalf("Probe returned unexpected error: %v", err)
8080
}

Diff for: pkg/gce-pd-csi-driver/node.go

+12-17
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ func (ns *GCENodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePub
7272
return nil, err
7373
}
7474
if !notMnt {
75-
// TODO: check if mount is compatible. Return OK if it is, or appropriate error.
76-
return nil, nil
75+
// TODO(#95): check if mount is compatible. Return OK if it is, or appropriate error.
76+
return nil, status.Error(codes.Unimplemented, "NodePublishVolume Mount point already exists, but cannot determine whether it is compatible or not")
7777
}
7878

7979
if err := ns.Mounter.Interface.MakeDir(targetPath); err != nil {
@@ -92,27 +92,27 @@ func (ns *GCENodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePub
9292
notMnt, mntErr := ns.Mounter.Interface.IsLikelyNotMountPoint(targetPath)
9393
if mntErr != nil {
9494
glog.Errorf("IsLikelyNotMountPoint check failed: %v", mntErr)
95-
return nil, status.Error(codes.Internal, fmt.Sprintf("TODO: %v", err))
95+
return nil, status.Error(codes.Internal, fmt.Sprintf("NodePublishVolume failed to check whether target path is a mount point: %v", err))
9696
}
9797
if !notMnt {
9898
if mntErr = ns.Mounter.Interface.Unmount(targetPath); mntErr != nil {
9999
glog.Errorf("Failed to unmount: %v", mntErr)
100-
return nil, status.Error(codes.Internal, fmt.Sprintf("TODO: %v", err))
100+
return nil, status.Error(codes.Internal, fmt.Sprintf("NodePublishVolume failed to unmount target path: %v", err))
101101
}
102102
notMnt, mntErr := ns.Mounter.Interface.IsLikelyNotMountPoint(targetPath)
103103
if mntErr != nil {
104104
glog.Errorf("IsLikelyNotMountPoint check failed: %v", mntErr)
105-
return nil, status.Error(codes.Internal, fmt.Sprintf("TODO: %v", err))
105+
return nil, status.Error(codes.Internal, fmt.Sprintf("NodePublishVolume failed to check whether target path is a mount point: %v", err))
106106
}
107107
if !notMnt {
108108
// This is very odd, we don't expect it. We'll try again next sync loop.
109109
glog.Errorf("%s is still mounted, despite call to unmount(). Will try again next sync loop.", targetPath)
110-
return nil, status.Error(codes.Internal, fmt.Sprintf("TODO: %v", err))
110+
return nil, status.Error(codes.Internal, fmt.Sprintf("NodePublishVolume something is wrong with mounting: %v", err))
111111
}
112112
}
113113
os.Remove(targetPath)
114114
glog.Errorf("Mount of disk %s failed: %v", targetPath, err)
115-
return nil, status.Error(codes.Internal, fmt.Sprintf("TODO: %v", err))
115+
return nil, status.Error(codes.Internal, fmt.Sprintf("NodePublishVolume mount of disk failed: %v", err))
116116
}
117117

118118
glog.V(4).Infof("Successfully mounted %s", targetPath)
@@ -133,7 +133,7 @@ func (ns *GCENodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeU
133133
return nil, status.Error(codes.InvalidArgument, "NodeUnpublishVolume Target Path must be provided")
134134
}
135135

136-
// TODO: Check volume still exists
136+
// TODO(#96): Check volume still exists
137137

138138
err := ns.Mounter.Interface.Unmount(targetPath)
139139
if err != nil {
@@ -167,10 +167,8 @@ func (ns *GCENodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStage
167167
return nil, err
168168
}
169169

170-
// TODO: Check volume still exists?
171-
172170
// Part 1: Get device path of attached device
173-
// TODO: Get real partitions
171+
// TODO(#83): Get real partitions
174172
partition := ""
175173

176174
devicePaths := ns.DeviceUtils.GetDiskByIdPaths(volumeKey.Name, partition)
@@ -199,9 +197,7 @@ func (ns *GCENodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStage
199197
}
200198

201199
if !notMnt {
202-
// TODO: Validate disk mode
203-
204-
// TODO: Check who is mounted here. No error if its us
200+
// TODO(#95): Check who is mounted here. No error if its us
205201
return nil, fmt.Errorf("already a mount point")
206202

207203
}
@@ -215,11 +211,10 @@ func (ns *GCENodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStage
215211
fstype = mnt.FsType
216212
}
217213
for _, flag := range mnt.MountFlags {
218-
// TODO: Not sure if MountFlags == options
219214
options = append(options, flag)
220215
}
221216
} else if blk := volumeCapability.GetBlock(); blk != nil {
222-
// TODO: Block volume support
217+
// TODO(#64): Block volume support
223218
return nil, status.Error(codes.Unimplemented, fmt.Sprintf("Block volume support is not yet implemented"))
224219
}
225220

@@ -283,7 +278,7 @@ func (ns *GCENodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRe
283278

284279
resp := &csi.NodeGetInfoResponse{
285280
NodeId: nodeID,
286-
// TODO: Set MaxVolumesPerNode based on Node Type
281+
// TODO(#19): Set MaxVolumesPerNode based on Node Type
287282
// Default of 0 means that CO Decides how many nodes can be published
288283
// Can get from metadata server "machine-type"
289284
MaxVolumesPerNode: 0,

Diff for: pkg/mount-manager/device-utils.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ const (
4949
defaultMountCommand = "mount"
5050
)
5151

52+
// DeviceUtils are a collection of methods that act on the devices attached
53+
// to a GCE Instance
5254
type DeviceUtils interface {
55+
// GetDiskByIdPaths returns a list of all possible paths for a
56+
// given Persistent Disk
5357
GetDiskByIdPaths(pdName string, partition string) []string
54-
// TODO: Info
58+
59+
// VerifyDevicePath returns the first of the list of device paths that
60+
// exists on the machine, or an empty string if none exists
5561
VerifyDevicePath(devicePaths []string) (string, error)
5662
}
5763

58-
// TODO: Info
5964
type deviceUtils struct {
6065
}
6166

@@ -91,7 +96,7 @@ func (m *deviceUtils) VerifyDevicePath(devicePaths []string) (string, error) {
9196
glog.Errorf("Error filepath.Glob(\"%s\"): %v\r\n", diskSDPattern, err)
9297
}
9398
sdBeforeSet := sets.NewString(sdBefore...)
94-
// TODO: Remove this udevadm stuff. Not applicable because can't access /dev/sd* from container
99+
// TODO(#69): Verify udevadm works as intended in driver
95100
if err := udevadmChangeToNewDrives(sdBeforeSet); err != nil {
96101
// udevadm errors should not block disk detachment, log and continue
97102
glog.Errorf("udevadmChangeToNewDrives failed with: %v", err)

Diff for: pkg/mount-manager/fake-safe-mounter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import "k8s.io/kubernetes/pkg/util/mount"
1919
func NewFakeSafeMounter() *mount.SafeFormatAndMount {
2020
execCallback := func(cmd string, args ...string) ([]byte, error) {
2121
return nil, nil
22-
// TODO: Fill out exec callback for errors
22+
// TODO(#48): Fill out exec callback for errors
2323
/*
2424
if len(test.execScripts) <= execCallCount {
2525
t.Errorf("Unexpected command: %s %v", cmd, args)

Diff for: test/e2e/tests/multi_zone_e2e_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ import (
3232
var _ = Describe("GCE PD CSI Driver Multi-Zone", func() {
3333
BeforeEach(func() {
3434
Expect(len(testInstances)).To(BeNumerically(">", 1))
35-
// TODO: Check whether the instances are in different zones???
36-
// I Think there should be a better way of guaranteeing this. Like a map from zone to instance for testInstances (?)
3735
})
3836

3937
It("Should get reasonable topology from nodes with NodeGetInfo", func() {
@@ -138,7 +136,7 @@ var _ = Describe("GCE PD CSI Driver Multi-Zone", func() {
138136
controllerClient.DeleteVolume(volId)
139137
Expect(err).To(BeNil(), "DeleteVolume failed")
140138

141-
// TODO: Validate Disk Deleted
139+
// Validate Disk Deleted
142140
_, err = betaComputeService.RegionDisks.Get(p, region, volName).Do()
143141
Expect(gce.IsGCEError(err, "notFound")).To(BeTrue(), "Expected disk to not be found")
144142
}()

0 commit comments

Comments
 (0)