Repository navigation
Support for more driver types - #10714
Conversation
fb447ff to
d4b1d0d
Compare
e951d57 to
fa38f45
Compare
|
My main objection is that all these drivers could be shell scripts. And they would be easier to read... So shouldn't we just implement a simple shell hook system, convert these to builtin scripts, and allow users to configure their own script for customization? |
|
Also I think tight coupling of "which image to run" with "how to run it" into a single URI, is an anti-pattern and we should unwind it, not double down on it. |
|
From to get an engine image and CLI binary Tried it with Then I did a I moved my and I did notice that if I stopped things with then we don't try to |
I'm thinking that the Go interface and Go implementation might be easier to write and test, though. @shykes if we merged this, and we really wanted to get off Go implementations of drivers in
I was using the and successfully landed on a Dagger Engine in Apple Container instead of Docker taking precedence (or me not knowing the precedence order). |
|
@jpadams but how do I configure dagger to use |
I was doing this for testing to get a dev engine and CLI, but once merged/released, I believe you just use The order being the order in which they were registered:
*with the added detail of accepting the overrides of the |
sipsma
left a comment
There was a problem hiding this comment.
In terms of code this LGTM, so approving to unblock if the other discussions resolve w/out any major changes needed.
if we merged this, and we really wanted to get off Go implementations of drivers in dagger/dagger and move to an open shell-script approach, looks like it would be pretty contained surgery. So, I'd like to see us merge this, try it, get feedback and revisit later. Seems like most folks will use built-in defaults. More on that below.
I agree with this. I definitely don't mind the idea of shelling out to a binary that accepts commands/args implementing the interface we currently have in go (so that would include shell scripts and any other executable).
But that would be a bigger independent lift, so I'd rather merge this now for its improvements and switch to a different approach in a follow-up.
but how do I configure dagger to use container without forcing a particular image to be provisioned? In your case dagger-engine.dev. I still want the CLI to handle choosing the image for me.
To just use an existing container you'd do container://<container name> (or container+apple://<container name>, container+docker://<container name>, etc.)
When you specify image://<container name> or one of the runtime-specific variants, you are telling the CLI to do the whole provisioning of that image and then basically the same thing as container:// to actually connect.
I think this works pretty well. image:// is just a layer on top of container:// that does the extra provisioning too, but if you just want to connect to a container:// that's just as easy too.
|
@sipsma I'm fine with merging as-is, but IMO there's another set of changes we need to make before we can stabilize (eg. make the variable not experimental). This is because IMO, everything covered by these drivers is for the special case: engine developers and power users who don't mind "voiding the warranty" by provisioning the engine themselves. What's missing is a way for regular users, who want to keep auto-provisoning (ie. who don't want to specify either an image or a contianer), to configure whether to use podman, docker, container etc. TLDR: as long as everyone is OK with this being potentially broken one more time before we stabilize, I'm OK with merging. I wanted to take on that extra layer of change this week, but didn't have the time - sorry about that, would have preferred to bring a solution along with my complaining that we aren't done :) |
@shykes agree, that is required if the regular users have multiple container runtimes. In addition there needs to be a way for auto-provisioning users to specify certain settings like how much memory and cpu to give to the Apple Container micro-vm. Today you can do that in the experimental RUNNER var's query params, but not otherwise. I can imagine these all being env vars, or there being some global Dagger config file that is consulted, e.g. something in Hmmm...have to see if that would work. @jedevc Ideally with |
|
My general feeling is that we are allowing our engine driver system to become a hugely complicated beast. There's layers and layers of indirections here... All this to wrap a couple execs with a half dozen flags. Seems way overengineered to me (not just this PR, the whole sequence of gradual expansion in scope and complexity, culminating in this PR) |
I disagree. I think provisioning is complicated - the shell script isn't just going to be a single dagger/engine/client/drivers/container.go Lines 82 to 101 in 50aad4d There's a lot of effort done to try and handle slight incompatibilities between docker/podman/nerdctl and other docker-compatible CLIs. We need to parse stdout output, etc. There's also engine deletion - but the future of that should be up for debate as well, but that logic is also quite complex. I'm worried all we'll do is just take the complexity of drivers and put them into bash scripts, instead of go.
Not really super hyped about doing this, even though it's " |
💯 agree, I think getting these into |
|
From @shykes:
From @jedevc:
If we agree @jedevc that a good way forward here is It seems like with this PR and the engine.json config (possibly with env var overrides) and keeping (though deprecated) the existing
|
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
|
Reworked the changelog, and removing the It might break again 😢 but deciding to bias towards adding support for the other runtimes asap. At the very least, we'll preserve the "automatic" selection, even if we change the behavior of Let's continue the discussion of the future of the drivers in #10790. (there's other work to do on top/around this, e.g. #10810, and I want to avoid blocking that) |
| return fmt.Errorf("unsupported port argument %q", port) | ||
| } | ||
|
|
||
| if opts.cpus != "" { |
There was a problem hiding this comment.
@jedevc how do I set these opts like cpus and memory?
There was a problem hiding this comment.
Oh,
Flow for Memory and CPU Options
- URL Query Parameters: Options like cpus and memory are passed as URL query parameters
when provisioning a driver (container.go:144-145) - containerCreateOpts Structure: These are extracted into a containerCreateOpts struct
(container.go:218-219) - runOpts Structure: The options are then passed to a runOpts struct which contains:
- cpus string (container.go:112)
- memory string (container.go:113) - Apple Driver Implementation: In apple.go:79-90, the Apple driver handles these options:
so like this works:
?cpus=8&memory=16G
export _EXPERIMENTAL_DAGGER_RUNNER_HOST='image+apple://localhost/dagger-engine.dev?cpus=8&memory=16G'
"resources": {
"memoryInBytes": 17179869184,
"cpus": 8
},
but how to set cpus=8&memory=16G as defaults without using the query param approach in the special env var? @jedevc 🤔
There was a problem hiding this comment.
Also, subsequent runs with image:// will use existing engine, even if you fall back to the defaults for memory and cpu or set them explicitly to different values. Need to kill the existing engine to get a new one with image://. If using container:// then you'd be bound to a particular instance with a particular mem and cpu already chosen.
There was a problem hiding this comment.
Yup!
There is no way except to modify the query string - I think we do need an easier way, but this should be in the context of #10790? I don't want to invent more env vars/configs, until we decide what to do there.
Also, subsequent runs with
image://will use existing engine
Mmm, conflicted on desirable behavior here. It's not perfect atm, but agreed it's a bit weird that you can get a holdover engine that's not quite right.
I guess to fix this, when we search for leftover engines we should match by cpu/memory as well. I might tackle this as a followup?
There was a problem hiding this comment.
I will propose a solution in #10790 . Spoiler alert it will involve taking less responsibility for platform-specific customizations.
Fixes:
apple/containersupport first class #10666Related:
This PR introduces several new drivers:
image+docker/container+docker(renamed fromdocker-image/docker-container, which are now considered "legacy")image+podman/container+podmanimage+nerdctl/container+nerdctlimage+finch/container+finchimage+apple/container+appleThese are fairly self-explanatory - they work identically to the old docker drivers, but support more runtimes.
Additionally, we also have support for the generic
image+containerdrivers (which becomes the new default) - these behave the same, but auto select from the above based on what the user has installed on their system.TODO:
container