control

package
v19.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 38 Imported by: 8 modules, 40 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	identity.Identity
	Properties *serialize.JSONProperties `json:"properties,omitempty"` // Properties contains additional info about the cluster

	concurrency.TaskedLock
	// contains filtered or unexported fields
}

Controller contains the information about a cluster

func NewController

func NewController(svc iaas.Service) (*Controller, error)

NewController ...

func (*Controller) AddNode

func (c *Controller) AddNode(task concurrency.Task, req *pb.HostDefinition) (string, error)

AddNode adds one node

func (*Controller) AddNodes

func (c *Controller) AddNodes(task concurrency.Task, count int, req *pb.HostDefinition) (hosts []string, err error)

AddNodes adds <count> nodes

func (*Controller) CountNodes

func (c *Controller) CountNodes(task concurrency.Task) (_ uint, err error)

CountNodes returns the number of nodes in the cluster

func (*Controller) Create

func (c *Controller) Create(task concurrency.Task, req Request, f Foreman) (err error)

Create creates the necessary infrastructure of the Cluster

func (*Controller) Delete

func (c *Controller) Delete(task concurrency.Task) (err error)

Delete destroys everything related to the infrastructure built for the Cluster

func (*Controller) DeleteLastNode

func (c *Controller) DeleteLastNode(task concurrency.Task, selectedMaster string) (err error)

DeleteLastNode deletes the last Agent node added

func (*Controller) DeleteMetadata

func (c *Controller) DeleteMetadata(task concurrency.Task) (err error)

DeleteMetadata removes Cluster metadata from Object Storage

func (*Controller) DeleteSpecificNode

func (c *Controller) DeleteSpecificNode(task concurrency.Task, hostID string, selectedMaster string) (err error)

DeleteSpecificNode deletes the node specified by its ID

func (*Controller) Deserialize

func (c *Controller) Deserialize(buf []byte) error

Deserialize reads json code and reinstantiates cluster

func (*Controller) FindAvailableMaster

func (c *Controller) FindAvailableMaster(task concurrency.Task) (result string, err error)

FindAvailableMaster returns the ID of the first master available for execution

func (*Controller) FindAvailableNode

func (c *Controller) FindAvailableNode(task concurrency.Task) (id string, err error)

FindAvailableNode returns the ID of a node available

func (*Controller) ForceGetState

func (c *Controller) ForceGetState(task concurrency.Task) (state ClusterState.Enum, err error)

ForceGetState returns the current state of the Cluster Uses the "maker" GetState from Foreman

func (*Controller) GetIdentity

func (c *Controller) GetIdentity(task concurrency.Task) identity.Identity

GetIdentity returns the core data of a cluster

func (*Controller) GetNetworkConfig

func (c *Controller) GetNetworkConfig(task concurrency.Task) (_ clusterpropsv2.Network, err error)

GetNetworkConfig returns the network configuration of the cluster

func (*Controller) GetNode

func (c *Controller) GetNode(task concurrency.Task, hostID string) (host *pb.Host, err error)

GetNode returns a node based on its ID

func (*Controller) GetProperties

func (c *Controller) GetProperties(task concurrency.Task) *serialize.JSONProperties

GetProperties returns the properties of the cluster

func (*Controller) GetService

func (c *Controller) GetService(task concurrency.Task) iaas.Service

GetService returns the service from the provider

func (*Controller) GetState

func (c *Controller) GetState(task concurrency.Task) (state ClusterState.Enum, err error)

GetState returns the current state of the Cluster

func (*Controller) ListMasterIDs

func (c *Controller) ListMasterIDs(task concurrency.Task) []string

ListMasterIDs lists the IDs of the master nodes in the Cluster

func (*Controller) ListMasterIPs

func (c *Controller) ListMasterIPs(task concurrency.Task) []string

ListMasterIPs lists the IP addresses of the master nodes in the Cluster

func (*Controller) ListMasterNames

func (c *Controller) ListMasterNames(task concurrency.Task) []string

ListMasterNames lists the names of the master nodes in the Cluster

func (*Controller) ListMasters

func (c *Controller) ListMasters(task concurrency.Task) []*clusterpropsv1.Node

ListMasters lists the names of the master nodes in the Cluster

func (*Controller) ListNodeIDs

func (c *Controller) ListNodeIDs(task concurrency.Task) []string

ListNodeIDs lists the IDs of the nodes in the Cluster

func (*Controller) ListNodeIPs

func (c *Controller) ListNodeIPs(task concurrency.Task) []string

ListNodeIPs lists the IP addresses of the nodes in the Cluster

func (*Controller) ListNodeNames

func (c *Controller) ListNodeNames(task concurrency.Task) []string

ListNodeNames lists the names of the nodes in the Cluster

func (*Controller) ListNodes

func (c *Controller) ListNodes(task concurrency.Task) []*clusterpropsv1.Node

ListNodes lists the nodes in the Cluster

func (*Controller) Restore

func (c *Controller) Restore(task concurrency.Task, f Foreman) (err error)

Restore restores full ability of a Cluster controller by binding with appropriate Foreman

func (*Controller) SearchNode

func (c *Controller) SearchNode(task concurrency.Task, hostID string) bool

SearchNode tells if an host ID corresponds to a node of the Cluster

func (*Controller) Serialize

func (c *Controller) Serialize() ([]byte, error)

Serialize converts cluster data to JSON

func (*Controller) Start

func (c *Controller) Start(task concurrency.Task) (err error)

Start starts the Cluster

func (*Controller) Stop

func (c *Controller) Stop(task concurrency.Task) (err error)

Stop stops the Cluster is its current state is compatible

func (*Controller) UpdateMetadata

func (c *Controller) UpdateMetadata(task concurrency.Task, updatefn func() error) (err error)

UpdateMetadata writes Cluster config in Object Storage

type Foreman

type Foreman interface {
	Cluster() api.Cluster
	ExecuteScript(*rice.Box, map[string]interface{}, string, map[string]interface{}, string) (int, string, string, error)
}

Foreman interface, exposes public method

func NewForeman

func NewForeman(c *Controller, makers Makers) Foreman

NewForeman creates a new *foreman to build a cluster

type Makers

type Makers struct {
	MinimumRequiredServers      func(task concurrency.Task, b Foreman) (int, int, int)   // returns masterCount, pruvateNodeCount, publicNodeCount
	DefaultGatewaySizing        func(task concurrency.Task, b Foreman) pb.HostDefinition // sizing of Gateway(s)
	DefaultMasterSizing         func(task concurrency.Task, b Foreman) pb.HostDefinition // default sizing of master(s)
	DefaultNodeSizing           func(task concurrency.Task, b Foreman) pb.HostDefinition // default sizing of node(s)
	DefaultImage                func(task concurrency.Task, b Foreman) string            // default image of server(s)
	GetNodeInstallationScript   func(task concurrency.Task, b Foreman, nodeType NodeType.Enum) (string, map[string]interface{})
	GetGlobalSystemRequirements func(task concurrency.Task, b Foreman) (string, error)
	GetTemplateBox              func() (*rice.Box, error)
	ConfigureGateway            func(task concurrency.Task, b Foreman) error
	CreateMaster                func(task concurrency.Task, b Foreman, index int) error
	ConfigureMaster             func(task concurrency.Task, b Foreman, index int, pbHost *pb.Host) error
	UnconfigureMaster           func(task concurrency.Task, b Foreman, pbHost *pb.Host) error
	CreateNode                  func(task concurrency.Task, b Foreman, index int, pbHost *pb.Host) error
	ConfigureNode               func(task concurrency.Task, b Foreman, index int, pbHost *pb.Host) error
	UnconfigureNode             func(task concurrency.Task, b Foreman, pbHost *pb.Host, selectedMasterID string) error
	ConfigureCluster            func(task concurrency.Task, b Foreman) error
	UnconfigureCluster          func(task concurrency.Task, b Foreman) error
	JoinMasterToCluster         func(task concurrency.Task, b Foreman, pbHost *pb.Host) error
	JoinNodeToCluster           func(task concurrency.Task, b Foreman, pbHost *pb.Host) error
	LeaveMasterFromCluster      func(task concurrency.Task, b Foreman, pbHost *pb.Host) error
	LeaveNodeFromCluster        func(task concurrency.Task, b Foreman, pbHost *pb.Host, selectedMaster string) error
	GetState                    func(task concurrency.Task, b Foreman) (ClusterState.Enum, error)
}

Makers ...

type Metadata

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

Metadata is the cluster definition stored in ObjectStorage

func NewMetadata

func NewMetadata(svc iaas.Service) (*Metadata, error)

NewMetadata creates a new Cluster Controller metadata

func (*Metadata) Acquire

func (m *Metadata) Acquire()

Acquire waits until the write lock is available, then locks the metadata

func (*Metadata) Browse

func (m *Metadata) Browse(callback func(*Controller) error) error

Browse walks through cluster folder and executes a callback for each entry

func (*Metadata) Carry

func (m *Metadata) Carry(task concurrency.Task, cluster *Controller) *Metadata

Carry links metadata with cluster struct

func (*Metadata) Delete

func (m *Metadata) Delete() error

Delete removes a cluster metadata

func (*Metadata) Get

func (m *Metadata) Get() (_ *Controller, err error)

Get returns the content of the metadata

func (*Metadata) GetService

func (m *Metadata) GetService() iaas.Service

GetService returns the service used by metadata

func (*Metadata) OK

func (m *Metadata) OK() bool

OK ...

func (*Metadata) Read

func (m *Metadata) Read(task concurrency.Task, name string) error

Read reads metadata of cluster named 'name' from Object Storage

func (*Metadata) Release

func (m *Metadata) Release()

Release unlocks the metadata

func (*Metadata) Reload

func (m *Metadata) Reload(task concurrency.Task) error

Reload reloads the metadata from ObjectStorage It's a good idea to do that just after an Acquire() to be sure to have the latest data

func (*Metadata) Write

func (m *Metadata) Write() error

Write saves the content of m to the Object Storage

func (*Metadata) Written

func (m *Metadata) Written() bool

Written tells if the metadata has already been written to ObjectStorage

type Request

type Request struct {
	// Name is the name of the cluster wanted
	Name string
	// CIDR defines the network to create
	CIDR string
	// Complexity is the implementation wanted, can be Small, Normal or Large
	Complexity Complexity.Enum
	// Flavor tells what kind of cluster to create
	Flavor Flavor.Enum
	// NetworkID is the ID of the network to use
	NetworkID string
	// Tenant contains the name of the tenant
	Tenant string
	// KeepOnFailure is set to True to keep resources on cluster creation failure
	KeepOnFailure bool
	// GatewaysDef count
	GatewaysDef *pb.HostDefinition
	// NodesDef count
	MastersDef *pb.HostDefinition
	// NodesDef count
	NodesDef *pb.HostDefinition
	// DisabledDefaultFeatures contains the list of features that should be installed by default but we don't want actually
	DisabledDefaultFeatures map[string]struct{}
}

Request defines what kind of Cluster is wanted

Directories

Path Synopsis
properties
v1
v2

Jump to

Keyboard shortcuts

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