cluster

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cluster implements helpers for creating test clusters using kind as a library. The helpers facilitate some common customizations of clusters, such as creating multiple worker nodes or exposing a node port to facilitate the access to services deployed in the cluster using NodePort services. Other customizations can be achieved by providing a valid kind configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteCluster added in v0.3.8

func DeleteCluster(name string, silent bool) error

DeleteCluster deletes an existing cluster

Types

type Cluster

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

Cluster an active test cluster

func GetCluster added in v0.3.4

func GetCluster(name string, kubeconfig string) (*Cluster, error)

GetCluster returns an existing cluster if exists, nil otherwise

func (*Cluster) Delete

func (c *Cluster) Delete() error

Delete deletes a test cluster

func (*Cluster) Kubeconfig

func (c *Cluster) Kubeconfig() string

Kubeconfig returns the path to the kubeconfig for the test cluster

func (*Cluster) Load added in v0.3.10

func (c *Cluster) Load(images ...string) error

Load loads the supplied images into the cluster.

func (*Cluster) Name added in v0.3.4

func (c *Cluster) Name() string

Name returns the name of the cluster

type Config

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

Config contains the configuration for creating a cluster

func DefaultConfig

func DefaultConfig() (*Config, error)

DefaultConfig creates a ClusterConfig with default options and default name "test-cluster"

func NewConfig

func NewConfig(name string, options Options) (*Config, error)

NewConfig creates a ClusterConfig with the ClusterOptions

func (*Config) Create

func (c *Config) Create() (*Cluster, error)

Create creates a test cluster with the given name

func (*Config) Render

func (c *Config) Render() (string, error)

Render returns the Kind configuration for creating a cluster with this ClusterConfig

type NodePort

type NodePort struct {
	// NodePort to access in the cluster
	NodePort int32
	// Port used in the host to access the node port
	HostPort int32
}

NodePort defines the mapping of a node port to host port

type Options

type Options struct {
	// cluster configuration to use. Overrides other options (NodePorts, Workers)
	Config string
	// List of images to pre-load on each node.
	// The images must be available locally (e.g. with docker pull <image>)
	Images []string
	// maximum time to wait for cluster creation.
	Wait time.Duration
	// node ports to expose
	NodePorts []NodePort
	// number of worker nodes
	Workers int
	// Kubernetes version
	Version string
	// Path to Kubeconfig
	Kubeconfig string
	// UseEtcdRAMDisk
	UseEtcdRAMDisk bool
}

Options defines options for customizing the cluster

Jump to

Keyboard shortcuts

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