-
Notifications
You must be signed in to change notification settings - Fork 547
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
cephfs: use shallow volumes for the ROX accessMode #3651
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1617,8 +1617,8 @@ var _ = Describe(cephfsType, func() { | |||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to delete CephFS storageclass: %v", 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. Is this extra line required? IMO, you can remove this. |
||||||||||||
err = createCephfsStorageClass(f.ClientSet, f, false, map[string]string{ | ||||||||||||
"backingSnapshot": "true", | ||||||||||||
"encrypted": "true", | ||||||||||||
"encryptionKMSID": kmsID, | ||||||||||||
}) | ||||||||||||
|
@@ -1759,12 +1759,136 @@ var _ = Describe(cephfsType, func() { | |||||||||||
framework.Failf("failed to get SHA512 sum for file: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
pvcClone, err := loadPVC(pvcClonePath) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to load PVC: %v", err) | ||||||||||||
} | ||||||||||||
// Snapshot-backed volumes support read-only access modes only. | ||||||||||||
pvcClone.Spec.AccessModes = []v1.PersistentVolumeAccessMode{v1.ReadOnlyMany} | ||||||||||||
appClone, err := loadApp(appClonePath) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to load application: %v", err) | ||||||||||||
} | ||||||||||||
appCloneLabels := map[string]string{ | ||||||||||||
appKey: appCloneLabel, | ||||||||||||
} | ||||||||||||
appClone.Labels = appCloneLabels | ||||||||||||
optAppClone := metav1.ListOptions{ | ||||||||||||
LabelSelector: fmt.Sprintf("%s=%s", appKey, appCloneLabels[appKey]), | ||||||||||||
} | ||||||||||||
pvcClone.Namespace = f.UniqueName | ||||||||||||
appClone.Namespace = f.UniqueName | ||||||||||||
err = createPVCAndApp("", f, pvcClone, appClone, deployTimeout) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to create PVC and app: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
// Snapshot-backed volume shouldn't contribute to total subvolume count. | ||||||||||||
validateSubvolumeCount(f, 1, fileSystemName, subvolumegroup) | ||||||||||||
|
||||||||||||
// Deleting snapshot before deleting pvcClone should succeed. It will be | ||||||||||||
// deleted once all volumes that are backed by this snapshot are gone. | ||||||||||||
err = deleteSnapshot(&snap, deployTimeout) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to delete snapshot: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
appCloneTestFilePath := appClone.Spec.Containers[0].VolumeMounts[0].MountPath + "/test" | ||||||||||||
|
||||||||||||
snapFileSum, err := calculateSHA512sum(f, appClone, appCloneTestFilePath, &optAppClone) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to get SHA512 sum for file: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
if parentFileSum == snapFileSum { | ||||||||||||
framework.Failf("SHA512 sums of files in parent subvol and snapshot should differ") | ||||||||||||
} | ||||||||||||
|
||||||||||||
err = deletePVCAndApp("", f, pvcClone, appClone) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to delete PVC or application: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
validateCephFSSnapshotCount(f, 0, subvolumegroup, pv) | ||||||||||||
|
||||||||||||
err = deletePVCAndApp("", f, pvc, app) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to delete PVC or application: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
err = deleteResource(cephFSExamplePath + "storageclass.yaml") | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to delete CephFS storageclass: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
err = createCephfsStorageClass(f.ClientSet, f, false, nil) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to create CephFS storageclass: %v", err) | ||||||||||||
} | ||||||||||||
}) | ||||||||||||
|
||||||||||||
By("checking snapshot-backed volume by backing snapshot as false", func() { | ||||||||||||
pvc, err := loadPVC(pvcPath) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to load PVC: %v", err) | ||||||||||||
} | ||||||||||||
pvc.Namespace = f.UniqueName | ||||||||||||
err = createPVCAndvalidatePV(f.ClientSet, pvc, deployTimeout) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to create PVC: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
_, pv, err := getPVCAndPV(f.ClientSet, pvc.Name, pvc.Namespace) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to get PV object for %s: %v", pvc.Name, err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
app, err := loadApp(appPath) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to load application: %v", err) | ||||||||||||
} | ||||||||||||
app.Namespace = f.UniqueName | ||||||||||||
app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvc.Name | ||||||||||||
appLabels := map[string]string{ | ||||||||||||
appKey: appLabel, | ||||||||||||
} | ||||||||||||
app.Labels = appLabels | ||||||||||||
optApp := metav1.ListOptions{ | ||||||||||||
LabelSelector: fmt.Sprintf("%s=%s", appKey, appLabels[appKey]), | ||||||||||||
} | ||||||||||||
err = writeDataInPod(app, &optApp, f) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to write data: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
appTestFilePath := app.Spec.Containers[0].VolumeMounts[0].MountPath + "/test" | ||||||||||||
|
||||||||||||
snap := getSnapshot(snapshotPath) | ||||||||||||
snap.Namespace = f.UniqueName | ||||||||||||
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name | ||||||||||||
err = createSnapshot(&snap, deployTimeout) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to create snapshot: %v", err) | ||||||||||||
} | ||||||||||||
validateCephFSSnapshotCount(f, 1, subvolumegroup, pv) | ||||||||||||
|
||||||||||||
err = appendToFileInContainer(f, app, appTestFilePath, "hello", &optApp) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to append data: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
parentFileSum, err := calculateSHA512sum(f, app, appTestFilePath, &optApp) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to get SHA512 sum for file: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
err = deleteResource(cephFSExamplePath + "storageclass.yaml") | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to delete CephFS storageclass: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
err = createCephfsStorageClass(f.ClientSet, f, false, map[string]string{ | ||||||||||||
"backingSnapshot": "true", | ||||||||||||
"backingSnapshot": "false", | ||||||||||||
}) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to create CephFS storageclass: %v", err) | ||||||||||||
|
@@ -1794,15 +1918,15 @@ var _ = Describe(cephfsType, func() { | |||||||||||
framework.Failf("failed to create PVC and app: %v", err) | ||||||||||||
} | ||||||||||||
|
||||||||||||
// Snapshot-backed volume shouldn't contribute to total subvolume count. | ||||||||||||
validateSubvolumeCount(f, 1, fileSystemName, subvolumegroup) | ||||||||||||
validateSubvolumeCount(f, 2, fileSystemName, subvolumegroup) | ||||||||||||
|
||||||||||||
// Deleting snapshot before deleting pvcClone should succeed. It will be | ||||||||||||
// deleted once all volumes that are backed by this snapshot are gone. | ||||||||||||
Comment on lines
1922
to
1924
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.
Suggested change
check snapshot count right after deletesnapshoy |
||||||||||||
err = deleteSnapshot(&snap, deployTimeout) | ||||||||||||
if err != nil { | ||||||||||||
framework.Failf("failed to delete snapshot: %v", err) | ||||||||||||
} | ||||||||||||
validateCephFSSnapshotCount(f, 0, subvolumegroup, pv) | ||||||||||||
|
||||||||||||
appCloneTestFilePath := appClone.Spec.Containers[0].VolumeMounts[0].MountPath + "/test" | ||||||||||||
|
||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@riya-singhal31 Here you say the default is
true
. However, I looked a bit at the code and it seems there are 3 options:backingSnapshot
istrue
, then the volume is backed by a snapshot or, if that's not possible, an error is returned.backingSnapshot
isfalse
, then the volume is never backed by a snapshot.backingSnapshot
is not set, then the volume is backed by a snapshot if supported (i.e.,IsShallowVolumeSupported(req)
returns true.Is my interpretation of the source code correct? If yes, then you cannot say that the default is
true
, because the default behavior deviates from the behavior in thetrue
/false
cases.