algorithm

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StoragePoolKindCSPC holds the value of CStorPoolCluster
	StoragePoolKindCSPC = "CStorPoolCluster"
	ApiVersion          = "cstor.openebs.io/v1"
)
View Source
const (
	// PoolMgmtContainerName is the name of cstor target container name
	PoolMgmtContainerName = "cstor-pool-mgmt"

	// PoolContainerName is the name of cstor target container name
	PoolContainerName = "cstor-pool"

	// PoolExporterContainerName is the name of cstor target container name
	PoolExporterContainerName = "maya-exporter"
)

Variables

This section is empty.

Functions

func BDCHasLabel

func BDCHasLabel(labelKey, labelValue string, bdc openebsio.BlockDeviceClaim) bool

BDCHasLabel returns true if the provided key,value exists as label on block device claim.

func ByteCount

func ByteCount(b uint64) string

ByteCount converts bytes into corresponding unit

func GetBDListForNode

func GetBDListForNode(pool cstor.PoolSpec) []string

GetBDListForNode returns a list of BD from the pool spec.

func GetCSPCOwnerReference

func GetCSPCOwnerReference(cspc *cstor.CStorPoolCluster) metav1.OwnerReference

func GetCapacity

func GetCapacity(capacity string) (resource.Quantity, error)

func IsBlockDeviceClaimed

func IsBlockDeviceClaimed(bd openebsio.BlockDevice) bool

IsBlockDeviceClaimed returns true if the provided block devie is claimed.

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 ToDo: Add openebs and kube client set

func (*Builder) Build

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

Build returns the Config instance

func (*Builder) WithCSPC

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

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

func (*Builder) WithKubeClient

func (b *Builder) WithKubeClient(kc kubernetes.Interface) *Builder

WithKubeClient sets the kubeclientset field of config object with provided value.

func (*Builder) WithNameSpace

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

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

func (*Builder) WithOpenEBSClient

func (b *Builder) WithOpenEBSClient(oc clientset.Interface) *Builder

WithOpenEBSClient sets the clientset field of config object with provided value.

type Config

type Config struct {
	// CSPC is the CStorPoolCluster object.
	CSPC *cstor.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

	// GetSpec returns the CSPI spec. Useful in unit testing.
	GetSpec func() (*cstor.CStorPoolInstance, error)

	// Select selects a node for CSPI. Useful in unit testing.
	Select func() (*cstor.PoolSpec, string, error)
	// contains filtered or unexported fields
}

Config embeds CSPC object and namespace where openebs is installed.

func (*Config) ClaimBD

func (ac *Config) ClaimBD(bdObj openebsio.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) GetCSPISpec

func (ac *Config) GetCSPISpec() (*cstor.CStorPoolInstance, error)

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

func (*Config) GetNodeFromLabelSelector

func (ac *Config) GetNodeFromLabelSelector(labels map[string]string) (string, error)

GetNodeFromLabelSelector returns the node name selected by provided labels

func (*Config) GetPoolDeploySpec

func (c *Config) GetPoolDeploySpec(cspi *cstor.CStorPoolInstance) *appsv1.Deployment

GetPoolDeploySpec returns the pool deployment spec.

func (*Config) GetStoredCStorVersionClient

func (ac *Config) GetStoredCStorVersionClient() cstorstoredversion.CstorV1Interface

func (*Config) GetStoredOpenEBSVersionClient

func (ac *Config) GetStoredOpenEBSVersionClient() openebsstoredversion.OpenebsV1alpha1Interface

func (*Config) GetUsedNodes

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

GetUsedNode returns a map of node for which pool has already been created.

func (*Config) IsClaimedBDUsable

func (ac *Config) IsClaimedBDUsable(bd openebsio.BlockDevice) (bool, error)

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

func (*Config) SelectNode

func (ac *Config) SelectNode() (*cstor.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