-
Notifications
You must be signed in to change notification settings - Fork 408
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 ko layers to stack cleanly #251
Comments
This is container-global, so we couldn't set it differently for each binary. |
yup |
This issue is stale because it has been open for 90 days with no |
We can just reuse the same directory. It's only a problem if the kodata directories have conflicting files, which we can detect and error out. I imagine the number of situations where there are both conflicting files and it's impossible to fix by using subdirectories withink kodata would be quite small. I'd be open to a PR that just detects a conflict? This also seems like a totally reasonable thing to have config for, so that each target can define where it wants the kodata directory to end up on the filesystem. |
Seeking clarification - @dprotaso, do you mean that ko currently supports building multi-binary images? Trying Or did you mean only that the current layer structure would allow for such a thing, but the (potential) kodata collision precludes supporting such a configuration? |
It's this. We haven't really considered building multibinary ko images, and kodata is the only real hard thing about it AFAIK. |
Is there a sense yet what the UI would look like? Leaving out kodata for the moment. Spitballing, but not knowing how other people (would) use this:
builds:
- id: foo
main: ./cmd/foo
imageName: foo-and-bar
- id: bar
main: ./cmd/bar
imageName: foo-and-bar
builds:
- id: foo
main: ./cmd/foo
- id: bar
main: ./cmd/bar
images:
- name: foo-and-bar
builds:
- foo
- bar |
There isn't really an idea what the UX would be yet. We'd need to start with a clear use case, and multiple users asking for it. Something like it should be possible today by hacking things together with some other tools like We'd need to see a clearer need for it to be built into ko itself since as you've noted it would need to change the UX quite a bit. So far ko has been designed to build single binary images, changing that would require more motivation. |
:nod: Yeah, my interest here is because I'd like this myself. (For a monorepo case, which is ... definitely a departure from what ko does currently.) I've got a kinda-hacky local branch that builds a single image, but nothing yet re: UI/UX. (Or kodata; my static assets are provided by my base image.) I'd love to hear more about |
I'm curious about your use case. If there are multiple binaries in an image, which one is the entrypoint? Do you just intend to shell out from one binary to the other? Or do you need some kind of init process? |
Kubernetes cluster - so the yml indicates which command is to be run for a given container. We could do a bunch of single-binary images, but the multi-binary image means only having to manage one docker repo and one built artifact. It just fits better into our current build-package-deploy model. (Which, pre-k8s, was a single tarball plopped on a host, with varying systemctl units depending on which role the host was playing.) Multi-binary also makes it easier to cover the use case of:
|
I am struggling to think of a way to fit this cleanly into One options might be to create a chain of We could drop into a new ko build if we find If you don't need the yaml templating parts of crane append -t repo.examle.com/merged \
-b $(ko publish ./foo) \
-f $(crane export $(ko publish ./bar) -) \
-f $(crane export $(ko publish ./baz) -) This would use |
Yeah that's more or less what I was envisioning. Since it's possible without modifying ko (though imperfectly) and not very clear how it would work in ko's UX, I'm inclined to not support this for the time being. |
Given discussion with #472 we could just allow users to set the entrypoint in container config and this seems actually pretty straightforward? |
This actually makes a lot of sense if you want to ship a binary like grpc-health-probe for use in Kubernetes, although this beta feature in 1.24 kinda prevents the need for it. |
Any updates on this request? |
Sometimes I'd like an image with two go binaries built with
ko
.ko
currently adds uniquely named binaries to to/ko-app
folder but it dumps allkodata
into the sameKO_DATA_PATH
. Thus one binary'skodata
could override the other.If each binary had it's data in a unique place setting WorkDir could be one work around - #55
Though I still think you would need a launcher/shim binary to set the correct WorkDir prior to running the executable we want.
The text was updated successfully, but these errors were encountered: