-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
service create is using CLI defaults rather than leaving the fields empty #24959
Comments
related / similar: #24958 Having the client set defaults is something that's been bugging me for a while; perhaps we should have a tracking issue to fix that throughout One challenge though, is that the usage output of the CLI shows the defaults as set in the client, and doesn't know about defaults that are set server-side (in the daemon) |
I'd like to get this fixed for 1.13. The first step is changing the CLI (and json<->grpc conversion) to leave empty any fields that aren't explicitly specified by the user. This may take some minor engine API changes to make certain things in the spec pointers, if they are embedded structs today. The main issue after that is visibility into the defaults. This matters in two places: seeing an existing service's parameters (i.e. @aluzzardi: For the former, what do you think about having controlapi's The main downside I can see is that people could confuse For the CLI usage output, I don't think it's worth the complexity of fetching defaults from the leader through an RPC. There's a lot that can go wrong here, and I think it's important to provide useful help output even when there isn't a usable swarm setup. One possibility for this is to provide a |
A similar change was made to logging driver settings a while back (see #21153 / #21118, and the discussion on #22575) For that change, I was in doubt what the correct behavior would be, On the other hand; not using the "merged" configuration (so, not baking it in the I still think we need a global design document / guideline for this; also taking
|
I think dealing with new options is straightforward. The SwarmKit model is that the spec is never modified except by the user. So if a spec is missing some new option, the default will automatically apply. This should be fine as long as we pick sensible defaults. In particular, for new features we'll want to err on the side of disabling them by default, so it doesn't affect the behavior of existing services. |
I started working on this in SwarmKit: moby/swarmkit#1744 |
The CLI is creating a spec by doing something like:
This is pretty bad because it hardcodes the CLI defaults into the server. We have no way to make a distinction between a user wanting something versus a user leaving the defaults.
For example, the user runs a
docker service create foo
, no arguments.Rather than leaving RestartPolicy to null, we're filling it up with stuff:
We're incapable to know whether the user wanted something to be done about restart policies or if it's just the CLI setting defaults.
The text was updated successfully, but these errors were encountered: