Documentation
¶
Overview ¶
Package volumes is a generated GoMock package.
Index ¶
- func IsWaitError(err error) bool
- func LegacySyncPVCs(ctx context.Context, cli client.Client, ...) (wait bool, err error)
- func SyncPVCs(ctx context.Context, c client.Client, pvcs []*corev1.PersistentVolumeClaim) error
- type ActualVolume
- type DesiredVolume
- type MockModifier
- func (m *MockModifier) EXPECT() *MockModifierMockRecorder
- func (m *MockModifier) GetActualVolume(ctx context.Context, expect, current *v1.PersistentVolumeClaim) (*ActualVolume, error)
- func (m *MockModifier) Modify(ctx context.Context, vol *ActualVolume) error
- func (m *MockModifier) ShouldModify(ctx context.Context, actual *ActualVolume) bool
- type MockModifierFactory
- type MockModifierFactoryMockRecorder
- type MockModifierMockRecorder
- type Modifier
- type ModifierFactory
- type VolumePhase
- type WaitError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LegacySyncPVCs ¶
func LegacySyncPVCs(ctx context.Context, cli client.Client, expectPVCs []*corev1.PersistentVolumeClaim, vm Modifier, logger logr.Logger, ) (wait bool, err error)
LegacySyncPVCs gets the actual PVCs and compares them with the expected PVCs. If the actual PVCs are different from the expected PVCs, it will update the PVCs.
Types ¶
type ActualVolume ¶
type ActualVolume struct {
Desired *DesiredVolume
PVC *corev1.PersistentVolumeClaim
Phase VolumePhase
// PV may be nil if there is no permission to get pvc
PV *corev1.PersistentVolume
// StorageClass may be nil if there is no permission to get storage class
StorageClass *storagev1.StorageClass
VACName *string
VAC *storagev1beta1.VolumeAttributesClass
}
func (*ActualVolume) GetStorageClassName ¶
func (v *ActualVolume) GetStorageClassName() string
func (*ActualVolume) GetStorageSize ¶
func (v *ActualVolume) GetStorageSize() resource.Quantity
func (*ActualVolume) String ¶
func (v *ActualVolume) String() string
type DesiredVolume ¶
type DesiredVolume struct {
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
// VACName is the name of VolumeAttributesClass specified by user.
// The VAC may not exist.
VACName *string
VAC *storagev1beta1.VolumeAttributesClass
}
func (*DesiredVolume) GetStorageClassName ¶
func (v *DesiredVolume) GetStorageClassName() string
GetStorageClassName 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
func (*DesiredVolume) String ¶
func (v *DesiredVolume) String() string
type MockModifier ¶
type MockModifier struct {
// contains filtered or unexported fields
}
MockModifier is a mock of Modifier interface.
func NewMockModifier ¶
func NewMockModifier(ctrl *gomock.Controller) *MockModifier
NewMockModifier creates a new mock instance.
func (*MockModifier) EXPECT ¶
func (m *MockModifier) EXPECT() *MockModifierMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockModifier) GetActualVolume ¶
func (m *MockModifier) GetActualVolume(ctx context.Context, expect, current *v1.PersistentVolumeClaim) (*ActualVolume, error)
GetActualVolume mocks base method.
func (*MockModifier) Modify ¶
func (m *MockModifier) Modify(ctx context.Context, vol *ActualVolume) error
Modify mocks base method.
func (*MockModifier) ShouldModify ¶
func (m *MockModifier) ShouldModify(ctx context.Context, actual *ActualVolume) bool
ShouldModify mocks base method.
type MockModifierFactory ¶
type MockModifierFactory struct {
// contains filtered or unexported fields
}
MockModifierFactory is a mock of ModifierFactory interface.
func NewMockModifierFactory ¶
func NewMockModifierFactory(ctrl *gomock.Controller) *MockModifierFactory
NewMockModifierFactory creates a new mock instance.
func (*MockModifierFactory) EXPECT ¶
func (m *MockModifierFactory) EXPECT() *MockModifierFactoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockModifierFactory) New ¶
func (m *MockModifierFactory) New() Modifier
New mocks base method.
type MockModifierFactoryMockRecorder ¶
type MockModifierFactoryMockRecorder struct {
// contains filtered or unexported fields
}
MockModifierFactoryMockRecorder is the mock recorder for MockModifierFactory.
func (*MockModifierFactoryMockRecorder) New ¶
func (mr *MockModifierFactoryMockRecorder) New() *gomock.Call
New indicates an expected call of New.
type MockModifierMockRecorder ¶
type MockModifierMockRecorder struct {
// contains filtered or unexported fields
}
MockModifierMockRecorder is the mock recorder for MockModifier.
func (*MockModifierMockRecorder) GetActualVolume ¶
func (mr *MockModifierMockRecorder) GetActualVolume(ctx, expect, current any) *gomock.Call
GetActualVolume indicates an expected call of GetActualVolume.
func (*MockModifierMockRecorder) Modify ¶
func (mr *MockModifierMockRecorder) Modify(ctx, vol any) *gomock.Call
Modify indicates an expected call of Modify.
func (*MockModifierMockRecorder) ShouldModify ¶
func (mr *MockModifierMockRecorder) ShouldModify(ctx, actual any) *gomock.Call
ShouldModify indicates an expected call of ShouldModify.
type Modifier ¶
type Modifier interface {
GetActualVolume(ctx context.Context, expect, current *corev1.PersistentVolumeClaim) (*ActualVolume, error)
ShouldModify(ctx context.Context, actual *ActualVolume) bool
Modify(ctx context.Context, vol *ActualVolume) error
}
type ModifierFactory ¶
type ModifierFactory interface {
// new modifier for cluster
New() Modifier
}
func NewModifierFactory ¶
func NewModifierFactory(logger logr.Logger, cli client.Client) ModifierFactory
NewModifierFactory creates a volume modifier factory.
type VolumePhase ¶
type VolumePhase int
const ( VolumePhaseUnknown VolumePhase = iota // VolumePhasePending will be set when: // 1. isPVCRevisionChanged: false // 2. needModify: true // 3. waitForNextTime: true VolumePhasePending // VolumePhasePreparing will be set when: // 1. isPVCRevisionChanged: false // 2. needModify: true // 3. waitForNextTime: false VolumePhasePreparing // VolumePhaseModifying will be set when: // 1. isPVCRevisionChanged: true // 2. needModify: true/false // 3. waitForNextTime: true/false VolumePhaseModifying // VolumePhaseModified will be set when: // 1. isPVCRevisionChanged: false // 2. needModify: false // 3. waitForNextTime: true/false VolumePhaseModified VolumePhaseCannotModify )
func (VolumePhase) String ¶
func (p VolumePhase) String() string