Mount filtering handles job prefix names#174
Merged
Conversation
Signed-off-by: Nader Ziada <nader.ziada@broadcom.com>
Contributor
|
The RabbitMQ tile team have tested this branch in a tile build and it solves the problem for us. Thanks! |
selzoc
requested changes
Jul 9, 2024
Member
selzoc
left a comment
There was a problem hiding this comment.
I think that this should work, but I'm unsure if the "subset" approach is more valuable than just changing the HasPrefix to be (v.Path, filepath.Join(m.Destination, os.PathSeparator))
src/bpm/runc/adapter/adapter.go
Outdated
| // directory (that will already be mounted) so that we do not accidentally filter out mounts which | ||
| // have a name that is a sub-string of the existing job. For example the job `service-metrics` should be | ||
| // able to have an unrestricted volume mount of the `service-metrics-adapter` job directory. | ||
| boshMountDirParts := strings.Split(m.Destination, "/") |
Member
There was a problem hiding this comment.
Might be nicer to use filepath, which has knowledge of the separator used so you don't have to hardcode it to /.
Member
Author
There was a problem hiding this comment.
updated, to use filepath.SplitListfilepath.Separator
agree that the subset approach is more code. if feels somehow more "complete" or robust.
Check to see whether the "directory parts" of the volume are a sub-set of and existing BPM-default directory (that will already be mounted) so that we do not accidentally filter out mounts which have a name that is a sub-string of the existing job. For example the job `service-metrics` should be able to have an unrestricted volume mount of the `service-metrics-adapter` job directory. Specifically a job located at `/var/vcap/jobs/service-metrics` was unable to access an "unrestricted volume" located at `/var/vcap/jobs/service-metrics-adapter` because the job being instantiated alreay had default mount which was a (string) prefix of the job directory it was attempting to mount. Signed-off-by: Rajath Agasthya <rajath.agasthya@broadcom.com> Signed-off-by: aram price <aram.price@broadcom.com>
d44bb34 to
6a2f85d
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Check to see whether the "directory parts" of the volume are a sub-set
of and existing BPM-default directory (that will already be mounted) so
that we do not accidentally filter out mounts which have a name that is
a sub-string of the existing job. For example the job
service-metricsshould be able to have an unrestricted volume mount of the
service-metrics-adapterjob directory.Specifically a job located at
/var/vcap/jobs/service-metricswasunable to access an "unrestricted volume" located at
/var/vcap/jobs/service-metrics-adapterbecause the job beinginstantiated alreay had default mount which was a (string) prefix of the
job directory it was attempting to mount.