command

package
v2.0.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CreateClusterCliCommand represent the CLI command "create-cluster" with its flags
	CreateClusterCliCommand = cli.Command{
		Name:   "create-cluster",
		Usage:  "Create a new Docker Swarm cluster on the Grid'5000 infrastructure",
		Action: RunCreateClusterCommand,
		Flags: []cli.Flag{
			cli.StringFlag{
				EnvVar: "G5K_USERNAME",
				Name:   "g5k-username",
				Usage:  "Your Grid5000 account username",
				Value:  "",
			},

			cli.StringFlag{
				EnvVar: "G5K_PASSWORD",
				Name:   "g5k-password",
				Usage:  "Your Grid5000 account password",
				Value:  "",
			},

			cli.StringSliceFlag{
				EnvVar: "G5K_RESERVE_NODES",
				Name:   "g5k-reserve-nodes",
				Usage:  "Reserve nodes on a site (ex: lille:24)",
			},

			cli.StringFlag{
				EnvVar: "G5K_WALLTIME",
				Name:   "g5k-walltime",
				Usage:  "Machine's lifetime (HH:MM:SS)",
				Value:  "1:00:00",
			},

			cli.StringFlag{
				EnvVar: "G5K_IMAGE",
				Name:   "g5k-image",
				Usage:  "Name of the image to deploy",
				Value:  "jessie-x64-min",
			},

			cli.StringFlag{
				EnvVar: "G5K_RESOURCE_PROPERTIES",
				Name:   "g5k-resource-properties",
				Usage:  "Resource selection with OAR properties (SQL format)",
				Value:  "",
			},

			cli.StringSliceFlag{
				EnvVar: "ENGINE_OPT",
				Name:   "engine-opt",
				Usage:  "Specify arbitrary flags to include on the selected node(s) engine (site-id:flag=value)",
			},

			cli.StringSliceFlag{
				EnvVar: "ENGINE_LABEL",
				Name:   "engine-label",
				Usage:  "Specify labels for the selected node(s) engine (site-id:labelname=labelvalue)",
			},

			cli.StringSliceFlag{
				EnvVar: "SWARM_MASTER",
				Name:   "swarm-master",
				Usage:  "Select node(s) to be promoted to Swarm Master(standalone)/Manager(Mode)",
			},

			cli.BoolFlag{
				EnvVar: "SWARM_MODE_ENABLE",
				Name:   "swarm-mode-enable",
				Usage:  "Create a Swarm mode cluster",
			},

			cli.BoolFlag{
				EnvVar: "SWARM_STANDALONE_ENABLE",
				Name:   "swarm-standalone-enable",
				Usage:  "Create a Swarm standalone cluster",
			},

			cli.StringFlag{
				EnvVar: "SWARM_STANDALONE_DISCOVERY",
				Name:   "swarm-standalone-discovery",
				Usage:  "Discovery service to use with Swarm",
				Value:  "",
			},

			cli.StringFlag{
				EnvVar: "SWARM_STANDALONE_IMAGE",
				Name:   "swarm-standalone-image",
				Usage:  "Specify Docker image to use for Swarm",
				Value:  "swarm:latest",
			},

			cli.StringFlag{
				EnvVar: "SWARM_STANDALONE_STRATEGY",
				Name:   "swarm-standalone-strategy",
				Usage:  "Define a default scheduling strategy for Swarm",
				Value:  "spread",
			},

			cli.StringSliceFlag{
				EnvVar: "SWARM_STANDALONE_OPT",
				Name:   "swarm-standalone-opt",
				Usage:  "Define arbitrary flags for Swarm master (can be provided multiple times)",
			},

			cli.StringSliceFlag{
				EnvVar: "SWARM_STANDALONE_JOIN_OPT",
				Name:   "swarm-standalone-join-opt",
				Usage:  "Define arbitrary flags for Swarm join (can be provided multiple times)",
			},

			cli.BoolFlag{
				EnvVar: "WEAVE_NETWORKING",
				Name:   "weave-networking",
				Usage:  "Use Weave for networking (Only if Swarm standalone is enabled)",
			},
		},
	}
)
View Source
var (
	// RemoveClusterCliCommand represent the CLI command "remove-cluster" with its flags
	RemoveClusterCliCommand = cli.Command{
		Name:   "remove-cluster",
		Usage:  "Remove a Docker Swarm cluster from the Grid'5000 infrastructure",
		Action: RunRemoveClusterCommand,
		Flags: []cli.Flag{
			cli.IntFlag{
				EnvVar: "G5K_JOB_ID",
				Name:   "g5k-job-id",
				Usage:  "Only remove nodes related to the provided job ID (By default ALL nodes from ALL jobs will be removed)",
				Value:  -1,
			},
		},
	}
)

Functions

func ParseCliFlag

func ParseCliFlag(regex string, str string) (map[string]string, error)

ParseCliFlag extract informations (using regex) from cli flags and returns a map (named capturing groups are required)

func RunCreateClusterCommand

func RunCreateClusterCommand(cli *cli.Context) error

RunCreateClusterCommand create a new cluster using cli flags

func RunRemoveClusterCommand

func RunRemoveClusterCommand(cli *cli.Context) error

RunRemoveClusterCommand remove a cluster

Types

type CreateClusterCommand

type CreateClusterCommand struct {
	// contains filtered or unexported fields
}

CreateClusterCommand contain global parameters for the command "create-cluster"

type RemoveClusterCommand

type RemoveClusterCommand struct {
	// contains filtered or unexported fields
}

RemoveClusterCommand contain global parameters for the command "rm-cluster"

func (*RemoveClusterCommand) RemoveCluster

func (c *RemoveClusterCommand) RemoveCluster() error

RemoveCluster remove all nodes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL