v1alpha1

package
v1.11.0-RC2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 13 Imported by: 7

Documentation

Index

Constants

View Source
const (
	//CStorNodeBase nodeBase for cstor volume
	CStorNodeBase string = "iqn.2016-09.com.openebs.cstor"
	// TargetPort is port for cstor volume
	TargetPort string = "3260"
)
View Source
const (
	//IoWaitTime is the time interval for which the IO has to be stopped before doing snapshot operation
	IoWaitTime = 10
	//TotalWaitTime is the max time duration to wait for doing snapshot operation on all the replicas
	TotalWaitTime = 60
)

Variables

View Source
var (
	// ConfFileMutex is to hold the lock while updating istgt.conf file
	ConfFileMutex = &sync.Mutex{}
	// IstgtConfPath will locate path for istgt configurations
	IstgtConfPath = "/usr/local/etc/istgt/istgt.conf"
	//DesiredReplicationFactorKey is plain text in istgt configuration file informs
	//about desired replication factor used by target
	DesiredReplicationFactorKey = "  DesiredReplicationFactor"
	//TargetNamespace is namespace where target pod and cstorvolume is present
	//and this is updated by addEventHandler function
	TargetNamespace = ""
)

Functions

func GetResizeCondition

func GetResizeCondition() apis.CStorVolumeCondition

GetResizeCondition will return resize condtion related to cstorvolume condtions

func IsScaleDownInProgress

func IsScaleDownInProgress(cvObj *apis.CStorVolume) bool

IsScaleDownInProgress return true if length of status replica details is greater than length of spec replica details

Types

type Builder

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

Builder is the builder object for CStorVolume

func BuilderFromAPI

func BuilderFromAPI(cStorVolume *apis.CStorVolume) *Builder

BuilderFromAPI returns builder instance from core API

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns new instance of Builder

func (*Builder) Build

func (b *Builder) Build() (*apis.CStorVolume, error)

Build returns the CStorVolume API instance

func (*Builder) WithAnnotations

func (b *Builder) WithAnnotations(annotations map[string]string) *Builder

WithAnnotations merges existing annotations if any with the ones that are provided here

func (*Builder) WithAnnotationsNew

func (b *Builder) WithAnnotationsNew(annotations map[string]string) *Builder

WithAnnotationsNew resets existing annotations if any with ones that are provided here

func (*Builder) WithCStorIQN

func (b *Builder) WithCStorIQN(name string) *Builder

WithCStorIQN sets the iqn field of CStorVolume with provided arguments

func (*Builder) WithCapacity

func (b *Builder) WithCapacity(capacity string) *Builder

WithCapacity sets the Capacity field of CStorVolume with provided arguments

func (*Builder) WithConsistencyFactor

func (b *Builder) WithConsistencyFactor(consistencyfactor int) *Builder

WithConsistencyFactor sets the ConsistencyFactor field of CStorVolume with provided arguments

func (*Builder) WithDependentsUpgraded

func (b *Builder) WithDependentsUpgraded() *Builder

WithDependentsUpgraded sets the field to true for new volume

func (*Builder) WithDesiredReplicationFactor

func (b *Builder) WithDesiredReplicationFactor(desiredRF int) *Builder

WithDesiredReplicationFactor sets the DesiredReplicationFactor field of CStorVolume with provided arguments

func (*Builder) WithGenerateName

func (b *Builder) WithGenerateName(name string) *Builder

WithGenerateName sets the GenerateName field of CStorVolume with provided value

func (*Builder) WithIQN

func (b *Builder) WithIQN(iqn string) *Builder

WithIQN sets the IQN field of CStorVolume with provided arguments

func (*Builder) WithLabels

func (b *Builder) WithLabels(labels map[string]string) *Builder

WithLabels merges existing labels if any with the ones that are provided here

func (*Builder) WithLabelsNew

func (b *Builder) WithLabelsNew(labels map[string]string) *Builder

WithLabelsNew resets existing labels if any with ones that are provided here

func (*Builder) WithName

func (b *Builder) WithName(name string) *Builder

WithName sets the Name field of CStorVolume with provided value.

func (*Builder) WithNamespace

func (b *Builder) WithNamespace(namespace string) *Builder

WithNamespace sets the Namespace field of CStorVolume provided arguments

