volumes

package
v1.5.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 24 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
	PV           *corev1.PersistentVolume
	StorageClass *storagev1.StorageClass
	Phase        VolumePhase
}

func (*ActualVolume) GetStorageClassName

func (v *ActualVolume) GetStorageClassName() string

func (*ActualVolume) GetStorageSize

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

type DesiredVolume

type DesiredVolume struct {
	Name         v1alpha1.StorageVolumeName
	Size         resource.Quantity
	StorageClass *storagev1.StorageClass
}

func (*DesiredVolume) GetStorageClassName

func (v *DesiredVolume) GetStorageClassName() string

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 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