v1alpha2

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

DefaultBlockDeviceCount is a map containing the default block device count of various raid types.

Functions

func IsValidPoolTopology

func IsValidPoolTopology(poolType string, bdCount int) bool

IsValidPoolTopology returns true if the block device count is multiples of default block device count of various raid types

Types

type BlockDevice

type BlockDevice struct {
	// actual block device object
	Object *ndm.BlockDevice
}

BlockDevice encapsulates BlockDevice api object.

func (*BlockDevice) CheckIfBDBelongsToNode

func (bd *BlockDevice) CheckIfBDBelongsToNode(nodeName string) error

CheckIfBDBelongsToNode returns error only when the block device node name doesn't matched with provided node name

func (*BlockDevice) CheckIfBDIsActive

func (bd *BlockDevice) CheckIfBDIsActive() error

CheckIfBDIsActive returns error only when block device presents in other than active state or else return nil

func (*BlockDevice) CheckIfBDIsNonFsType

func (bd *BlockDevice) CheckIfBDIsNonFsType() error

CheckIfBDIsNonFsType return error only when the block device has filesystem

func (*BlockDevice) GetDeviceID

func (bd *BlockDevice) GetDeviceID() string

GetDeviceID returns the device link of the block device. If device link is not found it returns device path. For a cstor pool creation -- this link or path is used. For convenience, we call it as device ID. Hence, device ID can either be a device link or device path depending on what was available in block device cr.

func (bd *BlockDevice) GetLink() string

GetLink returns the link of the block device if present else return empty string

func (*BlockDevice) GetNodeName

func (bd *BlockDevice) GetNodeName() string

GetNodeName returns the node name to which the block device is attached

func (*BlockDevice) GetPath

func (bd *BlockDevice) GetPath() string

GetPath returns path of the block device

func (*BlockDevice) HasAnnotation

func (bd *BlockDevice) HasAnnotation(key, value string) bool

HasAnnotation return true if provided annotation key and value are present in the the provided block device List instance

func (*BlockDevice) HasFileSystem

func (bd *BlockDevice) HasFileSystem() bool

HasFileSystem returns true if the block device has filesystem

func (*BlockDevice) IsActive

func (bd *BlockDevice) IsActive() bool

IsActive returns true if the block device is active.

func (*BlockDevice) IsBelongToNode

func (bd *BlockDevice) IsBelongToNode(nodeName string) bool

IsBelongToNode returns true if the block device belongs to the provided node.

func (*BlockDevice) IsClaimed

func (bd *BlockDevice) IsClaimed() bool

IsClaimed returns true if the block device is claimed

func (*BlockDevice) IsSparse

func (bd *BlockDevice) IsSparse() bool

IsSparse returns true if the block device is of sparse type

func (*BlockDevice) IsUnclaimed

func (bd *BlockDevice) IsUnclaimed() bool

IsUnclaimed returns true if the block device is unclaimed

func (*BlockDevice) IsUsable

func (bd *BlockDevice) IsUsable(usedBD map[string]int) bool

IsUsable returns true if this block device can be used for pool provisioning. The argument usedBlockDevice is a map containing key as block device cr name and value as integer. If the value of map is greater than 0 , then this corresponding block device is not usable.

func (*BlockDevice) IsUsableNode

func (bd *BlockDevice) IsUsableNode(usedNodes map[string]bool) bool

IsUsableNode returns true if block device of this node can be used for pool provisioning. The argument usedNodes is a map containing key as node name and value as bool. If the value of map is greater than false, then this corresponding node is not usable.

func (*BlockDevice) ValidateBlockDevice

func (bd *BlockDevice) ValidateBlockDevice(v ...Validate) error

ValidateBlockDevice validates the block device based on the arguments provided and returns error if validation fails

type BlockDeviceList

type BlockDeviceList struct {
	// list of blockdevices
	ObjectList *ndm.BlockDeviceList
}

BlockDeviceList holds the list of BlockDevice api

func (*BlockDeviceList) Filter

func (l *BlockDeviceList) Filter(p ...Predicate) *BlockDeviceList

Filter will filter the block device instances if all the predicates succeed against that block device.

func (*BlockDeviceList) Len

func (l *BlockDeviceList) Len() int

Len returns the length og BlockDeviceList.

type Builder

type Builder struct {
	BlockDevice *BlockDevice
}

Builder is the builder object for BlockDevice

func BuilderForAPIObject

func BuilderForAPIObject(bd *ndm.BlockDevice) *Builder

BuilderForAPIObject returns an instance of the Builder object based on block device api object.