func (*Builder) WithNewVersion

func (b *Builder) WithNewVersion(version string) *Builder

WithNewVersion sets the current and desired version field of CStorVolume with provided arguments

func (*Builder) WithNodeBase

func (b *Builder) WithNodeBase(nodebase string) *Builder

WithNodeBase sets the NodeBase field of CStorVolume with provided arguments

func (*Builder) WithOwnerRefernceNew

func (b *Builder) WithOwnerRefernceNew(ownerRefernce []metav1.OwnerReference) *Builder

WithOwnerRefernceNew sets ownerrefernce if any with ones that are provided here

func (*Builder) WithReplicationFactor

func (b *Builder) WithReplicationFactor(replicationfactor int) *Builder

WithReplicationFactor sets the ReplicationFactor field of CStorVolume with provided arguments

func (*Builder) WithTargetIP

func (b *Builder) WithTargetIP(targetip string) *Builder

WithTargetIP sets the target IP address field of CStorVolume with provided arguments

func (*Builder) WithTargetPort

func (b *Builder) WithTargetPort(targetport string) *Builder

WithTargetPort sets the TargetPort field of CStorVolume with provided arguments

func (*Builder) WithTargetPortal

func (b *Builder) WithTargetPortal(targetportal string) *Builder

WithTargetPortal sets the TargetPortal field of CStorVolume with provided arguments

type CStorVolume

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

CStorVolume a wrapper for CStorVolume object

func NewForAPIObject

func NewForAPIObject(obj *apis.CStorVolume) *CStorVolume

NewForAPIObject returns a new instance of cstorvolume

func (*CStorVolume) AreSpecReplicasHealthy

func (c *CStorVolume) AreSpecReplicasHealthy(volStatus *apis.CVStatus) bool

AreSpecReplicasHealthy return true if all the spec replicas are in Healthy state else return false

func (*CStorVolume) BuildScaleDownConfigData

func (c *CStorVolume) BuildScaleDownConfigData(repID string) map[string]string

BuildScaleDownConfigData build data based on replica that needs to remove

func (*CStorVolume) GetCVCondition

func (c *CStorVolume) GetCVCondition(
	condType apis.CStorVolumeConditionType) apis.CStorVolumeCondition

GetCVCondition returns corresponding cstorvolume condition based argument passed

func (*CStorVolume) GetRemovingReplicaID

func (c *CStorVolume) GetRemovingReplicaID() string

GetRemovingReplicaID return replicaID that present in status but not in spec

func (*CStorVolume) IsConditionPresent

func (c *CStorVolume) IsConditionPresent(condType apis.CStorVolumeConditionType) bool

IsConditionPresent returns true if condition is available

func (*CStorVolume) IsDRFPending

func (c *CStorVolume) IsDRFPending() bool

IsDRFPending return true if drf update is required else false Steps to verify whether drf is required 1. Read DesiredReplicationFactor configurations from istgt conf file 2. Compare the value with spec.DesiredReplicationFactor and return result

func (*CStorVolume) IsHealthy

func (c *CStorVolume) IsHealthy() bool

IsHealthy returns true if the CVR is in healthy state

func (*CStorVolume) IsResizePending

func (c *CStorVolume) IsResizePending() bool

IsResizePending return true if resize is in progress

type CStorVolumeConfig

type CStorVolumeConfig struct {
	*CVReplicationDetails
	*Kubeclient
}

CStorVolumeConfig embed CVReplicationDetails and Kubeclient of corresponding namespace

type CStorVolumeList

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

CStorVolumeList is a list of cstorvolume objects

func (*CStorVolumeList) Len

func (l *CStorVolumeList) Len() int

Len returns the number of items present in the CStorVolumeList

type CVReplicationDetails

type CVReplicationDetails struct {
	VolumeName        string `json:"volumeName"`
	ReplicationFactor int    `json:"replicationFactor"`
	ConsistencyFactor int    `json:"consistencyFactor"`
	ReplicaID         string `json:"replicaId"`
	ReplicaGUID       string `json:"replicaZvolGuid"`
}

CVReplicationDetails enables to update RF,CF and known replicas into etcd

func (*CVReplicationDetails) BuildConfigData

func (csr *CVReplicationDetails) BuildConfigData() map[string]string

