k3d/cli/types.go
Alvaro Saurin 284db4d74b
New option for starting a local registry.
A new option, --enable-registry, has been added for starting a local, private registry.
This registry will be shared between all the k3d clusters created with --enable-registry.
The registry container will be removed when the last of them is removed.

Two extra options, --registry-name and --registry-port, have been included for specifying
the hostname and port where the registry will be available.

Signed-off-by: Alvaro Saurin <alvaro.saurin@gmail.com>
2020-01-17 20:41:10 +01:00

59 lines
1.5 KiB
Go

package run
import (
"github.com/docker/docker/api/types"
"github.com/docker/go-connections/nat"
)
// Globally used constants
const (
DefaultRegistry = "docker.io"
DefaultServerCount = 1
)
// defaultNodes describes the type of nodes on which a port should be exposed by default
const defaultNodes = "server"
// defaultLabelNodes describes the type of nodes on which a label should be applied by default
const defaultLabelNodes = "all"
// mapping a node role to groups that should be applied to it
var nodeRuleGroupsMap = map[string][]string{
"worker": {"all", "workers", "agents"},
"server": {"all", "server", "master"},
}
// Cluster describes an existing cluster
type Cluster struct {
name string
image string
status string
serverPorts []string
server types.Container
workers []types.Container
}
// ClusterSpec defines the specs for a cluster that's up for creation
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
RegistryEnabled bool
RegistryName string
RegistryPort int
ServerArgs []string
Volumes *Volumes
}
// PublishedPorts is a struct used for exposing container ports on the host system
type PublishedPorts struct {
ExposedPorts map[nat.Port]struct{}
PortBindings map[nat.Port][]nat.PortBinding
}