v1alpha2

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// CasTypeCStor is the key for cas type cStor
	CasTypeCStor = "cstor"
)
View Source
const (
	// HostName holds the hostname key for kubernetes node.
	HostName = "kubernetes.io/hostname"
)

Variables

This section is empty.

Functions

func GetNodeFromLabelSelector

func GetNodeFromLabelSelector(labels map[string]string) (string, error)

GetNodeFromLabelSelector returns the node name selected by provided labels TODO : Move it to node package

func ValidatePoolSpec

func ValidatePoolSpec(pool *apis.PoolSpec) bool

ValidatePoolSpec validates the pool spec. TODO: Fix following function -- (Current is mock only )

Types

type Builder

type Builder struct {
	ConfigObj *Config
	// contains filtered or unexported fields
}

Builder embeds the Config object.

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns an empty instance of Builder object

func (*Builder) Build

func (b *Builder) Build() (*Config, error)

Build returns the Config instance

func (*Builder) WithCSPC

func (b *Builder) WithCSPC(cspc *apis.CStorPoolCluster) *Builder

WithCSPC sets the CSPC field of the config object with the provided value.

func (*Builder) WithNameSpace

func (b *Builder) WithNameSpace(ns string) *Builder

WithNameSpace sets the Namespace field of config object with provided value.

type Config

type Config struct {
	// CSPC is the CStorPoolCluster object.
	CSPC *apis.CStorPoolCluster
	// Namespace is the namespace where openebs is installed.
	Namespace string
	// VisitedNodes is a map which contains the node names which has already been
	// processed for pool provisioning
	VisitedNodes map[string]bool
}

Config embeds CSPC object and namespace where openebs is installed.

func (*Config) ClaimBD

func (ac *Config) ClaimBD(bdObj *ndmapis.BlockDevice) error

ClaimBD claims a given BlockDevice

func (*Config) ClaimBDsForNode

func (ac *Config) ClaimBDsForNode(BD []string) error

ClaimBDsForNode claims a given BlockDevice for node If the block device(s) is/are already claimed for any other CSPC it returns error. If the block device(s) is/are already calimed for the same CSPC -- it is left as it is and can be used for pool provisioning. If the block device(s) is/are unclaimed, then those are claimed.

func (*Config) GetBDListForNode

func (ac *Config) GetBDListForNode(pool *apis.PoolSpec) []string

GetBDListForNode returns a list of BD from the pool spec. TODO : Move it to CStorPoolCluster packgage

func (*Config) GetCSPIWithoutDeployment

func (c *Config) GetCSPIWithoutDeployment() ([]apis.CStorPoolInstance, error)

GetCSPIWithoutDeployment gets the CSPIs for whom the pool deployment does not exists.

func (*Config) GetCSPSpec

func (ac *Config) GetCSPSpec() (*apis.CStorPoolInstance, error)

GetCSPSpec returns a CSPI spec that should be created and claims all the block device present in the CSPI spec

func (*Config) GetCurrentPoolCount

func (c *Config) GetCurrentPoolCount() (int, error)

GetCurrentPoolCount give the current pool count for the given CStorPoolCluster.

func (*Config) GetPendingPoolCount

func (c *Config) GetPendingPoolCount() (int, error)

GetPendingPoolCount returns the pending pool count that should be created for the given CStorPoolCluster.

func (*Config) GetUsedNode

func (ac *Config) GetUsedNode() (map[string]bool, error)

GetUsedNode returns a map of node for which pool has already been created. Note : Filter function is not used from node builder package as it needs CSP builder package which cam cause import loops.

func (*Config) IsClaimedBDUsable

func (ac *Config) IsClaimedBDUsable(bdAPIObj *ndmapis.BlockDevice) (bool, error)

IsClaimedBDUsable returns true if the passed BD is already claimed and can be used for provisioning

func (*Config) IsPoolPending

func (c *Config) IsPoolPending() bool

IsPoolPending returns true if pool is pending for creation.

func (*Config) SelectNode

func (ac *Config) SelectNode() (*apis.PoolSpec, string, error)

SelectNode returns a node where pool should be created.

Jump to

Keyboard shortcuts

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