provision

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: MPL-2.0 Imports: 9 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 Cluster

type Cluster interface {
	TalosConfig() *config.Config
	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)

	// 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 ClusterNameReflector

type ClusterNameReflector interface {
	Reflect(ctx context.Context, clusterName string) (Cluster, error)
}

ClusterNameReflector rebuilds Cluster information by cluster name.

type ClusterRequest

type ClusterRequest struct {
	Name string

	Network NetworkRequest
	Nodes   NodeRequests

	Image             string
	KubernetesVersion string
}

ClusterRequest is the root object describing cluster to be provisioned.

type NetworkInfo

type NetworkInfo struct {
	Name string
	CIDR net.IPNet
}

NetworkInfo describes cluster network.

type NetworkRequest

type NetworkRequest struct {
	Name string
	CIDR net.IPNet
	MTU  int
}

NetworkRequest describe cluster network.

type NodeInfo

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

	PublicIP  net.IP
	PrivateIP net.IP
}

NodeInfo describes a node.

type NodeRequest

type NodeRequest struct {
	Type generate.Type
	Name string
	IP   net.IP

	// Share of CPUs, in 1e-9 fractions
	NanoCPUs int64
	// Memory limit in bytes
	Memory 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 WithEndpoint

func WithEndpoint(endpoint string) Option

WithEndpoint specifies endpoint to use when acessing Talos cluster.

func WithForceInitNodeAsEndpoint

func WithForceInitNodeAsEndpoint() Option

WithForceInitNodeAsEndpoint uses direct IP of init node as endpoint instead of (default) mode.

func WithLogWriter

func WithLogWriter(w io.Writer) Option

WithLogWriter sets logging destination.

type Options

type Options struct {
	LogWriter               io.Writer
	ForceInitNodeAsEndpoint bool
	ForceEndpoint           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

	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.
providers
docker
Package docker implements Provisioner via docker.
Package docker implements Provisioner via docker.

Jump to

Keyboard shortcuts

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