-
Notifications
You must be signed in to change notification settings - Fork 380
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
Added the feature to use secrets of ListSnapshots #252
Changes from 6 commits
3b76de4
4017329
2045ef1
0a1579d
dd390a3
8e9680a
7cbcf6a
3c2baf4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,10 +252,33 @@ func (ctrl *csiSnapshotSideCarController) checkandUpdateContentStatusOperation(c | |
var readyToUse = false | ||
var driverName string | ||
var snapshotID string | ||
var snapshotterListCredentials map[string]string | ||
|
||
if content.Spec.Source.SnapshotHandle != nil { | ||
klog.V(5).Infof("checkandUpdateContentStatusOperation: call GetSnapshotStatus for snapshot which is pre-bound to content [%s]", content.Name) | ||
readyToUse, creationTime, size, err = ctrl.handler.GetSnapshotStatus(content) | ||
|
||
if content.Spec.VolumeSnapshotClassName != nil { | ||
class, err := ctrl.getSnapshotClass(*content.Spec.VolumeSnapshotClassName) | ||
if err != nil { | ||
klog.Errorf("Failed to get snapshot class %s for snapshot content %s", *content.Spec.VolumeSnapshotClassName, err) | ||
return nil, fmt.Errorf("failed to get snapshot class %s for snapshot content %s", *content.Spec.VolumeSnapshotClassName, err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
} | ||
|
||
snapshotterListSecretRef, err := utils.GetSecretReference(utils.SnapshotterListSecretParams, class.Parameters, content.GetObjectMeta().GetName(), nil) | ||
if err != nil { | ||
klog.Errorf("Failed to get secret reference for snapshot %s: %s", content.Name, err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/for snapshot/for snapshot content There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also can you use "%v" to print err? |
||
return nil, fmt.Errorf("failed to get secret reference for snapshot %s: %s", content.Name, err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
} | ||
|
||
snapshotterListCredentials, err = utils.GetCredentials(ctrl.client, snapshotterListSecretRef) | ||
if err != nil { | ||
// Continue with deletion, as the secret may have already been deleted. | ||
klog.Errorf("Failed to get credentials for snapshot %s: %s", content.Name, err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/for snapshot/for snapshot content There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use %v to print err |
||
return nil, fmt.Errorf("failed to get credentials for snapshot %s: %s", content.Name, err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
} | ||
} | ||
|
||
readyToUse, creationTime, size, err = ctrl.handler.GetSnapshotStatus(content, snapshotterListCredentials) | ||
if err != nil { | ||
klog.Errorf("checkandUpdateContentStatusOperation: failed to call get snapshot status to check whether snapshot is ready to use %q", err) | ||
return nil, err | ||
|
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.
klog.Errorf("Failed to get snapshot class %s for snapshot content %s: %v", *content.Spec.VolumeSnapshotClassName, content.Name, err)