Implement the proposal from https://github.com/docker/docker/issues/24430#issuecomment-233100121 Removes acceptance policy and secret in favor of an automatically generated join token that combines the secret, CA hash, and manager/worker role into a single opaque string. Adds a docker swarm join-token subcommand to inspect and rotate the tokens. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com> Upstream-commit: 2cc5bd33eef038bf5721582e2410ba459bb656e9 Component: engine
32 lines
694 B
Go
32 lines
694 B
Go
package swarm
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/docker/docker/api/client"
|
|
"github.com/docker/docker/cli"
|
|
)
|
|
|
|
// NewSwarmCommand returns a cobra command for `swarm` subcommands
|
|
func NewSwarmCommand(dockerCli *client.DockerCli) *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "swarm",
|
|
Short: "Manage Docker Swarm",
|
|
Args: cli.NoArgs,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
fmt.Fprintf(dockerCli.Err(), "\n"+cmd.UsageString())
|
|
},
|
|
}
|
|
cmd.AddCommand(
|
|
newInitCommand(dockerCli),
|
|
newJoinCommand(dockerCli),
|
|
newUpdateCommand(dockerCli),
|
|
newLeaveCommand(dockerCli),
|
|
newInspectCommand(dockerCli),
|
|
newJoinTokenCommand(dockerCli),
|
|
)
|
|
return cmd
|
|
}
|