BuildConfigData builds data based on the CVReplicationDetails

func (*CVReplicationDetails) UpdateCVWithReplicationDetails

func (csr *CVReplicationDetails) UpdateCVWithReplicationDetails(kubeclient *Kubeclient) error

UpdateCVWithReplicationDetails updates the cstorvolume with known replicas and updated replication details

func (*CVReplicationDetails) UpdateConfig

func (csr *CVReplicationDetails) UpdateConfig() error

UpdateConfig updates target configuration file by building data

func (*CVReplicationDetails) Validate

func (csr *CVReplicationDetails) Validate() error

Validate verifies whether CStorReplication data read on wire is valid or not

type Conditions

type Conditions []apis.CStorVolumeCondition

Conditions enables building CRUD operations on cstorvolume conditions

func (Conditions) AddCondition

AddCondition appends the new condition to existing conditions

func (Conditions) DeleteCondition

func (c Conditions) DeleteCondition(cond apis.CStorVolumeCondition) []apis.CStorVolumeCondition

DeleteCondition deletes the condition from conditions

func (Conditions) UpdateCondition

func (c Conditions) UpdateCondition(cond apis.CStorVolumeCondition) []apis.CStorVolumeCondition

UpdateCondition updates the condition if it is present in Conditions

type Kubeclient

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

Kubeclient enables kubernetes API operations on cstor volume replica instance

func NewKubeclient

func NewKubeclient(opts ...KubeclientBuildOption) *Kubeclient

NewKubeclient returns a new instance of kubeclient meant for cstor volume replica operations

func (*Kubeclient) Create

func (k *Kubeclient) Create(vol *apis.CStorVolume) (*apis.CStorVolume, error)

Create creates the cstorvolume resource

func (*Kubeclient) Delete

func (k *Kubeclient) Delete(name string) error

Delete deletes the cstorvolume resource

func (*Kubeclient) Get

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

Get returns deployment object for given name

func (*Kubeclient) GetRaw

func (k *Kubeclient) GetRaw(
	name string,
	opts metav1.GetOptions,
) ([]byte, error)

GetRaw returns a raw CStor volume instance

func (*Kubeclient) List

func (k *Kubeclient) List(
	opts metav1.ListOptions,
) (*apis.CStorVolumeList, error)

List returns a list of cstor volume replica instances present in kubernetes cluster

func (*Kubeclient) Patch

func (k *Kubeclient) Patch(
	name, namespace string,
	pt types.PatchType,
	data []byte,
) (*apis.CStorVolume, error)

Patch patches the cstorvolume resource

func (*Kubeclient) Update

func (k *Kubeclient) Update(vol *apis.CStorVolume) (*apis.CStorVolume, error)

Update updates the cstorvolume resource

func (*Kubeclient) WithNamespace

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

WithNamespace sets the kubernetes client against the provided namespace

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 client against the kubeclient instance

func WithKubeConfigPath

func WithKubeConfigPath(path string) KubeclientBuildOption

WithKubeConfigPath sets the kubernetes client against the provided path

func WithNamespace

func WithNamespace(namespace string) KubeclientBuildOption

WithNamespace sets the kubernetes client against the provided namespace

type ListBuilder

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

ListBuilder enables building an instance of CstorVolumeList

func NewListBuilder

func NewListBuilder() *ListBuilder

NewListBuilder returns a new instance of listBuilder

func (*ListBuilder) List

func (b *ListBuilder) List() *CStorVolumeList

List returns the list of cstorvolume (cv) instances that was built by this builder

func (*ListBuilder) WithAPIList

func (b *ListBuilder) WithAPIList(list *apis.CStorVolumeList) *ListBuilder

WithAPIList builds the list of cstorvolume instances based on the provided cstorvolume api instances

func (*ListBuilder) WithFilter

func (b *ListBuilder) WithFilter(pred ...Predicate) *ListBuilder

WithFilter adds filters on which the cstorvolume has to be filtered

type Predicate

type Predicate func(*CStorVolume) bool

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

func IsHealthy

func IsHealthy() Predicate

IsHealthy is a predicate to filter out cstorvolumes which is healthy

type PredicateList

type PredicateList []Predicate

PredicateList holds a list of cstor volume based predicates

Jump to

Keyboard shortcuts

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