-
Notifications
You must be signed in to change notification settings - Fork 21
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
Allow relative paths for mounting volumes #133
Comments
Hi scomtott@, thanks for raising this. This kind of use case has come up before, and it's a bit tricky, so it would be good to think it through. I don't think relative paths solve the issue either (where are these files relative to the One thing to say about The essential issue here is we want to inject some external configuration which we don't want to master with the source. That means we can't make any guarantees about its reproducibility. I'm not sure I have a solution for this yet which is satisfactorily ergonomic. One way you might solve this now is using the volumes feature to add a volume which persists between runs. You could even add a step in Typically these volumes are used as build caches, but there's no reason they need to be. You could even link the backing directory to I'm no longer a switchy, I moved on about a year ago, so I can't see inside your slack archives I'm afraid. @maxdymond can, but just be wary of cross posting/linking internal things. |
The way I envisioned this working was having first-class citizenship for some kinds of files - kubeconfig would be one of these (lives in a well-known location). Having said that, it moves the line between reproducible environment and "ease of use". Maybe my pitch is "You can enable some files to be mapped, but a friendly warning is printed out that your environment might not be reproducible because of it". |
@rlupton20 Thank you for your in depth response and apologies about the internal links - I (wrongly) assumed that the only people working on this would be Metaswitch people. (For reference the Slack link was somebody essentially asking for the same thing that I am asking for). What I'm trying to achieve is to have a specific kubeconfig file injected in to the right place in the container - this may also not be the same as having the person's well-known-locaiton kubeconfig injected in as per @maxdymond's suggestion. Having relative paths should solve this because I can make sure that the file exists at the right place relative to where the floki.yaml file is in the git repo. An init step mounting a volume and making sure that the right file is in that volume would work fine so long as the same volume can still be mounted in different use cases (virtual machine or not for example). I'm not quite sure about how to do this though. |
@scomtott no worries about the links :-). Is the kubeconfig file part of the git repo? If so, could you symlink it into place in @maxdymond it's a thought. I'm allergic to special features for special situations (there are similar problems with AWS, Azure, OpenStack etc) but your pitch is open enough that there may be some room to play with here. I think it's ok to sacrifice some reproducibility (I guess we don't want auth to be reproducible...), provided the ergonomics stay reasonable. To draw some distinctions we really want
A first, although I'm not sold on this, way to do this might be to have
and have floki keep a folder of symlinks/directories with symlinks which it generates on first run
I don't like it, but its a start. Another possibility I thought of was to create a The cheap and cheerful approach might be just to .gitignore a file in your repo, and check in something blank there, then have A few thoughts. I'm not sold on any in particular atm. |
Yes the kubeconfig will be part of the git repo - I can try that. |
An alternative approach (that would work with |
Hopefully this is helpful feedback (and it is certainly intended as such) but I gave up and wrote my own Dockerfile. |
That's another way to do it - I'd rather decouple the hacks to get something working v.s. figuring out if there are enhancements we should make here, so I'm glad you have a solution. I think @bossmc has the best workaround for now. @scomtott are you happy for me to repurpose the issue to track thoughts and ideas to make this |
@rlupton20 No problem. |
Hi, my team has very similar case, although we're not storing kube config in git but want to use the one user has in his home. I was thinking that if you're OK to sacrifice reproducibility a bit, then maybe Floki could parse and expand environment variables from the yaml file? Both docker compose and VSCode's dev containers does that. This could even be limited to the |
There does seem to be a general problem around this that needs a solution, so yeah, perhaps it's worth thinking it through a little more deeply. If we want to capture environment variables, we can do that, and even have floki enforce that they are set. I'm using reproducibility a little loosely, what I really mean is that people ought to be able to use a build environment with minimal faff. Maybe if Another possibility with the above is to have a global volume and link the kubeconfig into it. You can script the init section to test for the existence of the file. I've also been toying with the idea of running a floki auth container that you can link as a sidecar (ala dind), and then some kind of wizard style interface to link credentials/config into the container, but this seems overly complex. |
I was rather thinking that Floki could just expand the variables in the yaml. I could then do:
(sorry if I got the syntax wrong) This could solve both use cases and possibly more. |
It would be useful to be able to mount a volume from the current directory rather than specifying an absolute path with:
`docker_switches:
Floki is intended to create reproducible containers with the minimum amount of pre-setup. By only allowing absolute paths in volume mounting, a difference in behaviour is created if another user has a different file structure.
The text was updated successfully, but these errors were encountered: