-
Notifications
You must be signed in to change notification settings - Fork 813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to csi-proxy v1 APIs #966
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wongma7 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold it's ready for review but #965 should merge first and I'll rebase. |
/hold cancel |
cleanVolumeID := strings.ReplaceAll(volumeID, "-", "") | ||
if strings.Contains(serialNumber, cleanVolumeID) { | ||
foundDiskNumber = diskNumber | ||
foundDiskNumber = strconv.Itoa(int(diskNumber)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the prior behavior broken?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously the map was map[string], now it's map[uint32]
Path: normalizeWindowsPath(path), | ||
Context: fs.PathContext_POD, | ||
Force: true, | ||
Path: normalizeWindowsPath(path), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason the Context field is no longer set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't exist in API anymore, there is just one path versus having pod/plugin path being exactly the same kubernetes-csi/csi-proxy#149
@@ -238,26 +237,31 @@ func (mounter *CSIProxyMounter) FindDiskByLun(lun string) (diskNum string, err e | |||
// If match is found then return back the disk number. | |||
for diskID, location := range findDiskByLunResponse.DiskLocations { | |||
if strings.EqualFold(location.LUNID, lun) { | |||
return diskID, nil | |||
return strconv.Itoa(int(diskID)), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: small utility func for the conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which part, the for loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw this FindDiskByLun function is copy/pasted to satisfy mounter interface , we don't use it anywhere.
volumeMounts: | ||
- name: kubelet-dir | ||
mountPath: C:\var\lib\kubelet | ||
mountPropagation: "None" | ||
- name: plugin-dir | ||
mountPath: C:\csi | ||
- name: csi-proxy-disk-pipe | ||
mountPath: \\.\pipe\csi-proxy-disk-v1beta2 | ||
mountPath: \\.\pipe\csi-proxy-disk-v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the mount path have a version in it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is the way csi-proxy works, it drops a socket at a path for each api it serves
/lgtm |
Is this a bug fix or adding new feature? feature
What is this PR about? / Why do we need it? https://github.com/kubernetes-csi/csi-proxy/releases/tag/client%2Fv1.0.0-rc.1 csi-proxy GA is coming , need to test it
Changes are mostly straightforward renaming/refactoring.
Plus DiskNumber is treated as uint32 now instead of string by csi-proxy, so there is some conversion happening, but it should be safe in any case:
First we call ListDiskIDs which returns map[uint32]*DiskIDs where the uint32 is diskNumber. Then we convert it to a string since findDevicePath ought to return a string. Later we pass this string to FormatAndMount which converts it back to a uint32 in order to pass it to csi-proxy APIs PartitionDisk and ListVolumesOnDisk.
ListDiskIDs for reference: https://github.com/kubernetes-csi/csi-proxy/blob/d2c1b5469ddc8718c8d2ea679af074db620c9b05/client/api/disk/v1/api.pb.go#L441-L448
TODO
What testing is done?
I will manually test exactly the same way I tested the beta API implementation: #823:
build and push to my own registry.
create cluster with windows node. edit windows daemonset to say image: public.ecr.aws/b5w6x5z2/aws-ebs-csi-driver:windows