Skip to content
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

Support annotation in VolumeSnapshot and VolumeSnapshotContent resources #2986

Merged
merged 28 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4bc7da9
WIP
saima-s Jul 17, 2024
43c1170
fix test and support annotation
saima-s Jul 17, 2024
dac2180
Add test for annotation support
saima-s Jul 23, 2024
42fe44a
Removed annotation support from kanister functions
saima-s Jul 23, 2024
98e0ef1
Removed annotation support from test
saima-s Jul 23, 2024
c3865d5
added logs
saima-s Jul 25, 2024
679a7ca
removed logs and fix linter issue
saima-s Jul 25, 2024
fae441e
Merge branch 'master' into orange/saima/support-snapshot-annotation
saima-s Jul 25, 2024
2b9fe1c
add comment on method definition
saima-s Jul 25, 2024
e49bb8f
Merge remote-tracking branch 'origin/orange/saima/support-snapshot-an…
saima-s Jul 25, 2024
8f8efcf
update test comment
saima-s Jul 25, 2024
c5f136d
Merge branch 'master' into orange/saima/support-snapshot-annotation
saima-s Jul 25, 2024
216a9ef
Fixed review comments
saima-s Jul 26, 2024
e03ba27
Fixed review comment with new struct
saima-s Jul 30, 2024
a3b15cc
Renamed struct
saima-s Jul 30, 2024
e1de82f
Renamed unused fields
saima-s Jul 30, 2024
3de7196
fix linter goimport and added comments to functions.
saima-s Jul 30, 2024
5ed6db4
fix review comment
saima-s Jul 30, 2024
20f8818
add release notes and fix review comments
saima-s Aug 1, 2024
043d6a6
fix review comment
saima-s Aug 1, 2024
0a455e9
fix review comments
saima-s Aug 1, 2024
b27193d
Merge branch 'master' into orange/saima/support-snapshot-annotation
saima-s Aug 2, 2024
cbbe269
fix review comments for fixing comments
saima-s Aug 2, 2024
39a1f2f
fix release notes
saima-s Aug 2, 2024
1d6e2e3
Update pkg/kube/snapshot/types.go
saima-s Aug 5, 2024
3d62652
Merge branch 'master' into orange/saima/support-snapshot-annotation
saima-s Aug 5, 2024
a4f271e
fix review comment on test
saima-s Aug 5, 2024
1dc0df3
Merge branch 'master' into orange/saima/support-snapshot-annotation
saima-s Aug 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkg/function/create_csi_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ func (*createCSISnapshotFunc) Arguments() []string {
}

func createCSISnapshot(ctx context.Context, snapshotter snapshot.Snapshotter, name, namespace, pvc, snapshotClass string, wait bool, labels map[string]string) (*v1.VolumeSnapshot, error) {
if err := snapshotter.Create(ctx, name, namespace, pvc, &snapshotClass, wait, labels); err != nil {
snapshotMeta := snapshot.ObjectMeta{
Name: name,
Namespace: namespace,
Labels: labels,
Annotations: nil,
}
if err := snapshotter.Create(ctx, pvc, &snapshotClass, wait, snapshotMeta); err != nil {
return nil, err
}
vs, err := snapshotter.Get(ctx, name, namespace)
Expand Down
6 changes: 5 additions & 1 deletion pkg/function/create_csi_snapshot_static.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ func createCSISnapshotStatic(
Driver: driver,
VolumeSnapshotClassName: snapshotClass,
}
if err := snapshotter.CreateFromSource(ctx, source, name, namespace, wait, nil); err != nil {
snapshotMeta := snapshot.ObjectMeta{
Name: name,
Namespace: namespace,
}
if err := snapshotter.CreateFromSource(ctx, source, wait, snapshotMeta, snapshot.ObjectMeta{}); err != nil {
saima-s marked this conversation as resolved.
Show resolved Hide resolved
return nil, err
}

Expand Down
12 changes: 8 additions & 4 deletions pkg/function/delete_csi_snapshot_content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,15 @@ func (testSuite *DeleteCSISnapshotContentTestSuite) TestDeleteCSISnapshotContent
Driver: driver,
VolumeSnapshotClassName: snapshotClassName,
}
fakeSnapshotMeta := snapshot.ObjectMeta{
Name: snapshotName,
Namespace: snapshotNamespace,
}
fakeSnapshotContentMeta := snapshot.ObjectMeta{
Name: snapshotContentName,
}
err = fakeSnapshotter.CreateContentFromSource(ctx, source,
snapshotContentName,
snapshotName,
snapshotNamespace,
deletionPolicy)
deletionPolicy, fakeSnapshotMeta, fakeSnapshotContentMeta)
c.Assert(err, IsNil)

gv := strings.Split(api.GroupVersion, "/")
Expand Down
7 changes: 5 additions & 2 deletions pkg/function/delete_csi_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ func (testSuite *DeleteCSISnapshotTestSuite) TestDeleteCSISnapshot(c *C) {
}
_, err = fakeCli.CoreV1().PersistentVolumeClaims(testSuite.namespace).Create(ctx, originalPVC, metav1.CreateOptions{})
c.Assert(err, IsNil)

err = fakeSnapshotter.Create(ctx, testSuite.snapName, testSuite.namespace, testSuite.pvcName, &testSuite.volumeSnapshotClass, false, nil)
fakeSnapshotMeta := snapshot.ObjectMeta{
Name: testSuite.snapName,
Namespace: testSuite.namespace,
}
err = fakeSnapshotter.Create(ctx, testSuite.pvcName, &testSuite.volumeSnapshotClass, false, fakeSnapshotMeta)
c.Assert(err, IsNil)

vs, err := fakeSnapshotter.Get(ctx, testSuite.snapName, testSuite.namespace)
Expand Down
7 changes: 5 additions & 2 deletions pkg/function/restore_csi_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ func (testSuite *RestoreCSISnapshotTestSuite) TestRestoreCSISnapshot(c *C) {

originalPVC := getOriginalPVCManifest(testSuite.pvcName, testSuite.storageClass)
createPVC(c, testSuite.namespace, originalPVC, fakeCli)

err = fakeSnapshotter.Create(ctx, testSuite.snapName, testSuite.namespace, testSuite.pvcName, &testSuite.volumeSnapshotClass, false, nil)
fakeSnapshotMeta := snapshot.ObjectMeta{
Name: testSuite.snapName,
Namespace: testSuite.namespace,
}
err = fakeSnapshotter.Create(ctx, testSuite.pvcName, &testSuite.volumeSnapshotClass, false, fakeSnapshotMeta)
c.Assert(err, IsNil)

vs, err := fakeSnapshotter.Get(ctx, testSuite.snapName, testSuite.namespace)
Expand Down
104 changes: 52 additions & 52 deletions pkg/kube/snapshot/mocks/mock_snapshotter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading