You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After #354 the way of mounting volumes and host directories might be 'correcter' than before but neither the BindMounts nor the VolumeMounts field in ContainerRequest indicate in any way how to use them properly either by an example or an explanatory description and they behave now contrary to the CLI syntax most developers are used to.
I know there's a PR which 'fixes' the documentation issue already but I think when already breaking the API a typed solution might come in handy, also for #382 to support even more 'magical' things.
I propose to add the following types:
type ContainerMountSource interface
type HostMountSource struct{}
type VolumeMountSource struct{}
type ContainerMountTarget struct
the latter 3 could also be implemented as type ... string but I'd prefer to directly use structs e.g. to support multiple flags like readonly or even more advanced ones.
The fields BindMounts and VolumeMounts are then obsolete and a new Mounts map[ContainerMountTarget]ContainerMountSource or preferable Mounts []ContainerMounts could be introduced.
The latter slice based variant avoids confusion due to the current reversed 'target:src' syntax and internally it's still possible to convert the slice to a map to avoid duplicated targets and error before even starting the container.
If there's some interest in this I'd be glad to provide a PR but I thought I'd get some feedback in advance
The text was updated successfully, but these errors were encountered:
I implemented a first draft to illustrate what I mean and how it could look like when using it.
Also added some convenience methods. Could think of some more for different use cases.
Also parsing the different volume syntaxes could be implemented even though I'm not sure if there's a specific use case for it but that is up to you all?
After #354 the way of mounting volumes and host directories might be 'correcter' than before but neither the
BindMounts
nor theVolumeMounts
field inContainerRequest
indicate in any way how to use them properly either by an example or an explanatory description and they behave now contrary to the CLI syntax most developers are used to.I know there's a PR which 'fixes' the documentation issue already but I think when already breaking the API a typed solution might come in handy, also for #382 to support even more 'magical' things.
I propose to add the following types:
type ContainerMountSource interface
type HostMountSource struct{}
type VolumeMountSource struct{}
type ContainerMountTarget struct
the latter 3 could also be implemented as
type ... string
but I'd prefer to directly use structs e.g. to support multiple flags likereadonly
or even more advanced ones.The fields
BindMounts
andVolumeMounts
are then obsolete and a newMounts map[ContainerMountTarget]ContainerMountSource
or preferableMounts []ContainerMounts
could be introduced.The latter slice based variant avoids confusion due to the current reversed 'target:src' syntax and internally it's still possible to convert the slice to a map to avoid duplicated targets and error before even starting the container.
If there's some interest in this I'd be glad to provide a PR but I thought I'd get some feedback in advance
The text was updated successfully, but these errors were encountered: