[WIP] Add support for server-side stacks#1721
[WIP] Add support for server-side stacks#1721dhiltgen wants to merge 9 commits intodocker:masterfrom
Conversation
Signed-off-by: Daniel Hiltgen <[email protected]>
This change moves the legacy client-side implementations for kubernetes and swarm stacks into new sub-packages for eventual deprecation/removal in the future. The new implementation relies on the server side implementatoin introduced in the upcoming Docker platform version. Signed-off-by: Daniel Hiltgen <[email protected]>
Signed-off-by: Daniel Hiltgen <[email protected]>
Signed-off-by: Daniel Hiltgen <[email protected]>
This flips to the correct version numbers, which means we can turn the e2e tests back on. If the engine used during testing is from master before merging moby/moby#38832 it will incorrectly think the server-side stacks APIs are present. Signed-off-by: Daniel Hiltgen <[email protected]>
| vbom.ml/util 256737ac55c46798123f754ab7d2c784e2c71783 | ||
|
|
||
| #get libnetwork packages | ||
| github.com/docker/libnetwork 1a06131fb8a047d919f7deaf02a4c414d7884b83 |
There was a problem hiding this comment.
curious why all these dependencies are now needed on the client side 🤔
There was a problem hiding this comment.
Yeah, I was bummed this pulled in so much but it comes from the code just below this comment block: https://github.com/docker/cli/pull/1721/files#diff-04999fb6f01d1478d54e2713a0b41a15R113
There was a problem hiding this comment.
I also noticed here that we're pulling in the backend;
cli/vendor/github.com/docker/stacks/pkg/interfaces/interfaces.go
Lines 6 to 37 in 99c7e42
Many of these should not be in the CLI (and might not even work on macOS, Windows)
There was a problem hiding this comment.
If those dependencies pop up in the client code (libnetwork, hashcorp/memberlist, consul, etcd ?) it means the packages in docker/stack are not loosely coupled. There should be no reason for the cli to pull those dependencies 😓
A small package split / reorganization on docker/stack is required for this to get in docker/cli
There was a problem hiding this comment.
Agreed, the stacks/pkg/interfaces package is meant for use only by components that are internal to the engine. We'll try to unwrangle why it's being referenced here
Signed-off-by: Daniel Hiltgen <[email protected]>
Signed-off-by: Daniel Hiltgen <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #1721 +/- ##
==========================================
+ Coverage 56.16% 56.22% +0.06%
==========================================
Files 306 309 +3
Lines 21016 21389 +373
==========================================
+ Hits 11803 12026 +223
- Misses 8359 8491 +132
- Partials 854 872 +18 |
|
I dont' understand why all the |
|
same reason swarmkit is not in the |
This shifts the env variable substitution logic client side as we wont be able to complete the server side implementation in time for this release. It also adds a new inspect command. Signed-off-by: Daniel Hiltgen <[email protected]>
|
@dperny I don't see why you can't have the same modularity with a package inside moby/moby? 🤔 |
There was a problem hiding this comment.
I do agree with @silvin-lubecki on the repository… There is also a couple of things that seems to be weird / a pain
docker/stackscopies the compose structs (here). We really should extract those structs/functions in a standalone repository that would act as a library (for exampledocker/libcompose👼 — that has been dead for ages) that other project would use (docker/app,docker/compose-on-kubernetes,docker/stacks,docker/cli,moby/moby, and most likely a lot others outside of docker/moby's reach…)- the upstream repository has a really weird line in the
README.md, that is really not welcoming for contributors : "This repository is solely maintained by Docker, Inc." — I'm really really not sure how to take this sentence… Especially given the next point where we basically render the whole client-side compose implementation deprecated for thisdocker/stackscode — feels like we are going from "anybody can work of this compose impl." to "just docker inc. can"… - We can't move packages as easy as what's done here
cli/command/stack/*->cli/command/stack/legacy/*: projects depends on it (docker/appis one example but it's most likely not the only one). Same goes forcli/cli/compose->cli/cli/legacy/compose… Moreover, it doesn't really make sense to me as they're not really in the way of the other packages that are on another repository…
If we really want to move these packages, we have to use go aliases so that it doesn't break project that depends on it (and at very least doesn't break them in one day…). - This is adding quite some duplication (of existing feature that could be.. refactor to be easier to use if they do not fit the new workflow put into place in this PR) — that looks a bit like a case of NYIH
- Design wise, I feel this adds TONS of complexity. I feel like the "train" for server-side compose file passed quite some time ago (but I might be wrong here). And I agree with @cpuguy83 on the
moby/mobyPR. Not sure the current client structs indocker/cliare the correct abstraction for a server side stack implementation.
There's already many open issues about shortcomings of the (compose) format that have been left unaddressed with many heated arguments on the issue tracker. This bares a striking resemblance to the situation with Dockerfiles where we have this highly opinionated format which, historically, is notoriously difficult to introduce new features for, is tied to specific versions of Docker, and is a source of much contention and strife in the community. The solution to this was buildkit, which enables users to define their own frontend format that is translated into a common instruction set (LLB) which can then be run on any backend that understand it.
Now, I understand that the format being passed into the daemon is not the literal yaml doc, but it is basically just a conversion of it from yaml to json and as such it has the same issues... maybe even more because the lifecycle management is tied to the daemon rather than a client and as such makes it far less malleable.
I would like if we can gain the safety (for all clients) by handling the objects in the daemon but without sacrificing the flexibility the clients currently have.
| "strings" | ||
|
|
||
| "github.com/docker/cli/cli/compose/convert" | ||
| "github.com/docker/cli/cli/legacy/compose/convert" |
| return nil | ||
| } | ||
|
|
||
| func loadDotEnv(workingDir string) (map[string]string, error) { |
There was a problem hiding this comment.
I feel like these pieces of code are common across moby/moby and docker/cli codebase… we may want to share some parts…
| "github.com/docker/cli/cli/legacy/compose/loader" | ||
| "github.com/docker/cli/cli/legacy/compose/schema" | ||
| composeTypes "github.com/docker/cli/cli/legacy/compose/types" | ||
| composetypes "github.com/docker/cli/cli/legacy/compose/types" |
There was a problem hiding this comment.
there is one too much here
| "github.com/docker/stacks/pkg/types" | ||
| ) | ||
|
|
||
| func substituteProperties(input *types.ComposeInput, workingDir string) error { |
There was a problem hiding this comment.
Why is this here ? Why not reusing code from cli/cli/compose package ? This adds yet another implementation of this variable substitution…
@vdemeester I opened docker-archive/stacks#51 to make that messaging a bit more friendly (YOLO) 😇😄 |
|
Lets close this until we sort out what the path forward is with moby/moby#38872 |
This PR is currently marked WIP, because work in the underlying docker/stacks repository is still ongoing.
Directly related to moby/moby#38832
Contacts for this PR are myself, @dperny and @alexmavr
- What I did
Add support for server-side stacks by importing and wiring up the https://github.com/docker/stacks libraries.
The new server-side stacks support aims to move as much business logic dealing with stacks to the server side as possible in order to achieve a consistent experience across all clients (CLI, GUI, etc.) while bringing the benefits of a 1st-class knowledge of stacks on the server with a reconciler to ensure the actual state matches the desired state for the stack.
- How I did it
- How to verify it
- Description for the changelog
Add support for server-side stacks
- A picture of a cute animal (not mandatory but encouraged)
This is my dog Trinity, playing along with her human siblings
