run

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRegistry    = "docker.io"
	DefaultServerCount = 1
)

Globally used constants

Variables

This section is empty.

Functions

func AddNode added in v1.4.0

func AddNode(c *cli.Context) error

AddNode adds a node to an existing cluster

func CheckClusterName added in v1.1.0

func CheckClusterName(name string) error

CheckClusterName ensures that a cluster name is also a valid host name according to RFC 1123. We further restrict the length of the cluster name to maximum 'clusterNameMaxSize' so that we can construct the host names based on the cluster name, and still stay within the 64 characters limit.

func CheckTools

func CheckTools(c *cli.Context) error

CheckTools checks if the docker API server is responding

func CreateCluster

func CreateCluster(c *cli.Context) error

CreateCluster creates a new single-node cluster container and initializes the cluster directory

func DeleteCluster

func DeleteCluster(c *cli.Context) error

DeleteCluster removes the containers belonging to a cluster and its local directory

func GenerateRandomString added in v1.0.0

func GenerateRandomString(n int) string

GenerateRandomString thanks to https://stackoverflow.com/a/31832326/6450189 GenerateRandomString is used to generate a random string that is used as a cluster secret

func GetAllContainerNames added in v1.2.0

func GetAllContainerNames(clusterName string, serverCount, workerCount int) []string

GetAllContainerNames returns a list of all containernames that will be created

func GetContainerName added in v1.2.0

func GetContainerName(role, clusterName string, postfix int) string

GetContainerName generates the container names

func GetKubeConfig

func GetKubeConfig(c *cli.Context) error

GetKubeConfig grabs the kubeconfig from the running cluster and prints the path to stdout

func ImportImage added in v1.3.0

func ImportImage(c *cli.Context) error

ImportImage saves an image locally and imports it into the k3d containers

func ListClusters

func ListClusters(c *cli.Context) error

ListClusters prints a list of created clusters

func MergeLabelSpecs added in v1.5.0

func MergeLabelSpecs(nodeToLabelSpecMap map[string][]string, role, name string) ([]string, error)

MergeLabelSpecs merges labels for a given node

func MergeLabels added in v1.5.0

func MergeLabels(labelMap map[string]string, labels []string) map[string]string

MergeLabels merges list of labels into a label map

func MergePortSpecs added in v1.2.0

func MergePortSpecs(nodeToPortSpecMap map[string][]string, role, name string) ([]string, error)

MergePortSpecs merges published ports for a given node

func Shell added in v1.2.2

func Shell(c *cli.Context) error

Shell starts a new subshell with the KUBECONFIG pointing to the selected cluster

func StartCluster

func StartCluster(c *cli.Context) error

StartCluster starts a stopped cluster container

func StopCluster

func StopCluster(c *cli.Context) error

StopCluster stops a running cluster container (restartable)

func ValidateHostname added in v1.2.0

func ValidateHostname(name string) error

ValidateHostname ensures that a cluster name is also a valid host name according to RFC 1123.

Types

type Cluster added in v1.4.0

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

Cluster describes an existing cluster

type ClusterSpec added in v1.2.2

type ClusterSpec struct {
	AgentArgs            []string
	APIPort              apiPort
	AutoRestart          bool
	ClusterName          string
	Env                  []string
	NodeToLabelSpecMap   map[string][]string
	Image                string
	NodeToPortSpecMap    map[string][]string
	PortAutoOffset       int
	RegistriesFile       string
	RegistryEnabled      bool
	RegistryCacheEnabled bool
	RegistryName         string
	RegistryPort         int
	RegistryVolume       string
	ServerArgs           []string
	Volumes              *Volumes
}

ClusterSpec defines the specs for a cluster that's up for creation

type Mirror added in v1.5.0

type Mirror struct {
	// Endpoints are endpoints for a namespace. CRI plugin will try the endpoints
	// one by one until a working one is found. The endpoint must be a valid url
	// with host specified.
	// The scheme, host and path from the endpoint URL will be used.
	Endpoints []string `toml:"endpoint" yaml:"endpoint"`
}

Mirror contains the config related to the registry mirror

type PublishedPorts added in v1.2.0

type PublishedPorts struct {
	ExposedPorts map[nat.Port]struct{}
	PortBindings map[nat.Port][]nat.PortBinding
}

PublishedPorts is a struct used for exposing container ports on the host system

func CreatePublishedPorts added in v1.2.0

func CreatePublishedPorts(specs []string) (*PublishedPorts, error)

CreatePublishedPorts is the factory function for PublishedPorts

func (*PublishedPorts) AddPort added in v1.2.0

func (p *PublishedPorts) AddPort(portSpec string) (*PublishedPorts, error)

AddPort creates a new PublishedPort struct with one more port, based on 'portSpec'

func (PublishedPorts) Offset added in v1.2.0

func (p PublishedPorts) Offset(offset int) *PublishedPorts

Offset creates a new PublishedPort structure, with all host ports are changed by a fixed 'offset'

type Registry added in v1.5.0

type Registry struct {
	// Mirrors are namespace to mirror mapping for all namespaces.
	Mirrors map[string]Mirror `toml:"mirrors" yaml:"mirrors"`

	// Configs are configs for each registry.
	// The key is the FDQN or IP of the registry.
	Configs map[string]interface{} `toml:"configs" yaml:"configs"`

	// Auths are registry endpoint to auth config mapping. The registry endpoint must
	// be a valid url with host specified.
	// DEPRECATED: Use Configs instead. Remove in containerd 1.4.
	Auths map[string]interface{} `toml:"auths" yaml:"auths"`
}

Registry is registry settings configured

type Volumes added in v1.3.3

type Volumes struct {
	DefaultVolumes       []string
	NodeSpecificVolumes  map[string][]string
	GroupSpecificVolumes map[string][]string
}

func NewVolumes added in v1.3.3

func NewVolumes(volumes []string) (*Volumes, error)

Jump to

Keyboard shortcuts

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