commands

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AWSCloud        = aws.NewAWSProvider()
	AvailableClouds = []providers.CloudProvider{
		AWSCloud,
	}
)
View Source
var AccountCommands = []*cli.Command{
	{
		Name:        "account",
		Usage:       "Linked service accounts",
		Description: "Kubernetes service accounts that are linked to accounts at the cloud provider (IAM). Use these accounts to allow apps to access cloud resources",
		Before:      func(c *cli.Context) error { return ensureClusterSelected() },
		Category:    "Cluster",
		Subcommands: []*cli.Command{
			{
				Name:  "create",
				Usage: "create a new linked service account",
				Action: func(c *cli.Context) error {
					return accountEdit(c.String("account"), false)
				},
				Flags: []cli.Flag{
					accountFlag,
				},
			},
			{
				Name:   "delete",
				Usage:  "deletes an account",
				Action: accountDelete,
				Flags: []cli.Flag{
					accountFlag,
				},
			},
			{
				Name:  "edit",
				Usage: "edit an existing linked service account",
				Action: func(c *cli.Context) error {
					return accountEdit(c.String("account"), true)
				},
				Flags: []cli.Flag{
					accountFlag,
				},
			},
			{
				Name:   "list",
				Usage:  "lists accounts on this cluster",
				Action: accountList,
			},
		},
	},
}
View Source
var AppCommands = []*cli.Command{
	{
		Name:    "app",
		Aliases: []string{"apps"},
		Usage:   "App commands",
		Before: func(c *cli.Context) error {
			return ensureClusterSelected()
		},
		Category: "App",
		Subcommands: []*cli.Command{
			{
				Name:      "delete",
				Usage:     "Deletes an app from the current cluster",
				Action:    appDelete,
				ArgsUsage: "<app>",
			},
			{
				Name:      "deploy",
				Usage:     "Deploy a new version of an app",
				Action:    appDeploy,
				ArgsUsage: "<app>",
				Flags: []cli.Flag{
					&cli.StringFlag{
						Name:     "tag",
						Usage:    "image tag to use",
						Required: true,
					},
				},
			},
			{
				Name:      "edit",
				Usage:     "Edit an app's configuration",
				Action:    appEdit,
				ArgsUsage: "<app>",
				Flags: []cli.Flag{
					&cli.StringFlag{
						Name:    "file",
						Aliases: []string{"f"},
						Usage:   "use contents of file to update, - to indicate stdin",
					},
				},
			},
			{
				Name:      "halt",
				Usage:     "Halt/unhalt an app. Halting an app scales it to down immediately",
				Action:    appHalt,
				ArgsUsage: "<app>",
				Flags: []cli.Flag{
					&cli.StringFlag{
						Name:     "target",
						Usage:    "target to halt/unhalt",
						Required: true,
					},
					&cli.BoolFlag{
						Name:  "unhalt",
						Usage: "unhalt an app",
					},
				},
			},
			{
				Name:   "list",
				Usage:  "List apps on this cluster",
				Action: appList,
				Flags: []cli.Flag{
					targetFlag,
				},
			},
			{
				Name:      "load",
				Usage:     "Load app into Kubernetes (same as kube apply -f)",
				ArgsUsage: "<app.yaml>",
				Action:    appLoad,
			},
			{
				Name:      "local",
				Usage:     "Run app locally with cluster environment. Either --app or --manifest is required",
				ArgsUsage: "<executable> [args...]",
				Action:    appLocal,
				Flags: []cli.Flag{
					&cli.StringFlag{
						Name:    "app",
						Aliases: []string{"a"},
						Usage:   "name of app to load environment from. app must exist in the cluster",
					},
					&cli.StringFlag{
						Name:    "manifest",
						Aliases: []string{"m"},
						Usage:   "path to an app manifest. use to test an app before deployed to cluster",
					},
					targetFlag,
					&cli.StringSliceFlag{
						Name:    "env",
						Aliases: []string{"e"},
						Usage:   "additional environment variables to pass. --env KEY=VALUE",
					},
				},
			},
			{
				Name:      "logs",
				Usage:     "Print logs from a pod for the app",
				Aliases:   []string{"log"},
				ArgsUsage: "<app>",
				Action:    appLogs,
				Flags: []cli.Flag{
					&cli.BoolFlag{
						Name:    "follow",
						Aliases: []string{"f"},
						Usage:   "follow logs",
					},
					&cli.IntFlag{
						Name:  "tail",
						Usage: "number of lines to include from tail (default 100, -1 for all)",
						Value: 100,
					},
					podFlag,
					targetFlag,
					releaseFlag,
				},
			},
			{
				Name:   "new",
				Usage:  "Create a new app.yaml from template",
				Action: appNew,
			},
			{
				Name:      "pods",
				Usage:     "List pods for this app",
				ArgsUsage: "<app>",
				Action:    appPods,
				Flags: []cli.Flag{
					targetFlag,
					releaseFlag,
				},
			},
			{
				Name:      "restart",
				Usage:     "Restart the current app",
				ArgsUsage: "<app>",
				Action:    appRestart,
				Flags: []cli.Flag{
					targetFlag,
				},
			},
			{
				Name:      "rollback",
				Usage:     "Rolls back a bad release and deploys a previous one",
				ArgsUsage: "<app>",
				Action:    appRollback,
				Flags: []cli.Flag{
					targetFlag,
					releaseFlag,
				},
			},
			{
				Name:      "shell",
				Usage:     "Get shell access into a pod with the app",
				ArgsUsage: "<app>",
				Action:    appShell,
				Flags: []cli.Flag{
					podFlag,
					targetFlag,
					releaseFlag,
					&cli.StringFlag{
						Name:    "shell",
						Aliases: []string{"s"},
						Usage:   "command to run as the shell",
						Value:   "/bin/sh",
					},
				},
			},
			{
				Name:      "status",
				Usage:     "Information about the app and its targets",
				Action:    appStatus,
				ArgsUsage: "<app>",
				Flags: []cli.Flag{
					targetFlag,
				},
			},
		},
	},
}
View Source
var CertificateCommands = []*cli.Command{
	{
		Name:     "certificate",
		Category: "Cluster",
		Usage:    "Manage SSL certificates on this cluster",
		Aliases: []string{
			"cert",
		},
		Action: func(c *cli.Context) error {
			return cli.ShowAppHelp(c)
		},
		Subcommands: []*cli.Command{
			{
				Name:   "list",
				Usage:  "List certificates in Kube",
				Action: certList,
			},
			{
				Name:   "sync",
				Usage:  "Sync certificates from cloud provider",
				Action: certSync,
			},
			{
				Name:   "import",
				Usage:  "Imports an existing certificate to provider's certificate management",
				Action: certImport,
				Flags: []cli.Flag{
					&cli.StringFlag{
						Name:     "domain",
						Usage:    "the domain to load this certificate",
						Required: true,
					},
					&cli.StringFlag{
						Name:     "certificate",
						Usage:    "certificate file",
						Required: true,
					},
					&cli.StringFlag{
						Name:     "private-key",
						Usage:    "private key file",
						Required: true,
					},
					&cli.StringFlag{
						Name:  "chain",
						Usage: "intermediate certificate chain file",
					},
				},
			},
		},
	},
}
View Source
var ClusterCommands = []*cli.Command{
	{
		Name:     "cluster",
		Usage:    "Cluster commands",
		Before:   ensureSetup,
		Category: "Cluster",
		Subcommands: []*cli.Command{
			{
				Name:   "configure",
				Usage:  "configure cluster settings",
				Action: clusterConfigure,
			},
			{
				Name:   "create",
				Usage:  "creates a cluster",
				Action: clusterCreate,
			},
			{
				Name:   "destroy",
				Usage:  "destroys a cluster",
				Action: clusterDestroy,
				Flags: []cli.Flag{
					clusterNameFlag,
				},
			},
			{
				Name:   "export",
				Usage:  "export apps, configs, and other cluster data",
				Action: clusterExport,
				Flags: []cli.Flag{
					&cli.StringFlag{
						Name:     "dir",
						Usage:    "directory to export cluster data to",
						Required: true,
					},
				},
			},
			{
				Name:   "import",
				Usage:  "import apps, builds, and configs into the selected cluster",
				Action: clusterImport,
				Flags: []cli.Flag{
					&cli.StringFlag{
						Name:     "dir",
						Usage:    "directory to import cluster data from",
						Required: true,
					},
				},
			},
			{
				Name:   "list",
				Usage:  "list clusters",
				Action: clusterList,
			},
			{
				Name:      "select",
				Usage:     "select an active cluster to work with",
				ArgsUsage: "<cluster>",
				Action: func(c *cli.Context) error {
					if c.Bool("reset") {
						return clusterReset()
					}
					if c.NArg() == 0 {
						cli.ShowSubcommandHelp(c)
						return nil
					}
					return clusterSelect(c.Args().Get(0))
				},
				Flags: []cli.Flag{
					&cli.BoolFlag{
						Name:  "reset",
						Usage: "unset current selected cluster",
					},
				},
			},
			{
				Name:   "shell",
				Usage:  "shell into a pod created for debugging. (deleted after terminating)",
				Action: clusterShell,
				Flags: []cli.Flag{
					&cli.StringFlag{
						Name:  "image",
						Usage: "docker image to use for the pod",
						Value: "debian:latest",
					},
					&cli.BoolFlag{
						Name:  "force",
						Usage: "deletes an existing debugging image if exists",
					},
					&cli.StringSliceFlag{
						Name:  "cmd",
						Usage: "pass custom command and arguments",
					},
				},
			},
			{
				Name:   "status",
				Usage:  "Information about the cluster",
				Action: clusterStatus,
			},
			{
				Name:   "reinstall",
				Usage:  "reinstalls Konstellation components",
				Action: clusterReinstall,
			},
			{
				Name:   "get-token",
				Usage:  "returns a kubernetes compatible token",
				Action: clusterGetToken,
				Hidden: true,
				Flags: []cli.Flag{
					clusterNameFlag,
				},
			},
		},
	},
}
View Source
var ConfigCommands = []*cli.Command{
	{
		Name:  "config",
		Usage: "Config for apps",
		Before: func(c *cli.Context) error {
			return ensureClusterSelected()
		},
		Category: "App",
		Subcommands: []*cli.Command{
			{
				Name:   "delete",
				Usage:  "Delete a config",
				Action: configDelete,
				Flags: []cli.Flag{
					nameFlag,
					appFlag,
					&cli.StringFlag{
						Name:  "target",
						Usage: "delete config for a single target",
					},
				},
			},
			{
				Name:   "edit",
				Usage:  "Create or edit a config. Use --app to edit an app config, or --name to edit a shared config",
				Action: configEdit,
				Flags: []cli.Flag{
					nameFlag,
					appFlag,
					&cli.StringFlag{
						Name:  "target",
						Usage: "edit config only for a specific target (target values will override the base config)",
					},
				},
			},
			{
				Name:   "list",
				Usage:  "List config files on this cluster",
				Action: configList,
				Flags: []cli.Flag{
					appFilterFlag,
				},
			},
			{
				Name:      "show",
				Usage:     "Show config for a release of the app",
				Action:    configShow,
				ArgsUsage: "<release>",
			},
		},
	},
}
View Source
var LaunchCommands = []*cli.Command{
	{
		Name:     "launch",
		Usage:    "Launch management webapps",
		Category: "Cluster",
		Before: func(c *cli.Context) error {
			return ensureClusterSelected()
		},
		Action: func(c *cli.Context) error {
			return cli.ShowAppHelp(c)
		},
		Subcommands: []*cli.Command{
			{
				Name:   "alertmanager",
				Usage:  "Launch Alert Manager",
				Action: launchAlertManager,
			},
			{
				Name:   "grafana",
				Usage:  "Launch Grafana",
				Action: launchGrafana,
			},
			{
				Name:   "kubedash",
				Usage:  "Launch Kubernetes Dashboard",
				Action: launchKubeDash,
			},
			{
				Name:   "prometheus",
				Usage:  "Launch Prometheus UI",
				Action: launchPrometheus,
			},
			{
				Name:   "proxy",
				Usage:  "Start a proxy to any service",
				Action: launchProxy,
				Flags: []cli.Flag{
					&cli.StringFlag{
						Name:     "app",
						Aliases:  []string{"service"},
						Usage:    "name of app or service to proxy",
						Required: true,
					},
					&cli.StringFlag{
						Name:    "target",
						Aliases: []string{"namespace"},
						Usage:   "target or namespace of the service (defaults to first target)",
					},
					&cli.StringFlag{
						Name:  "port",
						Usage: "port name or number for the service",
					},
				},
			},
		},
	},
}
View Source
var NodepoolCommands = []*cli.Command{
	{
		Name:     "nodepool",
		Usage:    "Nodepool management",
		Category: "Cluster",
		Before: func(c *cli.Context) error {
			return ensureClusterSelected()
		},
		Subcommands: []*cli.Command{
			{
				Name:   "list",
				Usage:  "list Nodepools in the current cluster",
				Action: nodepoolList,
			},
			{
				Name:   "create",
				Usage:  "create a new Nodepool",
				Action: nodepoolCreate,
			},
			{
				Name:   "destroy",
				Usage:  "destroys a Nodepool",
				Action: nodepoolDestroy,
				Flags: []cli.Flag{
					&cli.StringFlag{
						Name:     "nodepool",
						Usage:    "Name of Nodepool to destroy",
						Required: true,
					},
				},
			},
		},
	},
}
View Source
var SetupCommands = []*cli.Command{
	{
		Name:     "setup",
		Usage:    "Setup Konstellation CLI",
		Category: "Other",
		Action:   setupStart,
	},
}
View Source
var VPCCommands = []*cli.Command{
	{
		Name:     "vpc",
		Usage:    "VPC management",
		Category: "Other",
		Before:   ensureSetup,
		Subcommands: []*cli.Command{
			{
				Name:   "list",
				Usage:  "list VPCs in configured regions",
				Action: vpcList,
			},
			{
				Name:   "destroy",
				Usage:  "destroys a Konstellation-created VPC",
				Action: vpcDestroy,
				Flags: []cli.Flag{
					&cli.StringFlag{
						Name:     "vpc",
						Usage:    "ID of VPC to destroy",
						Required: true,
					},
				},
			},
		},
	},
}

Functions

func ChooseCloudPrompt

func ChooseCloudPrompt(label string) (providers.CloudProvider, error)

func ChooseClusterManagerPrompt

func ChooseClusterManagerPrompt(label string) (providers.ClusterManager, error)

func ClusterManagerForCluster

func ClusterManagerForCluster(cluster string) (cm providers.ClusterManager, err error)

func GetCloud

func GetCloud(name string) providers.CloudProvider

func GetClusterManagers

func GetClusterManagers() []providers.ClusterManager

func NewClusterManager

func NewClusterManager(cloud string, region string) providers.ClusterManager

func PromptClusterGenerator

func PromptClusterGenerator(cloud providers.CloudProvider, region string) (providers.ClusterConfigGenerator, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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