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

Add Swarm management CLI commands #23363

Merged
merged 33 commits into from Jun 14, 2016

Conversation

Projects
None yet
@dnephin
Member

dnephin commented Jun 8, 2016

As described in our ROADMAP.md, introduce new Swarm management commands to call to the corresponding API endpoints.

This PR is fully backward compatible (joining a Swarm is an optional feature of the Engine, and existing commands are not impacted)

Show outdated Hide outdated api/client/service/opts.go
if !ok {
return fmt.Errorf("Failed to parse %v as a rational number", value)
}
*c = nanoCPUs(cpu.Mul(cpu, big.NewRat(1e9, 1)).Num().Int64())

This comment has been minimized.

@aluzzardi

aluzzardi Jun 8, 2016

Contributor

Before calling Int64(), you have to check IsInt() or return an error. This is to make sure there's no loss (user input is not below nanos).

@aluzzardi

aluzzardi Jun 8, 2016

Contributor

Before calling Int64(), you have to check IsInt() or return an error. This is to make sure there's no loss (user input is not below nanos).

}
func (m *memBytes) Set(value string) error {
val, err := units.RAMInBytes(value)

This comment has been minimized.

@aluzzardi

aluzzardi Jun 8, 2016

Contributor

Check err

@aluzzardi

aluzzardi Jun 8, 2016

Contributor

Check err

This comment has been minimized.

@dnephin

dnephin Jun 8, 2016

Member

In what case would I need to check err here? We always return the err, so if there is an error it will be reported.

This is how all the types in pflag are implemented, ex: https://github.com/spf13/pflag/blob/master/int64.go#L16-L19

@dnephin

dnephin Jun 8, 2016

Member

In what case would I need to check err here? We always return the err, so if there is an error it will be reported.

This is how all the types in pflag are implemented, ex: https://github.com/spf13/pflag/blob/master/int64.go#L16-L19

This comment has been minimized.

@aluzzardi

aluzzardi Jun 9, 2016

Contributor

Right - my bad!

@aluzzardi

aluzzardi Jun 9, 2016

Contributor

Right - my bad!

Show outdated Hide outdated api/client/node/inspect.go
func runInspect(dockerCli *client.DockerCli, opts inspectOptions) error {
client := dockerCli.Client()
getRef := func(ref string) (interface{}, []byte, error) {
ctx := context.Background()

This comment has been minimized.

@vdemeester

vdemeester Jun 9, 2016

Member

hum, should ctx declared in the upper block (alongside client) ?

@vdemeester

vdemeester Jun 9, 2016

Member

hum, should ctx declared in the upper block (alongside client) ?

This comment has been minimized.

@dnephin

dnephin Jun 9, 2016

Member

yup, fixed

@dnephin

dnephin Jun 9, 2016

Member

yup, fixed

Show outdated Hide outdated api/client/node/list.go
client := dockerCli.Client()
nodes, err := client.NodeList(
context.Background(),

This comment has been minimized.

@vdemeester

vdemeester Jun 9, 2016

Member

The context should be shared here :

ctx := context.Background()

nodes, err := client.NodeList(ctx, …)
// […]
info, err := client.Info(ctx)
// […]
@vdemeester

vdemeester Jun 9, 2016

Member

The context should be shared here :

ctx := context.Background()

nodes, err := client.NodeList(ctx, …)
// […]
info, err := client.Info(ctx)
// […]
Show outdated Hide outdated api/client/node/remove.go
func runRemove(dockerCli *client.DockerCli, args []string) error {
client := dockerCli.Client()
for _, nodeID := range args {
err := client.NodeRemove(context.Background(), nodeID)

This comment has been minimized.

@vdemeester

vdemeester Jun 9, 2016

Member

Here too, context should be shared.

ctx := context.Background()
for _, nodeID := range args {
    err := client.NodeRemove(ctx, …)
    // […]
}
@vdemeester

vdemeester Jun 9, 2016

Member

Here too, context should be shared.

ctx := context.Background()
for _, nodeID := range args {
    err := client.NodeRemove(ctx, …)
    // […]
}
@dnephin

This comment has been minimized.

Show comment
Hide comment
@dnephin

dnephin Jun 9, 2016

Member

Ok, those issues should be fixed.

Member

dnephin commented Jun 9, 2016

Ok, those issues should be fixed.

Show outdated Hide outdated api/client/node/promote.go
cmd := &cobra.Command{
Use: "promote NODE [NODE...]",
Short: "Promote a node as manager in the swarm",

This comment has been minimized.

@chanwit

chanwit Jun 10, 2016

Probably, "Promote a node to manager in the swarm"?

@chanwit

chanwit Jun 10, 2016

Probably, "Promote a node to manager in the swarm"?

Show outdated Hide outdated api/client/node/demote.go
cmd := &cobra.Command{
Use: "demote NODE [NODE...]",
Short: "Demote a node as manager in the swarm",

This comment has been minimized.

@chanwit

chanwit Jun 10, 2016

Shoud it be "Demote a node from manager in the swarm" ?

@chanwit

chanwit Jun 10, 2016

Shoud it be "Demote a node from manager in the swarm" ?

@vdemeester

This comment has been minimized.

Show comment
Hide comment
@vdemeester

vdemeester Jun 10, 2016

Member

win2lin error is weird :

04:14:18 # github.com/docker/swarmkit/identity
04:14:18 vendor\src\github.com\docker\swarmkit\identity\randomid.go:54: nn.Text undefined (type big.Int has no field or method Text)
Member

vdemeester commented Jun 10, 2016

win2lin error is weird :

04:14:18 # github.com/docker/swarmkit/identity
04:14:18 vendor\src\github.com\docker\swarmkit\identity\randomid.go:54: nn.Text undefined (type big.Int has no field or method Text)
@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Jun 10, 2016

Member

@vdemeester it's because that CI is still on Go 1.5.4

Member

thaJeztah commented Jun 10, 2016

@vdemeester it's because that CI is still on Go 1.5.4

@chanwit

This comment has been minimized.

Show comment
Hide comment
@chanwit

chanwit Jun 12, 2016

Just let you know, I did a rebase on master with a small conflict at:
cli/usage.go.

Other than that it's just fine.

chanwit commented Jun 12, 2016

Just let you know, I did a rebase on master with a small conflict at:
cli/usage.go.

Other than that it's just fine.

dnephin and others added some commits Jun 7, 2016

Add Swarm management CLI commands
As described in our ROADMAP.md, introduce new Swarm management commands
to call to the corresponding API endpoints.

This PR is fully backward compatible (joining a Swarm is an optional
feature of the Engine, and existing commands are not impacted).

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
CLI docs
Signed-off-by: Amit Shukla <amit.shukla@docker.com>
Shorten `docker service` restart policy flags
Rename `--restart-policy-*` flags to `--restart-*` (e.g.,
`--restart-policy-delay` becomes `--restart-delay`).

Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
Clarify services update policies
Rename `--updateconfig-*` to `--update-*` and improve help messages.

Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
use ID for '*'
Signed-off-by: Victor Vieux <vieux@docker.com>
add CACertHash: cli
Signed-off-by: Victor Vieux <vieux@docker.com>
Fix accept policy initialization
- Set secret when using default policy
- Always initialize policy for all roles

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Update join command message
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Fix CLI side of volume problem.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
update to newest engine-api (cli)
Signed-off-by: Victor Vieux <vieux@docker.com>
Rename `--port` to `--publish` in `docker service`
Rename `--port` to `--publish` for consistency between `docker service`
and `docker run`.

Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
Fix RenameCheckNames test
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Fixes #273 - set command line args in args not command
Signed-off-by: Daniel Nephin <dnephin@docker.com>
backport fixes from docker/docker PR comments.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
upadate engine-api: cli
Signed-off-by: Victor Vieux <vieux@docker.com>
Pretty print strings on human-readable outputs
Capitalize first letter in output meant for human consumptions (e.g.,
`docker service ls`, or `docker node inspect --pretty`).

Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
Fix incorrect `docker service inspect` help message
Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
fix docker swarm inspect output on error
Signed-off-by: Victor Vieux <vieux@docker.com>
git rm reject.go
Signed-off-by: Victor Vieux <vieux@docker.com>
add -h back to inspect
Signed-off-by: Victor Vieux <vieux@docker.com>
cli
Signed-off-by: Victor Vieux <vieux@docker.com>
api
Signed-off-by: Victor Vieux <vieux@docker.com>
swarm managed networks should me marked as "swarm" scoped (cli)
Signed-off-by: Madhu Venugopal <madhu@docker.com>

Arnaud Porterie (icecrime) and others added some commits Jun 13, 2016

Add `docker service scale` command
Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
Vendoring libnetwork @892e1b9864d1f (cli)
Adds overlay datapath security enhancement
Adds netlink performance enhancements
Bug fixes

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Upate auto-accept help text.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
Small UX improvements to 'docker service scale'
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Fix scale pointer value in service inspect -p
Before this change, pretty output shows `859533555312` instead of `1`.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Add missing newline
Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
Fix command not displaying in service ls.
Closes #396.

Signed-off-by: Drew Erny <drew.erny@docker.com>
New format for setting mounts on a service.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upate from PR review.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
fix rebase
Signed-off-by: Victor Vieux <vieux@docker.com>
@icecrime

This comment has been minimized.

Show comment
Hide comment
@icecrime

icecrime Jun 14, 2016

Contributor

LGTM 💯

Contributor

icecrime commented Jun 14, 2016

LGTM 💯

@vieux

This comment has been minimized.

Show comment
Hide comment
@vieux

vieux Jun 14, 2016

Collaborator

LGTM 💯

Collaborator

vieux commented Jun 14, 2016

LGTM 💯

@tiborvass

This comment has been minimized.

Show comment
Hide comment
@tiborvass

tiborvass Jun 14, 2016

Collaborator

LGTM

Collaborator

tiborvass commented Jun 14, 2016

LGTM

@icecrime

This comment has been minimized.

Show comment
Hide comment
@icecrime

icecrime Jun 14, 2016

Contributor

CLI reference and docs will be completed in a followup 👍

Contributor

icecrime commented Jun 14, 2016

CLI reference and docs will be completed in a followup 👍

@icecrime icecrime merged commit 229b279 into swarm-backend Jun 14, 2016

5 of 8 checks passed

documentation fail
Details
experimental Jenkins build Docker-PRs-experimental 19899 has failed
Details
gccgo Jenkins build Docker-PRs-gccgo 6766 is running
Details
docker/dco-signed All commits signed
Details
janky Jenkins build Docker-PRs 28693 has succeeded
Details
userns Jenkins build Docker-PRs-userns 10855 has succeeded
Details
win2lin Jenkins build Docker-PRs-Win2Lin 27279 has succeeded
Details
windowsTP5 Jenkins build Docker-PRs-WoW-TP5 3184 has succeeded
Details
@chanwit

This comment has been minimized.

Show comment
Hide comment
@chanwit

chanwit Jun 14, 2016

🎉 🎉

I love the new scale command.
Thank you guys. This is super awesome!!

chanwit commented Jun 14, 2016

🎉 🎉

I love the new scale command.
Thank you guys. This is super awesome!!

@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Jun 14, 2016

Member

🐝 🐝 🎉

Member

thaJeztah commented Jun 14, 2016

🐝 🐝 🎉

@runcom runcom deleted the swarm-cli branch Jun 15, 2016

@albers

This comment has been minimized.

Show comment
Hide comment
@albers

albers Jun 17, 2016

Member

@thaJeztah This PR added reference pages for the swarm and node commands. But there are none for service yet. Is there some WIP?

Member

albers commented Jun 17, 2016

@thaJeztah This PR added reference pages for the swarm and node commands. But there are none for service yet. Is there some WIP?

@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Jun 17, 2016

Member

@albers correct, there's an issue for tracking this here; #23598

Member

thaJeztah commented Jun 17, 2016

@albers correct, there's an issue for tracking this here; #23598

@albers

This comment has been minimized.

Show comment
Hide comment
@albers

albers Jun 17, 2016

Member

@thaJeztah cool, thanks. I already dropped a note there.

Member

albers commented Jun 17, 2016

@thaJeztah cool, thanks. I already dropped a note there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment