Documentation
¶
Index ¶
Constants ¶
View Source
const ( KindClusterKind = "kind" ExistingClusterKind = "unknown" )
View Source
const ( DefaultControlPlanes = 1 DefaultWorkers = 3 )
Variables ¶
This section is empty.
Functions ¶
func GetConfig ¶
func GetConfig() (clientcmd.ClientConfig, error)
GetConfig creates a clientcmd.ClientConfig for talking to a Kubernetes API server, the config precedence is as below: 1. KUBECONFIG environment variable pointing at files 2. $HOME/.kube/config if exists 3. In-cluster config if running in cluster
Types ¶
type Cluster ¶
type Cluster interface {
fmt.Stringer
// GetKind returns the kind of cluster.
GetKind() string
// Startup runs a cluster.
Startup(output io.Writer) error
// Load images into a cluster.
LoadImages(output io.Writer) error
// Cleanup closes the cluster.
Cleanup(output io.Writer) error
}
Cluster defines the basic actions of a cluster handler.
func GetExistCluster ¶
func GetExistCluster() Cluster
GetExistCluster returns the exist cluster from environment,
func NewLocalCluster ¶
func NewLocalCluster() Cluster
NewLocalCluster returns the local cluster from environment, the default runtime is based on kubernetes-sigs/kind.
type ExistingCluster ¶
type ExistingCluster struct {
}
ExistingCluster is a cluster which provided by kubeConfig, so It's kind is unknown.
func (*ExistingCluster) GetKind ¶
func (e *ExistingCluster) GetKind() string
func (*ExistingCluster) LoadImages ¶
func (e *ExistingCluster) LoadImages(output io.Writer) error
func (*ExistingCluster) String ¶
func (e *ExistingCluster) String() string
type LocalKindCluster ¶
type LocalKindCluster struct {
// Specify the exported ingress http port for running cluster,
// configure in "KIND_EXPORT_INGRESS_HTTP_PORT" env,
// default is created randomly.
ExportIngressHTTPPort int
// Specify the exported ingress https port for running cluster,
// configure in "KIND_EXPORT_INGRESS_HTTPS_PORT" env,
// default is created randomly.
ExportIngressHTTPSPort int
// Specify the exported image storage port for running cluster,
// configure in "KIND_EXPORT_IMAGE_STORAGE_PORT" env,
// default is created randomly.
ExportImageStoragePort int
// Specify the image for running cluster,
// configure in "KIND_IMAGE" env,
// default is "kindest/node:v1.18.2".
Image string
// Specify the image mirror,
// configure in "KIND_IMAGE_MIRROR" env,
// default is "".
ImageMirror string
// Specify the name of cluster,
// configure in "KIND_CLUSTER_NAME" env,
// default is "cloudweav".
ClusterName string
// Specify the amount of control-plane nodes,
// configure in "KIND_CONTROL_PLANES" env,
// default is "1".
ControlPlanes int
// Specify the amount of worker nodes,
// configure in "KIND_WORKERS" env,
// default is "3".
Workers int
// Specify the wait timeout for bringing up cluster,
// configure in "KIND_WAIT_TIMEOUT" env,
// default is "10m".
WaitTimeout time.Duration
// Specify the path of preset cluster configuration,
// configure in "KIND_CLUSTER_CONFIG_PATH" env.
ClusterConfigPath string
}
LocalKindCluster specifies the configurable parameters to launch a local kubernetes-sigs/kind cluster.
func NewLocalKindCluster ¶
func NewLocalKindCluster() *LocalKindCluster
func (LocalKindCluster) GetKind ¶
func (c LocalKindCluster) GetKind() string
func (LocalKindCluster) LoadImages ¶
func (c LocalKindCluster) LoadImages(output io.Writer) error
func (LocalKindCluster) String ¶
func (c LocalKindCluster) String() string
Click to show internal directories.
Click to hide internal directories.