-
Notifications
You must be signed in to change notification settings - Fork 158
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
Use dynamic client to create volume snapshots #629
Conversation
Remove external-snapshotter dep from snapshot pkg Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Refactor tests to resolve import conflicts Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
GetVolumeSnapshotClass checks if VolumeSnapshotClass exists with given annotations Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
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.
Couple of changes
) | ||
|
||
const ( | ||
pvcKind = "PersistentVolumeClaim" |
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.
PVCKind
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.
Should we export PVCKind
though we are not using it anywhere else?
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.
Its my opinion but these are well known and commonly used Kinds. Maybe they should be in a common kubernetes library, if they don't already exist. Not sure if the kubernetes client library has these defined but if it does we should use the ones they have instead of maintaining them ourselves.
return errors.Errorf("Failed to query target Volumesnapshot: %s, Namespace: %s: %v", cloneName, cloneNamespace, err) | ||
} | ||
|
||
src, err := sna.GetSource(ctx, name, namespace) |
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.
You already fetched the original snapshot once above, this would make a second call to get the same object. I suggest calling sna.getContent. or creating something like get source from snapshot
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.
Again you are doing two snapshot.Get() calls. you already have the snapshot object.
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.
Tell me why you want to resolve this. I think you can change the signature of GetSource to take a snapshot object and build a source. The only place this is used in K10 is in phase/snapshot.go line 316. and we're calling snapshot get before it there too. Theres no reason to make 2 calls to kubernetes to get the same snapshot
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.
I am sorry, I guess clicked "resolve" accidentally. I have another PR which already takes care of the optimisations. But we can address this here itself. In this PR, I have just moved the methods from snapshot.go to snapshot_alpha.go and changed the snapcli to dyncli without making any changes in existing workflow. I was thinking of handling optimisations in another PR
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
Change Overview
Use dynamic client to create volume snapshots
Remove external-snapshotter dep from snapshot pkg
New interface Snapshotter to perform snapshot operations
Remove external-snapshotter dep from kube/volume package
Pull request type
Please check the type of change your PR introduces:
Issues
Test Plan