Documentation ¶
Index ¶
- func CheckClusterName(name string) error
- func CheckTools(c *cli.Context) error
- func CreateCluster(c *cli.Context) error
- func DeleteCluster(c *cli.Context) error
- func GenerateRandomString(n int) string
- func GetAllContainerNames(clusterName string, serverCount, workerCount int) []string
- func GetContainerName(role, clusterName string, postfix int) string
- func GetKubeConfig(c *cli.Context) error
- func ImportImage(c *cli.Context) error
- func ListClusters(c *cli.Context) error
- func MergePortSpecs(nodeToPortSpecMap map[string][]string, role, name string) ([]string, error)
- func Shell(c *cli.Context) error
- func StartCluster(c *cli.Context) error
- func StopCluster(c *cli.Context) error
- func ValidateHostname(name string) error
- type ClusterSpec
- type PublishedPorts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckClusterName ¶ added in v1.1.0
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 ¶
CheckTools checks if the docker API server is responding
func CreateCluster ¶
CreateCluster creates a new single-node cluster container and initializes the cluster directory
func DeleteCluster ¶
DeleteCluster removes the containers belonging to a cluster and its local directory
func GenerateRandomString ¶ added in v1.0.0
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
GetAllContainerNames returns a list of all containernames that will be created
func GetContainerName ¶ added in v1.2.0
GetContainerName generates the container names
func GetKubeConfig ¶
GetKubeConfig grabs the kubeconfig from the running cluster and prints the path to stdout
func ImportImage ¶ added in v1.3.0
ImportImage saves an image locally and imports it into the k3d containers
func ListClusters ¶
ListClusters prints a list of created clusters
func MergePortSpecs ¶ added in v1.2.0
MergePortSpecs merges published ports for a given node
func Shell ¶ added in v1.2.2
Shell starts a new subshell with the KUBECONFIG pointing to the selected cluster
func StartCluster ¶
StartCluster starts a stopped cluster container
func StopCluster ¶
StopCluster stops a running cluster container (restartable)
func ValidateHostname ¶ added in v1.2.0
ValidateHostname ensures that a cluster name is also a valid host name according to RFC 1123.
Types ¶
type ClusterSpec ¶ added in v1.2.2
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'