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: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// PoolCapacityThresholdPercentage is the threshold percentage for usable pool size.
	// Example:
	// If pool size is 100 Gi and threshold percentae is 70 then
	// 70 Gi is the usable pool capacity.
	PoolCapacityThresholdPercentage = 70
)

Variables

This section is empty.

Functions

func HasAnnotation

func HasAnnotation(key, value string) predicate

HasAnnotation returns true if provided annotation key and value are present in the provided CSP instance

func IsNotUID

func IsNotUID(uids ...string) predicate

IsNotUID returns true if provided CSP instance's UID does not match with any of the provided UIDs

func ListBuilder

func ListBuilder() *listBuilder

ListBuilder returns a new instance of listBuilder Object

func TemplateFunctions

func TemplateFunctions() template.FuncMap

TemplateFunctions exposes a few functions as go template functions

Types

type CSP

type CSP struct {
	// actual cstor pool Object
	Object *apis.CStorPool
}

CSP encapsulates the CStorPool API object.

func (*CSP) GetCapacityThreshold

func (c *CSP) GetCapacityThreshold() int

GetCapacityThreshold returns the capacity threshold. Example : If pool size is 100 Gi and capacity threshold is 70 % then the effective size of pool is 70 Gi for accommodating volumes.

func (*CSP) GetTotalUsableCapacityWithThreshold

func (c *CSP) GetTotalUsableCapacityWithThreshold() (resource.Quantity, error)

GetTotalUsableCapacityWithThreshold returns the usable capacity on pool. Example: If TotalUsableCapacityWithThreshold is 70 Gi than it is possible that some amount of space is already being used by some other existing volumes.

func (*CSP) HasSpace

func (c *CSP) HasSpace(incomingVolCap, capacityUsedByExistingVols resource.Quantity) bool

HasSpace returns true if the CSP has free space to accomodate the incoming volume.

func (*CSP) UsableFreeCapacityOnCSP

func (c *CSP) UsableFreeCapacityOnCSP(capacityUsedByExistingVols resource.Quantity) (resource.Quantity, error)

UsableFreeCapacityOnCSP returns the total usable free capacity present on the CSP. Example: If UsableFreeCapacityOnCSP is 30 Gi than the pool (CSP) can accomodate any volume of size less than(or equal to) 30 Gi

type CSPList

type CSPList struct {
	// list of cstor pools
	Items []*CSP
}

CSPList holds the list of cstorpools

func (*CSPList) Filter

func (l *CSPList) Filter(p ...predicate) *CSPList

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

func (*CSPList) GetPoolUIDs

func (l *CSPList) GetPoolUIDs() []string

GetPoolUIDs retuns the UIDs of the pools available in the list

type Kubeclient

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

Kubeclient enables kubernetes API operations on CStorPool instance

func NewKubeClient

func NewKubeClient(opts ...KubeclientBuildOption) *Kubeclient

NewKubeClient returns a new instance of kubeclient meant for CStorPool related operations

func (*Kubeclient) Create

func (k *Kubeclient) Create(obj *apis.CStorPool) (*apis.CStorPool, error)

Create creates an CStorPool instance in kubernetes cluster

func (*Kubeclient) Delete

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

Delete deletes CStorPool instance

func (*Kubeclient) Get

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

Get returns an CStorPool instance from kubernetes cluster

func (*Kubeclient) List

List returns a list of CStorPool instances present in kubernetes cluster

func (*Kubeclient) Patch

func (k *Kubeclient) Patch(name string, pt types.PatchType,
	patchObj []byte) (*apis.CStorPool, error)

Patch returns the patched CStorPool instance

type KubeclientBuildOption

type KubeclientBuildOption func(*Kubeclient)

KubeclientBuildOption defines the abstraction to build a Kubeclient instance

func WithClientset

func WithClientset(c *clientset.Clientset) KubeclientBuildOption

WithClientset sets the kubernetes clientset against the kubeclient instance

Jump to

Keyboard shortcuts

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