-
Notifications
You must be signed in to change notification settings - Fork 254
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
Mount block PVC rw in clone source pods #2944
Changes from all commits
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 |
---|---|---|
|
@@ -603,6 +603,12 @@ func GetPodsUsingPVCs(ctx context.Context, c client.Client, namespace string, na | |
onlyReadOnly = false | ||
} | ||
} | ||
for _, vm := range c.VolumeDevices { | ||
if vm.Name == volume.Name { | ||
// Node level rw mount and container can't mount block device ro | ||
onlyReadOnly = false | ||
} | ||
} | ||
Comment on lines
+606
to
+611
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. 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. Kind of. This will only cover cases where block PVCs are in the pod spec read/write but not referred to by a container. |
||
} | ||
if onlyReadOnly { | ||
// no rw mounts | ||
|
@@ -612,6 +618,12 @@ func GetPodsUsingPVCs(ctx context.Context, c client.Client, namespace string, na | |
// all mounts must be ro | ||
addPod = false | ||
} | ||
if strings.HasSuffix(pod.Name, common.ClonerSourcePodNameSuffix) && pod.Labels != nil && | ||
pod.Labels[common.CDIComponentLabel] == common.ClonerSourcePodName { | ||
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.
|
||
// Host assisted clone source pod only reads from source | ||
// But some drivers disallow mounting a block PVC ReadOnly | ||
addPod = false | ||
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. Several consecutive conditions lead to the same result (false addPod), would it be possible to clean-up this a little so we have it more condenssed? Maybe something like a 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. Yeah the whole function can be refactored but I prefer to stay on the safe side since this is going to backport all the way to 0.55 |
||
} | ||
} | ||
if addPod { | ||
pods = append(pods, pod) | ||
|
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.
Nice test