volumes

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChangeDefaultStorageClass = errors.New("can't change storage class to the default one")
)

Functions

func MustNewSelectorFactory

func MustNewSelectorFactory() *selectorFactory

func NewSelectorFactory

func NewSelectorFactory() (*selectorFactory, error)

func SyncVolumeStatus

func SyncVolumeStatus(pvm PodVolumeModifier, podLister corelisterv1.PodLister, tc *v1alpha1.TidbCluster, mt v1alpha1.MemberType) error

SyncVolumeStatus lists all pods and pvc for the given component and set the volume status of tc.

Types

type ActualVolume

type ActualVolume struct {
	Desired *DesiredVolume
	PVC     *corev1.PersistentVolumeClaim
	Phase   VolumePhase
	// it may be nil if there is no permission to get pvc
	PV *corev1.PersistentVolume
	// it may be nil if there is no permission to get storage class
	StorageClass *storagev1.StorageClass
}

func (*ActualVolume) GetStorageClassName

func (v *ActualVolume) GetStorageClassName() string

get storage class name from current pvc

func (*ActualVolume) GetStorageSize

func (v *ActualVolume) GetStorageSize() resource.Quantity

type DesiredVolume

type DesiredVolume struct {
	Name v1alpha1.StorageVolumeName
	Size resource.Quantity
	// it may be nil if there is no permission to get storage class
	StorageClass *storagev1.StorageClass
	// it is sc name specified by user
	// the sc may not exist
	StorageClassName *string
}

func (*DesiredVolume) GetStorageClassName

func (v *DesiredVolume) GetStorageClassName() string

get storage class name from tc it may return empty because sc is unset or no permission to verify the existence of sc

func (*DesiredVolume) GetStorageSize

func (v *DesiredVolume) GetStorageSize() resource.Quantity

type FakePodVolumeModifier

type FakePodVolumeModifier struct {
	ModifyFunc            func(actual []ActualVolume) error
	ShouldModifyFunc      func(actual []ActualVolume) bool
	GetDesiredVolumesFunc func(tc *v1alpha1.TidbCluster, mt v1alpha1.MemberType) ([]DesiredVolume, error)
	GetActualVolumesFunc  func(pod *corev1.Pod, vs []DesiredVolume) ([]ActualVolume, error)
}

func (*FakePodVolumeModifier) GetActualVolumes

func (pvm *FakePodVolumeModifier) GetActualVolumes(pod *corev1.Pod, vs []DesiredVolume) ([]ActualVolume, error)

func (*FakePodVolumeModifier) GetDesiredVolumes

func (pvm *FakePodVolumeModifier) GetDesiredVolumes(tc *v1alpha1.TidbCluster, mt v1alpha1.MemberType) ([]DesiredVolume, error)

func (*FakePodVolumeModifier) Modify

func (pvm *FakePodVolumeModifier) Modify(actual []ActualVolume) error

func (*FakePodVolumeModifier) SetResult

func (pvm *FakePodVolumeModifier) SetResult(shouldModify bool, err error)

func (*FakePodVolumeModifier) ShouldModify

func (pvm *FakePodVolumeModifier) ShouldModify(actual []ActualVolume) bool

type PVCModifierInterface

type PVCModifierInterface interface {
	Sync(tc *v1alpha1.TidbCluster) error
}

type PVCReplacerInterface added in v1.5.1

type PVCReplacerInterface interface {
	UpdateStatus(tc *v1alpha1.TidbCluster) error
	Sync(tc *v1alpha1.TidbCluster) error
}

func NewFakePVCReplacer added in v1.5.1

func NewFakePVCReplacer() PVCReplacerInterface

func NewPVCReplacer added in v1.5.1

func NewPVCReplacer(deps *controller.Dependencies) PVCReplacerInterface

type PodVolumeModifier

type PodVolumeModifier interface {
	GetDesiredVolumes(tc *v1alpha1.TidbCluster, mt v1alpha1.MemberType) ([]DesiredVolume, error)
	GetActualVolumes(pod *corev1.Pod, vs []DesiredVolume) ([]ActualVolume, error)

	ShouldModify(actual []ActualVolume) bool
	Modify(actual []ActualVolume) error
}

func NewPodVolumeModifier

func NewPodVolumeModifier(deps *controller.Dependencies) PodVolumeModifier

type VolumePhase

type VolumePhase int
const (
	VolumePhaseUnknown VolumePhase = iota
	// 1. isPVCRevisionChanged: false
	// 2. needModify: true
	// 3. waitForNextTime: true
	VolumePhasePending
	// 1. isPVCRevisionChanged: false
	// 2. needModify: true
	// 3. waitForNextTime: false
	VolumePhasePreparing
	// 1. isPVCRevisionChanged: true
	// 2. needModify: true/false
	// 3. waitForNextTime: true/false
	VolumePhaseModifying
	// 1. isPVCRevisionChanged: false
	// 2. needModify: false
	// 3. waitForNextTime: true/false
	VolumePhaseModified

	VolumePhaseCannotModify
)

func (VolumePhase) String

func (p VolumePhase) String() string

Directories

Path Synopsis
aws

Jump to

Keyboard shortcuts

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