provisioners

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package provisioners contains code for Volume CR reconcile handling during which volumes on node are created or removed It operates by underlying structures such as a drives/partitions/file system and encapsulates all low-level work with these objects.

Index

Constants

View Source
const (
	// DefaultPartitionLabel default label for each partition
	DefaultPartitionLabel = "CSI"
	// DefaultPartitionNumber partition number
	DefaultPartitionNumber = "1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DriveProvisioner

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

DriveProvisioner is a implementation of Provisioner interface works with drives and partitions on them

func NewDriveProvisioner

func NewDriveProvisioner(
	e command.CmdExecutor,
	k *k8s.KubeClient,
	log *logrus.Logger) *DriveProvisioner

NewDriveProvisioner is a constructor for DriveProvisioner instance

func (*DriveProvisioner) GetVolumePath

func (d *DriveProvisioner) GetVolumePath(vol *api.Volume) (string, error)

GetVolumePath constructs full partition path - /dev/DEVICE_NAME+PARTITION_NAME

func (*DriveProvisioner) PrepareVolume

func (d *DriveProvisioner) PrepareVolume(vol *api.Volume) error

PrepareVolume create partition and FS based on vol attributes. After that partition is ready for mount operations

func (*DriveProvisioner) ReleaseVolume

func (d *DriveProvisioner) ReleaseVolume(vol *api.Volume, drive *api.Drive) error

ReleaseVolume remove FS and partition based on vol attributes. After that partition is completely removed

type LVMProvisioner

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

LVMProvisioner is a implementation of Provisioner interface Work with volumes based on Volume Groups

func NewLVMProvisioner

func NewLVMProvisioner(e command.CmdExecutor, k *k8s.KubeClient, log *logrus.Logger) *LVMProvisioner

NewLVMProvisioner is a constructor for LVMProvisioner

func (*LVMProvisioner) GetVolumePath

func (l *LVMProvisioner) GetVolumePath(vol *api.Volume) (string, error)

GetVolumePath search Volume Group name by vol attributes and construct full path to the volume using template: /dev/VG_NAME/LV_NAME

func (*LVMProvisioner) PrepareVolume

func (l *LVMProvisioner) PrepareVolume(vol *api.Volume) error

PrepareVolume search volume group based on vol attributes, creates Logical Volume and create file system on it. After that Logical Volume is ready for mount operations

func (*LVMProvisioner) ReleaseVolume

func (l *LVMProvisioner) ReleaseVolume(vol *api.Volume, _ *api.Drive) error

ReleaseVolume search volume group based on vol attributes, remove Logical Volume and wipe file system on it. After that Logical Volume that had consumed by vol is completely removed

type Provisioner

type Provisioner interface {
	// PrepareVolume prepares volume for mount
	PrepareVolume(volume *api.Volume) error
	// ReleaseVolume completely releases underlying resources that had consumed by volume
	ReleaseVolume(volume *api.Volume, drive *api.Drive) error
	// GetVolumePath returns full path of device file that represent volume on node
	GetVolumePath(volume *api.Volume) (string, error)
}

Provisioner is a high-level interface that encapsulates all low-level work with volumes on node

type VolumeType

type VolumeType string

VolumeType is used for describing class of volume depending on underlying structures volume could be based on partitions, logical volume and so on

const (
	// DriveBasedVolumeType represents volume that consumes whole drive
	DriveBasedVolumeType VolumeType = "DriveBased"
	// LVMBasedVolumeType represents volume that based on Volume Group
	LVMBasedVolumeType VolumeType = "LVMBased"
)

Directories

Path Synopsis
Package utilwrappers consists of code that manipulates by os utils and use code from linuxutils for that
Package utilwrappers consists of code that manipulates by os utils and use code from linuxutils for that

Jump to

Keyboard shortcuts

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