stage1/fly: respect runtimeApp App's MountPoints #2852
Conversation
Should this logic live in |
I'll look into that after we have tests in place on all ends so I can prevent breakage. |
This doesn't fix all differences between mounts in coreos and fly. For example, duplicate container targets in coreos are handled (with the first one winning), while here it ends up with a rather odd error. For example:
The above prints out the contents of the host I can file a separate issue if you'd like, or we can handle that here. Switching to the |
imAppManifestMPs := imApp.MountPoints | ||
for _, mp := range imAppManifestMPs { | ||
tuple, exists := namedVolumeMounts[mp.Name] | ||
switch { |
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.
I don't think using a switch over if/else-if helps readability in this case.
Please file a separate issue since this is not a regression related to this PR or the issue it's handling. |
} | ||
} | ||
|
||
// } |
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.
?
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.
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.
Is there a reason not to remove them both? The top comment is clear since it applies to the rest of the file anyways
Is this something you can do now that we have tests? Maybe we can do it in a follow-up? |
@@ -110,15 +110,24 @@ func init() { | |||
flag.StringVar(&discardString, "local-config", common.DefaultLocalConfigDir, "Local config path") | |||
} | |||
|
|||
func checkAndAddMps(namedVolumeMounts map[types.ACName]volumeMountTuple, mountpoints []types.MountPoint) error { |
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.
can we improve the naming, i.e. simply "addMountpoints"? Since this method returns an error, checking is implied.also mountpoints []types.MountPoint
stutters, i.e. name it mps
instead?
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.
Maybe even call namedVolumeMounts
simply target
, and mountpoints
simply src
.
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.
Maybe even call namedVolumeMounts simply target, and mountpoints simply src.
Would you rename this only in the function or also in the caller? I kept the naming from there.
I'd tackle this with a follow-up, there is more to do than just to refactor as I talked through OOB with @euank last week. |
* Fixes a bug where MountPoints from the PodManifest App's weren't processed * Refactor code and add comments
func addMountPoints(namedVolumeMounts map[types.ACName]volumeMountTuple, mountpoints []types.MountPoint) error { | ||
for _, mp := range mountpoints { | ||
tuple, exists := namedVolumeMounts[mp.Name] | ||
switch { |
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.
Minor nit for future reference, you can use switch tuple, exists := namedVolumeMounts[mp.Name]; {
Building the PR, I investigated the #2846 and couldn't reproduce the bug, LGTM |
Fixes #2846.
I'm not positive that all the implementation of the different App types and MountPoints really reflect the specs, but this change reproduces what stage1-coreos does.
/cc @iaguis