func BuilderForObject

func BuilderForObject(BlockDevice *BlockDevice) *Builder

BuilderForObject returns an instance of the Builder object based on block device object

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns an empty instance of the Builder object.

func (*Builder) Build

func (b *Builder) Build() *BlockDevice

Build returns the block device object built by this builder.

type Kubeclient

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

Kubeclient enables kubernetes API operations on block device instance

func NewKubeClient

func NewKubeClient(opts ...KubeclientBuildOption) *Kubeclient

NewKubeClient returns a new instance of kubeclient meant for block device operations

func (*Kubeclient) Delete

func (k *Kubeclient) Delete(name string, opts *metav1.DeleteOptions) error

Delete deletes a disk object

func (*Kubeclient) Get

func (k *Kubeclient) Get(name string, opts metav1.GetOptions) (*apis.BlockDevice, error)

Get returns a disk object

func (*Kubeclient) List

List returns a list of disk instances present in kubernetes cluster

func (*Kubeclient) Update

func (k *Kubeclient) Update(bd *apis.BlockDevice) (*apis.BlockDevice, error)

Update updates the block device claim if present in kubernetes cluster

func (*Kubeclient) WithDefaults

func (k *Kubeclient) WithDefaults()

WithDefaults sets the default options of kubeclient instance

func (*Kubeclient) WithNamespace

func (k *Kubeclient) WithNamespace(namespace string) *Kubeclient

WithNamespace sets the kubernetes namespace against the provided namespace

type KubeclientBuildOption

type KubeclientBuildOption func(*Kubeclient)

KubeclientBuildOption defines the abstraction to build a kubeclient instance

func WithKubeClient

func WithKubeClient(c *clientset.Clientset) KubeclientBuildOption

WithKubeClient sets the kubernetes client against the kubeclient instance

func WithKubeConfigPath

func WithKubeConfigPath(kubeConfigPath string) KubeclientBuildOption

WithKubeConfigPath sets the kubeConfig path against client instance

type ListBuilder

type ListBuilder struct {
	BDL *BlockDeviceList
}

ListBuilder is the builder object for BlockDeviceList

func ListBuilderFromAPIList

func ListBuilderFromAPIList(bdAPIList *ndm.BlockDeviceList) *ListBuilder

ListBuilderFromAPIList returns a new instance of ListBuilderForApiList object based on block device api list.

func ListBuilderFromList

func ListBuilderFromList(bdl *BlockDeviceList) *ListBuilder

ListBuilderFromList builds the list based on the provided *BlockDeviceList instances.

func NewListBuilder

func NewListBuilder() *ListBuilder

NewListBuilder returns a new instance of ListBuilder object.

func (*ListBuilder) List

func (b *ListBuilder) List() *BlockDeviceList

List returns the list of block device instances that were built by this builder.

type Predicate

type Predicate func(*BlockDevice) bool

Predicate defines an abstraction to determine conditional checks against the provided block device instance

func HasAnnotation

func HasAnnotation(key, value string) Predicate

HasAnnotation is predicate to filter out based on annotation in BDC instances

func IsActive

func IsActive() Predicate

IsActive filters the block device based on the active status

func IsBelongToNode

func IsBelongToNode(nodeName string) Predicate

IsBelongToNode returns true if the block device belongs to the provided node.

func IsClaimed

func IsClaimed() Predicate

IsClaimed filters the block deive based on claimed status

func IsSparse

func IsSparse() Predicate

IsSparse filters the block device based on type of the disk

func IsUnclaimed

func IsUnclaimed() Predicate

IsUnclaimed filters the block device based on unclaimed status

func IsUsable

func IsUsable(usedBlockDevices map[string]int) Predicate

IsUsable filters the block device based on usage of disk

func IsUsableNode

func IsUsableNode(usedNodes map[string]bool) Predicate

IsUsableNode filters the block device based on usage of node

type Validate

type Validate func(*BlockDevice) error

Validate defines an abstraction to determine conditional check against the provided block device

func CheckIfBDBelongsToNode

func CheckIfBDBelongsToNode(nodeName string) Validate

CheckIfBDBelongsToNode validates the block device based on nodeName provided via argument

func CheckIfBDIsActive

func CheckIfBDIsActive() Validate

CheckIfBDIsActive validates the block device based on status

func CheckIfBDIsNonFsType

func CheckIfBDIsNonFsType() Validate

CheckIfBDIsNonFsType validates the block device based on filesystem type

Jump to

Keyboard shortcuts

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