Skip to content

Add a specific config struct for the update command (#18957)#19104

Merged
thaJeztah merged 1 commit intomoby:masterfrom
vdemeester:18957-update-config
Jan 12, 2016
Merged

Add a specific config struct for the update command (#18957)#19104
thaJeztah merged 1 commit intomoby:masterfrom
vdemeester:18957-update-config

Conversation

@vdemeester
Copy link
Member

This is a proposal for #18957, to reduce what we send to the update endpoint. This also make it clear what is mutable in the container, and untie it from Config/HostConfig. It is still easy to add more attributes

This allows use to control more what is or is not mutable in a container and remove the use of the internal HostConfig struct to be used 🐳.

  • UpdateConfig might not be a good name, maybe MutableConfig or something ?
  • The implementation is naive right now, it's there for discussion 😉.

Related PR for api changes : docker-archive-public/docker.engine-api#11. Waiting for it to be merged to vendor it and rebase this one 😝.

Closes #18957.

Signed-off-by: Vincent Demeester vincent@sbr.pm

@MHBauer
Copy link
Contributor

MHBauer commented Jan 5, 2016

I think update as a command is kind of a goofy name for the command, but I wasn't here a week ago to say that. I'd match the config to the name of the command. If the command is update, the config should be update.

@hqhq
Copy link
Contributor

hqhq commented Jan 6, 2016

Design looks good, I'm +1 for this 👍

@duglin
Copy link
Contributor

duglin commented Jan 6, 2016

SGTM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there further work to do here to get rid of hostConfig? If we end up in a hostConfig anyway, are we really winning anything here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hostConfig here is invisible to users, I think that's the point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I didn't want to pass UpdateConfig down too much — I think daemon doesn't really need to know it.

@MHBauer
Copy link
Contributor

MHBauer commented Jan 6, 2016

Looks correct.

@calavera
Copy link
Contributor

calavera commented Jan 6, 2016

it looks like #19116 is proving that keeping hostConfig is better than removing it completely.

Tbh, I was going to agree with this change, but allowing to change the restartPolicy sounds like a good idea to me. So I'm leaning more towards not doing this.

@vdemeester
Copy link
Member Author

@calavera Adding support to RestartPolicy would be done to just add a new field to UpdateConfig.

What I don't like now is that we pass the whole HostConfig and ignoring a whole lot of attributes (for good reasons)… but seeing the API, a consumer of this API could think "oh cool, I can update everything in HostConfig", which is not the case, and shouldn't be.

When looking at this endpoint, it should be clear what is mutable in the container. By passing HostConfig it is not. And, if we want to add labels to the update command (see #18958), it's not in HostConfig so we would have a small problem I think (or a API change more important than adding a field to this UpdateConfig struct).

@tiborvass
Copy link
Contributor

Collective review

We're okay with this design to resolve #18957.

Thanks @vdemeester

@tiborvass
Copy link
Contributor

@vdemeester rebase please :)

@vdemeester
Copy link
Member Author

Rebased and added a probably temporary vendoring commit (cc @calavera) to make it build 😝.

@vdemeester vdemeester force-pushed the 18957-update-config branch from 5ee7a45 to f0389df Compare January 8, 2016 08:03
@vdemeester
Copy link
Member Author

Rebased with the vendoring of engine-api 0.1.2 😉

@duglin
Copy link
Contributor

duglin commented Jan 8, 2016

So weird to only see a small piece of the puzzle :-)
LGTM

@vdemeester vdemeester force-pushed the 18957-update-config branch from f0389df to df7a625 Compare January 8, 2016 20:50
@tiborvass
Copy link
Contributor

LGTM

@tiborvass
Copy link
Contributor

@vdemeester not sure if this needs a documentation update too, or if that should be done somewhere else?

@vdemeester
Copy link
Member Author

Hum maybe remote api I think, I'll check once home ;-)

@vdemeester
Copy link
Member Author

Updated some API docs.

/ping @thaJeztah @MHBauer @jamtur01 @moxiegirl

@jamtur01
Copy link
Contributor

Docs LGTM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updates the resources

This allows to define clearly what is mutable or not in a container
and remove the use of the internal HostConfig struct to be used.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
@thaJeztah
Copy link
Member

docs LGTM, thanks @vdemeester!

thaJeztah added a commit that referenced this pull request Jan 12, 2016
Add a specific config struct for the update command (#18957)
@thaJeztah thaJeztah merged commit 1393c45 into moby:master Jan 12, 2016
@vdemeester vdemeester deleted the 18957-update-config branch January 12, 2016 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should /containers/(id)/update take HostConfig or only Resources

9 participants