create

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action interface {
	// Tasks returns the list of task that are identified by this action
	// Please note that the order of task is important, and it will be
	// respected during execution
	Tasks() []Task
}

Action define a set of tasks to be executed on a `kind` cluster. TODO(bentheelder): redesign this for concurrency Usage of actions allows to define repetitive, high level abstractions/workflows by composing lower level tasks

type Context

type Context struct {
	*meta.ClusterMeta
	// other fields
	Status *logutil.Status
	Config *config.Config
	*DerivedConfig
	Retain       bool          // if we should retain nodes after failing to create.
	WaitForReady time.Duration // Wait for the control plane node to be ready.
}

Context is a superset of cluster.Context implementing helpers internal to Context.Create()

func (*Context) EnsureNodeImages

func (cc *Context) EnsureNodeImages()

EnsureNodeImages ensures that the node images used by the create configuration are present

func (*Context) Exec

func (cc *Context) Exec(nodeList map[string]*nodes.Node, actions []string, wait time.Duration) error

Exec actions on kubernetes-in-docker cluster TODO(bentheelder): refactor this further Actions are repetitive, high level abstractions/workflows composed by one or more lower level tasks, that automatically adapt to the current cluster topology

func (*Context) ProvisionNodes

func (cc *Context) ProvisionNodes() (nodeList map[string]*nodes.Node, err error)

ProvisionNodes takes care of creating all the containers that will host `kind` nodes

type DerivedConfig

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

DerivedConfig contains config-like data computed from pkg/cluster/config.Config namely, it contains lists of NodeReplicas to be created based on the config

func Derive

func Derive(c *config.Config) (*DerivedConfig, error)

Derive populates DerivedConfig info starting from the current list on Nodes

func (*DerivedConfig) Add

func (d *DerivedConfig) Add(node *config.Node) error

Add a Node to the `kind` cluster, generating requested node replicas and assigning a unique node name to each replica.

func (*DerivedConfig) AllReplicas

func (d *DerivedConfig) AllReplicas() ReplicaList

AllReplicas returns all the node replicas defined in the `kind` Config.

func (*DerivedConfig) BootStrapControlPlane

func (d *DerivedConfig) BootStrapControlPlane() *NodeReplica

BootStrapControlPlane returns the first node with control-plane role This is the node where kubeadm init will be executed.

func (*DerivedConfig) ControlPlanes

func (d *DerivedConfig) ControlPlanes() ReplicaList

ControlPlanes returns all the nodes with control-plane role

func (*DerivedConfig) ExternalEtcd

func (d *DerivedConfig) ExternalEtcd() *NodeReplica

ExternalEtcd returns the node with external-etcd role, if defined

func (*DerivedConfig) ExternalLoadBalancer

func (d *DerivedConfig) ExternalLoadBalancer() *NodeReplica

ExternalLoadBalancer returns the node with external-load-balancer role, if defined

func (*DerivedConfig) SecondaryControlPlanes

func (d *DerivedConfig) SecondaryControlPlanes() ReplicaList

SecondaryControlPlanes returns all the nodes with control-plane role except the BootStrapControlPlane node, if any,

func (*DerivedConfig) Validate

func (d *DerivedConfig) Validate() error

Validate validates that the configuration is possible to create

func (*DerivedConfig) Workers

func (d *DerivedConfig) Workers() ReplicaList

Workers returns all the nodes with Worker role, if any

type NodeReplica

type NodeReplica struct {
	// Node contains settings for the node in the `kind` Config.
	// please note that the Replicas number is alway set to nil.
	config.Node

	// Name contains the unique name assigned to the node while generating the replica
	Name string
}

NodeReplica defines a `kind` config Node that is geneated by creating a replicas for a node This attribute exists only in the internal config version and is meant to simplify the usage of the config in the code base.

func (*NodeReplica) ProvisioningOrder

func (n *NodeReplica) ProvisioningOrder() int

ProvisioningOrder returns the provisioning order for nodes, that should be defined according to the assigned NodeRole

type ReplicaList

type ReplicaList []*NodeReplica

ReplicaList defines a list of NodeReplicas in the `kind` Config This attribute exists only in the internal config version and is meant to simplify the usage of the config in the code base.

func (ReplicaList) Len

func (t ReplicaList) Len() int

Len of the NodeList. It is required for making NodeList sortable.

func (ReplicaList) Less

func (t ReplicaList) Less(i, j int) bool

Less return the lower between two elements of the NodeList, where the lower element should be provisioned before the other. It is required for making NodeList sortable.

func (ReplicaList) Swap

func (t ReplicaList) Swap(i, j int)

Swap two elements of the NodeList. It is required for making NodeList sortable.

type Task

type Task struct {
	// Description of the task
	Description string
	// TargetNodes define a function that identifies the nodes where this
	// task should be executed
	TargetNodes nodeSelector
	// Run the func that implements the task action
	Run func(*execContext, *NodeReplica) error
}

Task define a logical step of an action to be executed on a `kind` cluster. At exec time the logical step will then apply to the current cluster topology, and be planned for execution zero, one or many times accordingly.

Jump to

Keyboard shortcuts

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