cluster

package
v0.0.0-...-b1baf6d Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

README

Cluster

Manage clusters from the d2k8 cli.

Create a cluster

Create a cluster to be managed by d2k8.

d2k8 cluster create name -skip-consul -skip-weave -weave-pwd pwd -skip-cleanup

Argument Meaning
name name of the cluster to be identified in d2k8 cli commands
skip-consul 'true' to skip 'consult' installation for DNS in this cluster
skip-weave 'true' to skip 'weave' installation for SDN in this cluster
weave-pwd weave router password for traffic encryption. "" for non-encrypted traffic
skip-cleanup 'true' to skip 'cleanup' service installation (cleans unused volumes and images)

Inspect a cluster

Retrieve cluster information.

d2k8 cluster inspect name

Argument Meaning
name name of the cluster to be retrieved

List clusters

Retrieve all clusters information.

d2k8 cluster list

Delete a cluster

Remove a cluster from d2k8. Nodes created in this cluster are also deleted.

d2k8 cluster remove name

Argument Meaning
name name of the cluster to be deleted

Documentation

Index

Constants

View Source
const (
	FILL_SIZE = 30
)

Variables

View Source
var Commands = cli.Command{
	Name:  "cluster",
	Usage: "manage d2k8 clusters",
	Subcommands: []cli.Command{
		{
			Name:  "create",
			Usage: "create a cluster",
			Flags: []cli.Flag{
				cli.BoolFlag{
					Name:  "skip-consul",
					Usage: "'true' not to install consul agent for DNS",
				},
				cli.BoolFlag{
					Name:  "skip-weave",
					Usage: "'true' not to install weave router for SDN",
				},
				cli.StringFlag{
					Name:  "weave-pwd",
					Usage: "Password for weave traffic encryption.",
				},
				cli.BoolFlag{
					Name:  "skip-cleanup",
					Usage: "'true' not to install 'cleanup' service (cleans unused volumes and images)",
				},
			},
			Action: func(c *cli.Context) {
				if len(c.Args()) != 1 {
					log.Fatal("'create' command only needs the name of the cluster to be created as a positional argument")
				}
				err := CreateCmd(c.Args().First(), !c.Bool("skip-consul"), !c.Bool("skip-weave"), c.String("weave-pwd"), !c.Bool("skip-cleanup"))
				if err != nil {
					log.Fatal(err)
				}
			},
		},
		{
			Name:      "inspect",
			ShortName: "get",
			Usage:     "get the information of a cluster",
			Action: func(c *cli.Context) {
				if len(c.Args()) != 1 {
					log.Fatal("'inspect' command only needs the name of the cluster to retrieve as a postional argument")
				}
				err := InspectCmd(c.Args().First())
				if err != nil {
					log.Fatal(err)
				}
			},
		},
		{
			Name:      "list",
			ShortName: "ls",
			Usage:     "list the d2k8 current clusters",
			Action: func(c *cli.Context) {
				err := ListCmd()
				if err != nil {
					log.Fatal(err)
				}
			},
		},
		{
			Name:      "remove",
			ShortName: "rm",
			Usage:     "remove a cluster",
			Action: func(c *cli.Context) {
				if len(c.Args()) != 1 {
					log.Fatal("'remove' command only needs the name of the cluster to be removed as a positional argument")
				}
				err := RemoveCmd(c.Args().First())
				if err != nil {
					log.Fatal(err)
				}
			},
		},
	},
}

Functions

func CreateCmd

func CreateCmd(name string, consul bool, weave bool, weavePwd string, cleanup bool) error

func Delete

func Delete(name string) error

func Exists

func Exists(name string) bool

func FileFolder

func FileFolder() string

func FilePath

func FilePath(name string) string

func InspectCmd

func InspectCmd(name string) error

func List

func List() ([]string, error)

func ListCmd

func ListCmd() error

func RemoveCmd

func RemoveCmd(name string) error

func Write

func Write(cluster Cluster) error

Types

type Cluster

type Cluster struct {
	Name     string
	Consul   bool
	Weave    bool
	WeavePwd string
	Cleanup  bool
}

func Read

func Read(name string) (Cluster, error)

func (*Cluster) RemoveNodes

func (c *Cluster) RemoveNodes() error

Jump to

Keyboard shortcuts

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