-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from rsteube/add-docker-swarm
added docker swarm subcommand
- Loading branch information
Showing
8 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var swarmCmd = &cobra.Command{ | ||
Use: "swarm", | ||
Short: "Manage Swarm", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(swarmCmd).Standalone() | ||
|
||
rootCmd.AddCommand(swarmCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var swarm_caCmd = &cobra.Command{ | ||
Use: "ca", | ||
Short: "Display and rotate the root CA", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(swarm_caCmd).Standalone() | ||
|
||
swarm_caCmd.Flags().String("ca-cert", "", "Path to the PEM-formatted root CA certificate to use for the") | ||
swarm_caCmd.Flags().String("ca-key", "", "Path to the PEM-formatted root CA key to use for the new cluster") | ||
swarm_caCmd.Flags().String("cert-expiry", "", "Validity period for node certificates (ns|us|ms|s|m|h)") | ||
swarm_caCmd.Flags().BoolP("detach", "d", false, "Exit immediately instead of waiting for the root rotation to") | ||
swarm_caCmd.Flags().String("external-ca", "", "Specifications of one or more certificate signing endpoints") | ||
swarm_caCmd.Flags().BoolP("quiet", "q", false, "Suppress progress output") | ||
swarm_caCmd.Flags().Bool("rotate", false, "Rotate the swarm CA - if no certificate or key are provided,") | ||
swarmCmd.AddCommand(swarm_caCmd) | ||
|
||
carapace.Gen(swarm_caCmd).FlagCompletion(carapace.ActionMap{ | ||
"ca-cert": carapace.ActionFiles(".crt"), | ||
"ca-key": carapace.ActionFiles(".key"), | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var swarm_initCmd = &cobra.Command{ | ||
Use: "init", | ||
Short: "Initialize a swarm", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(swarm_initCmd).Standalone() | ||
|
||
swarm_initCmd.Flags().String("advertise-addr", "", "Advertised address (format: <ip|interface>[:port])") | ||
swarm_initCmd.Flags().Bool("autolock", false, "Enable manager autolocking (requiring an unlock") | ||
swarm_initCmd.Flags().String("availability", "", "Availability of the node") | ||
swarm_initCmd.Flags().String("cert-expiry", "", "Validity period for node certificates") | ||
swarm_initCmd.Flags().String("data-path-addr", "", "Address or interface to use for data path") | ||
swarm_initCmd.Flags().String("data-path-port", "", "Port number to use for data path traffic (1024 -") | ||
swarm_initCmd.Flags().String("default-addr-pool", "", "default address pool in CIDR format (default [])") | ||
swarm_initCmd.Flags().String("default-addr-pool-mask-length", "", "default address pool subnet mask length (default 24)") | ||
swarm_initCmd.Flags().String("dispatcher-heartbeat", "", "Dispatcher heartbeat period (ns|us|ms|s|m|h)") | ||
swarm_initCmd.Flags().String("external-ca", "", "Specifications of one or more certificate") | ||
swarm_initCmd.Flags().Bool("force-new-cluster", false, "Force create a new cluster from current state") | ||
swarm_initCmd.Flags().String("listen-addr", "", "Listen address (format: <ip|interface>[:port])") | ||
swarm_initCmd.Flags().String("max-snapshots", "", "Number of additional Raft snapshots to retain") | ||
swarm_initCmd.Flags().String("snapshot-interval", "", "Number of log entries between Raft snapshots") | ||
swarm_initCmd.Flags().String("task-history-limit", "", "Task history retention limit (default 5)") | ||
swarmCmd.AddCommand(swarm_initCmd) | ||
|
||
carapace.Gen(swarm_initCmd).FlagCompletion(carapace.ActionMap{ | ||
"availability": carapace.ActionValues("active", "pause", "drain"), | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var swarm_jointokenCmd = &cobra.Command{ | ||
Use: "join-token", | ||
Short: "Manage join tokens", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(swarm_jointokenCmd).Standalone() | ||
|
||
swarm_jointokenCmd.Flags().BoolP("quiet", "q", false, "Only display token") | ||
swarm_jointokenCmd.Flags().Bool("rotate", false, "Rotate join token") | ||
swarmCmd.AddCommand(swarm_jointokenCmd) | ||
|
||
carapace.Gen(swarm_jointokenCmd).PositionalCompletion( | ||
carapace.ActionValues("worker", "manager"), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var swarm_leaveCmd = &cobra.Command{ | ||
Use: "leave", | ||
Short: "Leave the swarm", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(swarm_leaveCmd).Standalone() | ||
|
||
swarm_leaveCmd.Flags().BoolP("force", "f", false, "Force this node to leave the swarm, ignoring warnings") | ||
swarmCmd.AddCommand(swarm_leaveCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var swarm_unlockCmd = &cobra.Command{ | ||
Use: "unlock", | ||
Short: "Unlock swarm", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(swarm_unlockCmd).Standalone() | ||
|
||
swarmCmd.AddCommand(swarm_unlockCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var swarm_unlockkeyCmd = &cobra.Command{ | ||
Use: "unlock-key", | ||
Short: "Manage the unlock key", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(swarm_unlockkeyCmd).Standalone() | ||
|
||
swarm_unlockkeyCmd.Flags().BoolP("quiet", "q", false, "Only display token") | ||
swarm_unlockkeyCmd.Flags().Bool("rotate", false, "Rotate unlock key") | ||
swarmCmd.AddCommand(swarm_unlockkeyCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var swarm_updateCmd = &cobra.Command{ | ||
Use: "update", | ||
Short: "Update the swarm", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(swarm_updateCmd).Standalone() | ||
|
||
swarm_updateCmd.Flags().Bool("autolock", false, "Change manager autolocking setting (true|false)") | ||
swarm_updateCmd.Flags().String("cert-expiry", "", "Validity period for node certificates (ns|us|ms|s|m|h) (default 2160h0m0s)") | ||
swarm_updateCmd.Flags().String("dispatcher-heartbeat", "", "Dispatcher heartbeat period (ns|us|ms|s|m|h) (default 5s)") | ||
swarm_updateCmd.Flags().String("external-ca", "", "Specifications of one or more certificate signing endpoints") | ||
swarm_updateCmd.Flags().String("max-snapshots", "", "Number of additional Raft snapshots to retain") | ||
swarm_updateCmd.Flags().String("snapshot-interval", "", "Number of log entries between Raft snapshots (default 10000)") | ||
swarm_updateCmd.Flags().String("task-history-limit", "", "Task history retention limit (default 5)") | ||
swarmCmd.AddCommand(swarm_updateCmd) | ||
} |