provision

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package provision provides abstract definitions for Talos cluster provisioners.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CNIConfig added in v0.4.0

type CNIConfig struct {
	BinPath  []string
	ConfDir  string
	CacheDir string
}

CNIConfig describes CNI part of NetworkRequest.

type Cluster

type Cluster interface {
	// Provisioner returns name of the provisioner used to build the cluster.
	Provisioner() string
	// StatePath returns path to the state directory of the cluster.
	StatePath() (string, error)
	// Info returns running cluster information.
	Info() ClusterInfo
}

Cluster describes the provisioned Cluster.

type ClusterAccess

type ClusterAccess interface {
	Cluster

	// Client returns default Talos client.
	Client(endpoints ...string) (*client.Client, error)

	// K8sClient returns Kubernetes client.
	K8sClient(context.Context) (*kubernetes.Clientset, error)

	// CrashDump essential info for debugging from Talos node.
	CrashDump(context.Context, io.Writer)

	// Close shuts down all the clients.
	Close() error
}

ClusterAccess extends Cluster interface to provide clients to the cluster.

type ClusterInfo

type ClusterInfo struct {
	ClusterName string

	Network NetworkInfo
	Nodes   []NodeInfo
}

ClusterInfo describes the cluster.

type ClusterRequest

type ClusterRequest struct {
	Name string

	Network NetworkRequest
	Nodes   NodeRequests

	Image         string
	KernelPath    string
	InitramfsPath string

	// Path to talosctl executable to re-execute itself as needed.
	SelfExecutable string

	// Path to root of state directory (~/.talos/clusters by default).
	StateDirectory string
}

ClusterRequest is the root object describing cluster to be provisioned.

type LoadBalancerConfig added in v0.4.0

type LoadBalancerConfig struct {
	// Limit apid connection load-balancing to init node
	LimitApidOnlyInitNode bool
}

LoadBalancerConfig describes load balancer provisioned for the cluster.

type NetworkInfo

type NetworkInfo struct {
	Name        string
	CIDR        net.IPNet
	GatewayAddr net.IP
	MTU         int
}

NetworkInfo describes cluster network.

type NetworkRequest

type NetworkRequest struct {
	Name        string
	CIDR        net.IPNet
	GatewayAddr net.IP
	MTU         int
	Nameservers []net.IP

	// CNI-specific parameters.
	CNI CNIConfig

	LoadBalancer LoadBalancerConfig
}

NetworkRequest describes cluster network.

type NodeInfo

type NodeInfo struct {
	ID   string
	Name string
	Type machine.Type

	// Share of CPUs, in 1e-9 fractions
	NanoCPUs int64
	// Memory limit in bytes
	Memory int64
	// Disk (volume) size in bytes, if applicable
	DiskSize int64

	PublicIP  net.IP
	PrivateIP net.IP
}

NodeInfo describes a node.

type NodeRequest

type NodeRequest struct {
	Name   string
	IP     net.IP
	Config runtime.Configurator

	// Share of CPUs, in 1e-9 fractions
	NanoCPUs int64
	// Memory limit in bytes
	Memory int64
	// Disk (volume) size in bytes, if applicable
	DiskSize int64
}

NodeRequest describes a request for a node.

type NodeRequests

type NodeRequests []NodeRequest

NodeRequests is a list of NodeRequest.

func (NodeRequests) FindInitNode

func (reqs NodeRequests) FindInitNode() (req NodeRequest, err error)

FindInitNode looks up init node, it returns an error if no init node is present or if it's duplicate.

func (NodeRequests) MasterNodes

func (reqs NodeRequests) MasterNodes() (nodes []NodeRequest)

MasterNodes returns subset of nodes which are Init/ControlPlane type.

func (NodeRequests) WorkerNodes

func (reqs NodeRequests) WorkerNodes() (nodes []NodeRequest)

WorkerNodes returns subset of nodes which are Init/ControlPlane type.

type Option

type Option func(o *Options) error

Option controls Provisioner.

func WithBootladerEmulation added in v0.4.0

func WithBootladerEmulation() Option

WithBootladerEmulation enables bootloader emulation.

func WithDockerPorts added in v0.4.0

func WithDockerPorts(ports []string) Option

WithDockerPorts allows docker provisioner to expose ports on workers

func WithEndpoint

func WithEndpoint(endpoint string) Option

WithEndpoint specifies endpoint to use when acessing Talos cluster.

func WithLogWriter

func WithLogWriter(w io.Writer) Option

WithLogWriter sets logging destination.

func WithTalosClient added in v0.4.0

func WithTalosClient(client *client.Client) Option

WithTalosClient specifies client to use when acessing Talos cluster.

func WithTalosConfig added in v0.4.0

func WithTalosConfig(talosConfig *config.Config) Option

WithTalosConfig specifies talosconfig to use when acessing Talos cluster.

type Options

type Options struct {
	LogWriter     io.Writer
	TalosConfig   *config.Config
	TalosClient   *client.Client
	ForceEndpoint string

	// Enable bootloader by booting from disk image assets.
	BootloaderEmulation bool

	// Expose ports to worker machines in docker provisioner
	DockerPorts []string
}

Options describes Provisioner parameters.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns default options.

type Provisioner

type Provisioner interface {
	Create(context.Context, ClusterRequest, ...Option) (Cluster, error)
	Destroy(context.Context, Cluster, ...Option) error

	CrashDump(context.Context, Cluster, io.Writer)

	Reflect(ctx context.Context, clusterName, stateDirectory string) (Cluster, error)

	GenOptions(NetworkRequest) []generate.GenOption
	GetLoadBalancers(NetworkRequest) (internalEndpoint, externalEndpoint string)

	Close() error
}

Provisioner is an interface each provisioner should implement.

Directories

Path Synopsis
Package access provides methods to access provisioned Talos cluster.
Package access provides methods to access provisioned Talos cluster.
Package check provides set of checks to verify cluster readiness.
Package check provides set of checks to verify cluster readiness.
docker
Package docker implements Provisioner via docker.
Package docker implements Provisioner via docker.
firecracker
Package firecracker implements Provisioner via Firecracker VMs.
Package firecracker implements Provisioner via Firecracker VMs.
firecracker/inmemhttp
Package inmemhttp implements temporary HTTP server which is based off memory fs.
Package inmemhttp implements temporary HTTP server which is based off memory fs.

Jump to

Keyboard shortcuts

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