-
Notifications
You must be signed in to change notification settings - Fork 33
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
[PWX-30455] feat: volume-mount override via custom mount #1168
Changes from 2 commits
0b99808
e394504
0ec2b12
f23644f
57ff1df
cdc561f
cf58c2b
e105361
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 |
---|---|---|
|
@@ -1295,9 +1295,39 @@ func (t *template) getVolumeMounts() []v1.VolumeMount { | |
for _, fn := range extensions { | ||
volumeInfoList = append(volumeInfoList, fn()...) | ||
} | ||
volumeInfoList = t.overrideVolumeMount(volumeInfoList) | ||
return t.mountsFromVolInfo(volumeInfoList) | ||
} | ||
|
||
func (t *template) overrideVolumeMount(volInfos []volumeInfo) []volumeInfo { | ||
volPaths := map[string]int{} | ||
|
||
for i := range volInfos { | ||
volPaths[volInfos[i].mountPath] = i | ||
} | ||
|
||
for i := range t.cluster.Spec.Volumes { | ||
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. Looks like we'll take the This seems to be clashing with how the px-runc is working on the "lower level":
Is this code behaving the same? 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. the ticket requires allowing to existing mount paths with a custom hostpath |
||
v := t.cluster.Spec.Volumes[i] | ||
existingVolIdx, ok := volPaths[v.MountPath] | ||
if !ok { | ||
volInfos = append(volInfos, volumeInfo{ | ||
name: v.Name, | ||
readOnly: v.ReadOnly, | ||
hostPath: v.HostPath.String(), | ||
mountPath: v.MountPath, | ||
mountPropagation: v.MountPropagation, | ||
hostPathType: v.HostPath.Type, | ||
configMapType: v.ConfigMap, | ||
}) | ||
} else { | ||
volInfos[existingVolIdx].hostPath = v.HostPath.String() | ||
volInfos[existingVolIdx].mountPropagation = v.MountPropagation | ||
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. Why are we overriding only the host-path and the mount-propagation? Shouldn't we at least copy the mount-options (i.e. read-only)? 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. for existing mounts, if a stc yaml overrides the mount options then it could affect the functionality of porx |
||
} | ||
} | ||
|
||
return volInfos | ||
} | ||
|
||
func (t *template) mountsFromVolInfo(vols []volumeInfo) []v1.VolumeMount { | ||
volumeMounts := make([]v1.VolumeMount, 0, len(vols)) | ||
mountPathSet := make(map[string]bool) | ||
|
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.
Why is this called
overrideVolumeMount
?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.
we are not just filtering but also modifying the host path property inside the function