common

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package common is for common operations with CSI resources such as AvailableCapacity or Volume

Package common is for common operations with CSI resources such as AvailableCapacity or Volume

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACOperationsImpl

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

ACOperationsImpl is the basic implementation of AvailableCapacityOperations interface

func NewACOperationsImpl

func NewACOperationsImpl(k8sClient *k8s.KubeClient, l *logrus.Logger) *ACOperationsImpl

NewACOperationsImpl is the constructor for ACOperationsImpl struct Receives an instance of base.KubeClient and logrus logger Returns an instance of ACOperationsImpl

func (*ACOperationsImpl) RecreateACToLVGSC

func (a *ACOperationsImpl) RecreateACToLVGSC(ctx context.Context, newSC, storageGroup string,
	acs ...accrd.AvailableCapacity) *accrd.AvailableCapacity

RecreateACToLVGSC creates new LVG using locations from provided ACs. Concerts first AC to LVG SC and set size of remaining to 0 Receives newSC as string (e.g. HDDLVG) and AvailableCapacities where LVG should be based Returns created AC or nil

type AvailableCapacityOperations

type AvailableCapacityOperations interface {
	RecreateACToLVGSC(ctx context.Context, sc, sg string, acs ...accrd.AvailableCapacity) *accrd.AvailableCapacity
}

AvailableCapacityOperations is the interface for interact with AvailableCapacity CRs from Controller

type VolumeOperations

type VolumeOperations interface {
	CreateVolume(ctx context.Context, v api.Volume) (*api.Volume, error)
	DeleteVolume(ctx context.Context, volumeID string) error
	UpdateCRsAfterVolumeDeletion(ctx context.Context, volumeID string) error
	WaitStatus(ctx context.Context, volumeID string, statuses ...string) error
	ExpandVolume(ctx context.Context, volume *volumecrd.Volume, requiredBytes int64) error
	UpdateCRsAfterVolumeExpansion(ctx context.Context, volID string, requiredBytes int64)
}

VolumeOperations is the interface that unites common Volume CRs operations

type VolumeOperationsImpl

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

VolumeOperationsImpl is the basic implementation of VolumeOperations interface

func NewVolumeOperationsImpl

func NewVolumeOperationsImpl(k8sClient *k8s.KubeClient, logger *logrus.Logger, cache cache.Interface,
	featureConf fc.FeatureChecker) *VolumeOperationsImpl

NewVolumeOperationsImpl is the constructor for VolumeOperationsImpl struct Receives an instance of base.KubeClient and logrus logger Returns an instance of VolumeOperationsImpl

func (*VolumeOperationsImpl) CreateVolume

func (vo *VolumeOperationsImpl) CreateVolume(ctx context.Context, v api.Volume) (*api.Volume, error)

CreateVolume searches AC and creates volume CR or returns existed volume CR Receives golang context and api.Volume which is Spec of Volume CR to create Returns api.Volume instance that took the place of chosen by SearchAC method AvailableCapacity CR

func (*VolumeOperationsImpl) DeleteVolume

func (vo *VolumeOperationsImpl) DeleteVolume(ctx context.Context, volumeID string) error

DeleteVolume changes volume CR state and updates it, if volume CR doesn't exists return Not found error and that error should be handled by caller. Receives golang context and a volume ID to delete Returns error if something went wrong or Volume with volumeID wasn't found

func (*VolumeOperationsImpl) DoAction added in v1.3.0

func (vo *VolumeOperationsImpl) DoAction(ctx context.Context, log *logrus.Entry, obj k8sCl.Object, action uint8,
	typeCR string) error

DoAction do UpdateCR or DeleteCR with CR return error if k8sClient action done with err

func (*VolumeOperationsImpl) ExpandVolume

func (vo *VolumeOperationsImpl) ExpandVolume(ctx context.Context, volume *volumecrd.Volume, requiredBytes int64) error

ExpandVolume updates Volume status to Resizing to trigger expansion in reconcile, if volume has already had status Resizing or Resized, function doesn't do anything. In case of statuses beside VolumeReady, Created, Published function return error Receive golang context, volume CR, requiredBytes as int Return volume spec, error

func (*VolumeOperationsImpl) UpdateCRsAfterVolumeDeletion

func (vo *VolumeOperationsImpl) UpdateCRsAfterVolumeDeletion(ctx context.Context, volumeID string) error

UpdateCRsAfterVolumeDeletion should be considered as a second step in DeleteVolume, remove Volume CR and if volume was in LogicalVolumeGroup SC - update corresponding AC CR does not return anything because that method does not change real drive on the node

func (*VolumeOperationsImpl) UpdateCRsAfterVolumeExpansion

func (vo *VolumeOperationsImpl) UpdateCRsAfterVolumeExpansion(ctx context.Context, volID string, requiredBytes int64)

UpdateCRsAfterVolumeExpansion update volume and AC crs after volume expansion Receive golang context, volume spec Return error

func (*VolumeOperationsImpl) WaitStatus

func (vo *VolumeOperationsImpl) WaitStatus(ctx context.Context, volumeID string, statuses ...string) error

WaitStatus check volume status until it will be reached one of the statuses return error if context is done or volume reaches failed status, return nil if reached status != failed

Jump to

Keyboard shortcuts

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