cluster

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 13 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

This section is empty.

Types

type Cluster

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

Cluster an active test cluster

func (*Cluster) AllocatePort

func (c *Cluster) AllocatePort() NodePort

AllocatePort reserves a port from the pool of ports exposed by the cluster to ensure it is not been used by other service

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) ReleasePort

func (c *Cluster) ReleasePort(p NodePort)

ReleasePort makes available a Port previously allocated by AllocatePort

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
}

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