Skip to content

allow features option live reloading#37692

Merged
tiborvass merged 1 commit intomoby:masterfrom
AntaresS:live-reload-buildkit
Sep 2, 2018
Merged

allow features option live reloading#37692
tiborvass merged 1 commit intomoby:masterfrom
AntaresS:live-reload-buildkit

Conversation

@AntaresS
Copy link
Copy Markdown
Contributor

@AntaresS AntaresS commented Aug 22, 2018

- What I did

  • add reloadFeatures so that the changes of features field in daemon.json can be live reloaded.
  • pass a pointer of features to the rest of places where it is being used.

- How I did it

- How to verify it
First with buildkit turned on in daemon.json

{"debug":true,"tls":true,"tlscacert":"/etc/docker/ca.pem","tlscert":"/etc/docker/cert.pem","tlskey":"/etc/docker/key.pem","tlsverify":true, "experimental": true, "features": {"buildkit": true}}

we hit the /_ping endpoint to verify, Builder-Version: 2
image

Now turn buildkit off

{"debug":true,"tls":true,"tlscacert":"/etc/docker/ca.pem","tlscert":"/etc/docker/cert.pem","tlskey":"/etc/docker/key.pem","tlsverify":true, "experimental": true, "features": {"buildkit": false}}

and run sudo kill -s SIGHUP <dockerd-PID>

then verify with /_ping again, it shows Builder-Version: 1
image

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Anda Xu anda.xu@docker.com

@AntaresS
Copy link
Copy Markdown
Contributor Author

ptal @thaJeztah @tiborvass

Comment thread daemon/reload.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove this if to be able to unset features ?

@thaJeztah thaJeztah changed the title allow features option live reloading [wip] allow features option live reloading Aug 30, 2018
@AntaresS AntaresS force-pushed the live-reload-buildkit branch from ad3d477 to 2472170 Compare August 30, 2018 21:26
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 30, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@64b7575). Click here to learn what that means.
The diff coverage is 44.44%.

@@            Coverage Diff            @@
##             master   #37692   +/-   ##
=========================================
  Coverage          ?   36.03%           
=========================================
  Files             ?      609           
  Lines             ?    45063           
  Branches          ?        0           
=========================================
  Hits              ?    16240           
  Misses            ?    26592           
  Partials          ?     2231

@AntaresS AntaresS force-pushed the live-reload-buildkit branch 4 times, most recently from 97a1f12 to f634ae4 Compare August 30, 2018 23:10
@AntaresS
Copy link
Copy Markdown
Contributor Author

@tiborvass I've updated the PR and verified this would actually work.

Comment thread daemon/reload.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

unneeded extra space

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@AntaresS AntaresS force-pushed the live-reload-buildkit branch from f634ae4 to c11a34e Compare August 30, 2018 23:30
Copy link
Copy Markdown
Contributor

@tiborvass tiborvass left a comment

Choose a reason for hiding this comment

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

LGTM

@AntaresS AntaresS changed the title [wip] allow features option live reloading allow features option live reloading Aug 30, 2018
@AntaresS AntaresS force-pushed the live-reload-buildkit branch from c11a34e to ac14e27 Compare August 30, 2018 23:36
@AntaresS
Copy link
Copy Markdown
Contributor Author

@tonistiigi or @thaJeztah can you help review this?

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

one nit, but looks good otherwise

Comment thread daemon/daemon.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Better to name this Features() instead of GetFeatures(); golang convention is to not use a Get prefix for getters; https://golang.org/doc/effective_go.html#Getters

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah good call. 👍

Copy link
Copy Markdown
Contributor Author

@AntaresS AntaresS Aug 31, 2018

Choose a reason for hiding this comment

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

@thaJeztah Fixed :)

@thaJeztah thaJeztah added area/builder Build area/daemon Core Engine labels Aug 31, 2018
Signed-off-by: Anda Xu <anda.xu@docker.com>
@AntaresS AntaresS force-pushed the live-reload-buildkit branch from ac14e27 to 58a75ce Compare August 31, 2018 19:43
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

builderVersion := BuilderVersion(*br.features)
// check if the builder feature has been enabled from daemon as well.
if buildOptions.Version == types.BuilderBuildKit && br.builderVersion != "" && br.builderVersion != types.BuilderBuildKit {
if buildOptions.Version == types.BuilderBuildKit && builderVersion != "" && builderVersion != types.BuilderBuildKit {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@tiborvass As discussed offline, this value should only apply as a hint to the client on negotiation on ping, not override a daemon behavior.

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.

5 participants