Documentation
¶
Overview ¶
Package spec is a generated GoMock package.
Index ¶
- func IsUpgrading(current *v1alpha1.Device, desired *v1alpha1.Device) bool
- type Item
- type ItemHeap
- type Manager
- type MockManager
- func (m *MockManager) CheckOsReconciliation(ctx context.Context) (string, bool, error)
- func (m *MockManager) CheckPolicy(ctx context.Context, policyType policy.Type, version string) error
- func (m *MockManager) ClearRollback() error
- func (m *MockManager) CreateRollback(ctx context.Context) error
- func (m *MockManager) EXPECT() *MockManagerMockRecorder
- func (m *MockManager) Ensure() error
- func (m *MockManager) GetDesired(ctx context.Context) (*v1alpha1.Device, bool, error)
- func (m *MockManager) Initialize(ctx context.Context) error
- func (m *MockManager) IsOSUpdate() bool
- func (m *MockManager) IsRollingBack(ctx context.Context) (bool, error)
- func (m *MockManager) IsUpgrading() bool
- func (m *MockManager) OSVersion(specType Type) string
- func (m *MockManager) Read(specType Type) (*v1alpha1.Device, error)
- func (m *MockManager) RenderedVersion(specType Type) string
- func (m *MockManager) Rollback(ctx context.Context, opts ...RollbackOption) error
- func (m *MockManager) SetClient(arg0 client.Management)
- func (m *MockManager) SetUpgradeFailed(version string) error
- func (m *MockManager) Status(arg0 context.Context, arg1 *v1alpha1.DeviceStatus) error
- func (m *MockManager) Upgrade(ctx context.Context) error
- type MockManagerMockRecorder
- func (mr *MockManagerMockRecorder) CheckOsReconciliation(ctx any) *gomock.Call
- func (mr *MockManagerMockRecorder) CheckPolicy(ctx, policyType, version any) *gomock.Call
- func (mr *MockManagerMockRecorder) ClearRollback() *gomock.Call
- func (mr *MockManagerMockRecorder) CreateRollback(ctx any) *gomock.Call
- func (mr *MockManagerMockRecorder) Ensure() *gomock.Call
- func (mr *MockManagerMockRecorder) GetDesired(ctx any) *gomock.Call
- func (mr *MockManagerMockRecorder) Initialize(ctx any) *gomock.Call
- func (mr *MockManagerMockRecorder) IsOSUpdate() *gomock.Call
- func (mr *MockManagerMockRecorder) IsRollingBack(ctx any) *gomock.Call
- func (mr *MockManagerMockRecorder) IsUpgrading() *gomock.Call
- func (mr *MockManagerMockRecorder) OSVersion(specType any) *gomock.Call
- func (mr *MockManagerMockRecorder) Read(specType any) *gomock.Call
- func (mr *MockManagerMockRecorder) RenderedVersion(specType any) *gomock.Call
- func (mr *MockManagerMockRecorder) Rollback(ctx any, opts ...any) *gomock.Call
- func (mr *MockManagerMockRecorder) SetClient(arg0 any) *gomock.Call
- func (mr *MockManagerMockRecorder) SetUpgradeFailed(version any) *gomock.Call
- func (mr *MockManagerMockRecorder) Status(arg0, arg1 any) *gomock.Call
- func (mr *MockManagerMockRecorder) Upgrade(ctx any) *gomock.Call
- type MockPriorityQueue
- func (m *MockPriorityQueue) Add(ctx context.Context, spec *v1alpha1.Device)
- func (m *MockPriorityQueue) CheckPolicy(ctx context.Context, policyType policy.Type, version string) error
- func (m *MockPriorityQueue) EXPECT() *MockPriorityQueueMockRecorder
- func (m *MockPriorityQueue) IsFailed(version int64) bool
- func (m *MockPriorityQueue) Next(ctx context.Context) (*v1alpha1.Device, bool)
- func (m *MockPriorityQueue) Remove(version int64)
- func (m *MockPriorityQueue) SetFailed(version int64)
- type MockPriorityQueueMockRecorder
- func (mr *MockPriorityQueueMockRecorder) Add(ctx, spec any) *gomock.Call
- func (mr *MockPriorityQueueMockRecorder) CheckPolicy(ctx, policyType, version any) *gomock.Call
- func (mr *MockPriorityQueueMockRecorder) IsFailed(version any) *gomock.Call
- func (mr *MockPriorityQueueMockRecorder) Next(ctx any) *gomock.Call
- func (mr *MockPriorityQueueMockRecorder) Remove(version any) *gomock.Call
- func (mr *MockPriorityQueueMockRecorder) SetFailed(version any) *gomock.Call
- type PriorityQueue
- type RollbackOption
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ItemHeap ¶ added in v0.3.0
type ItemHeap []*Item
ItemHeap is a priority queue that orders items by version.
type Manager ¶
type Manager interface {
// Initialize initializes the current, desired and rollback device files on
// disk. If the files already exist, they are overwritten.
Initialize(ctx context.Context) error
// Ensure ensures that spec files exist on disk and re initializes them if they do not.
Ensure() error
// RenderedVersion returns the rendered version of the specified spec type.
RenderedVersion(specType Type) string
// OSVersion returns the OS version of the specified spec type.
OSVersion(specType Type) string
// Read returns the rendered device of the specified type from disk.
Read(specType Type) (*v1alpha1.Device, error)
// Upgrade updates the current rendered spec to the desired rendered spec
// and resets the rollback spec.
Upgrade(ctx context.Context) error
// SetUpgradeFailed marks the desired rendered spec as failed.
SetUpgradeFailed(version string) error
// IsUpdating returns true if the device is in the process of reconciling the desired spec.
IsUpgrading() bool
// IsOSUpdate returns true if an OS update is in progress by checking the current rendered spec.
IsOSUpdate() bool
// CheckOsReconciliation checks if the booted OS image matches the desired OS image.
CheckOsReconciliation(ctx context.Context) (string, bool, error)
// IsRollingBack returns true if the device is in a rollback state.
IsRollingBack(ctx context.Context) (bool, error)
// CreateRollback creates a rollback version of the current rendered spec.
CreateRollback(ctx context.Context) error
// ClearRollback clears the rollback rendered spec.
ClearRollback() error
// Rollback reverts the device to the state of the rollback rendered spec.
Rollback(ctx context.Context, opts ...RollbackOption) error
// SetClient sets the management API client.
SetClient(client.Management)
// GetDesired returns the desired rendered device from the management API.
GetDesired(ctx context.Context) (*v1alpha1.Device, bool, error)
// CheckPolicy validates the update policy is ready to process.
CheckPolicy(ctx context.Context, policyType policy.Type, version string) error
status.Exporter
}
func NewManager ¶
func NewManager( deviceName string, dataDir string, policyManager policy.Manager, deviceReadWriter fileio.ReadWriter, osClient os.Client, backoff wait.Backoff, log *log.PrefixLogger, ) Manager
NewManager creates a new device spec manager.
Note: This manager is designed for sequential operations only and is not thread-safe.
type MockManager ¶
type MockManager struct {
// contains filtered or unexported fields
}
MockManager is a mock of Manager interface.
func NewMockManager ¶
func NewMockManager(ctrl *gomock.Controller) *MockManager
NewMockManager creates a new mock instance.
func (*MockManager) CheckOsReconciliation ¶
CheckOsReconciliation mocks base method.
func (*MockManager) CheckPolicy ¶ added in v0.4.0
func (m *MockManager) CheckPolicy(ctx context.Context, policyType policy.Type, version string) error
CheckPolicy mocks base method.
func (*MockManager) ClearRollback ¶ added in v0.4.0
func (m *MockManager) ClearRollback() error
ClearRollback mocks base method.
func (*MockManager) CreateRollback ¶ added in v0.4.0
func (m *MockManager) CreateRollback(ctx context.Context) error
CreateRollback mocks base method.
func (*MockManager) EXPECT ¶
func (m *MockManager) EXPECT() *MockManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockManager) GetDesired ¶
GetDesired mocks base method.
func (*MockManager) Initialize ¶
func (m *MockManager) Initialize(ctx context.Context) error
Initialize mocks base method.
func (*MockManager) IsOSUpdate ¶
func (m *MockManager) IsOSUpdate() bool
IsOSUpdate mocks base method.
func (*MockManager) IsRollingBack ¶
func (m *MockManager) IsRollingBack(ctx context.Context) (bool, error)
IsRollingBack mocks base method.
func (*MockManager) IsUpgrading ¶ added in v0.3.0
func (m *MockManager) IsUpgrading() bool
IsUpgrading mocks base method.
func (*MockManager) OSVersion ¶ added in v0.4.0
func (m *MockManager) OSVersion(specType Type) string
OSVersion mocks base method.
func (*MockManager) Read ¶
func (m *MockManager) Read(specType Type) (*v1alpha1.Device, error)
Read mocks base method.
func (*MockManager) RenderedVersion ¶ added in v0.4.0
func (m *MockManager) RenderedVersion(specType Type) string
RenderedVersion mocks base method.
func (*MockManager) Rollback ¶
func (m *MockManager) Rollback(ctx context.Context, opts ...RollbackOption) error
Rollback mocks base method.
func (*MockManager) SetClient ¶
func (m *MockManager) SetClient(arg0 client.Management)
SetClient mocks base method.
func (*MockManager) SetUpgradeFailed ¶ added in v0.3.0
func (m *MockManager) SetUpgradeFailed(version string) error
SetUpgradeFailed mocks base method.
func (*MockManager) Status ¶ added in v0.4.0
func (m *MockManager) Status(arg0 context.Context, arg1 *v1alpha1.DeviceStatus) error
Status mocks base method.
type MockManagerMockRecorder ¶
type MockManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockManagerMockRecorder is the mock recorder for MockManager.
func (*MockManagerMockRecorder) CheckOsReconciliation ¶
func (mr *MockManagerMockRecorder) CheckOsReconciliation(ctx any) *gomock.Call
CheckOsReconciliation indicates an expected call of CheckOsReconciliation.
func (*MockManagerMockRecorder) CheckPolicy ¶ added in v0.4.0
func (mr *MockManagerMockRecorder) CheckPolicy(ctx, policyType, version any) *gomock.Call
CheckPolicy indicates an expected call of CheckPolicy.
func (*MockManagerMockRecorder) ClearRollback ¶ added in v0.4.0
func (mr *MockManagerMockRecorder) ClearRollback() *gomock.Call
ClearRollback indicates an expected call of ClearRollback.
func (*MockManagerMockRecorder) CreateRollback ¶ added in v0.4.0
func (mr *MockManagerMockRecorder) CreateRollback(ctx any) *gomock.Call
CreateRollback indicates an expected call of CreateRollback.
func (*MockManagerMockRecorder) Ensure ¶
func (mr *MockManagerMockRecorder) Ensure() *gomock.Call
Ensure indicates an expected call of Ensure.
func (*MockManagerMockRecorder) GetDesired ¶
func (mr *MockManagerMockRecorder) GetDesired(ctx any) *gomock.Call
GetDesired indicates an expected call of GetDesired.
func (*MockManagerMockRecorder) Initialize ¶
func (mr *MockManagerMockRecorder) Initialize(ctx any) *gomock.Call
Initialize indicates an expected call of Initialize.
func (*MockManagerMockRecorder) IsOSUpdate ¶
func (mr *MockManagerMockRecorder) IsOSUpdate() *gomock.Call
IsOSUpdate indicates an expected call of IsOSUpdate.
func (*MockManagerMockRecorder) IsRollingBack ¶
func (mr *MockManagerMockRecorder) IsRollingBack(ctx any) *gomock.Call
IsRollingBack indicates an expected call of IsRollingBack.
func (*MockManagerMockRecorder) IsUpgrading ¶ added in v0.3.0
func (mr *MockManagerMockRecorder) IsUpgrading() *gomock.Call
IsUpgrading indicates an expected call of IsUpgrading.
func (*MockManagerMockRecorder) OSVersion ¶ added in v0.4.0
func (mr *MockManagerMockRecorder) OSVersion(specType any) *gomock.Call
OSVersion indicates an expected call of OSVersion.
func (*MockManagerMockRecorder) Read ¶
func (mr *MockManagerMockRecorder) Read(specType any) *gomock.Call
Read indicates an expected call of Read.
func (*MockManagerMockRecorder) RenderedVersion ¶ added in v0.4.0
func (mr *MockManagerMockRecorder) RenderedVersion(specType any) *gomock.Call
RenderedVersion indicates an expected call of RenderedVersion.
func (*MockManagerMockRecorder) Rollback ¶
func (mr *MockManagerMockRecorder) Rollback(ctx any, opts ...any) *gomock.Call
Rollback indicates an expected call of Rollback.
func (*MockManagerMockRecorder) SetClient ¶
func (mr *MockManagerMockRecorder) SetClient(arg0 any) *gomock.Call
SetClient indicates an expected call of SetClient.
func (*MockManagerMockRecorder) SetUpgradeFailed ¶ added in v0.3.0
func (mr *MockManagerMockRecorder) SetUpgradeFailed(version any) *gomock.Call
SetUpgradeFailed indicates an expected call of SetUpgradeFailed.
type MockPriorityQueue ¶ added in v0.3.0
type MockPriorityQueue struct {
// contains filtered or unexported fields
}
MockPriorityQueue is a mock of PriorityQueue interface.
func NewMockPriorityQueue ¶ added in v0.3.0
func NewMockPriorityQueue(ctrl *gomock.Controller) *MockPriorityQueue
NewMockPriorityQueue creates a new mock instance.
func (*MockPriorityQueue) Add ¶ added in v0.3.0
func (m *MockPriorityQueue) Add(ctx context.Context, spec *v1alpha1.Device)
Add mocks base method.
func (*MockPriorityQueue) CheckPolicy ¶ added in v0.4.0
func (m *MockPriorityQueue) CheckPolicy(ctx context.Context, policyType policy.Type, version string) error
CheckPolicy mocks base method.
func (*MockPriorityQueue) EXPECT ¶ added in v0.3.0
func (m *MockPriorityQueue) EXPECT() *MockPriorityQueueMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPriorityQueue) IsFailed ¶ added in v0.4.0
func (m *MockPriorityQueue) IsFailed(version int64) bool
IsFailed mocks base method.
func (*MockPriorityQueue) Remove ¶ added in v0.3.0
func (m *MockPriorityQueue) Remove(version int64)
Remove mocks base method.
func (*MockPriorityQueue) SetFailed ¶ added in v0.4.0
func (m *MockPriorityQueue) SetFailed(version int64)
SetFailed mocks base method.
type MockPriorityQueueMockRecorder ¶ added in v0.3.0
type MockPriorityQueueMockRecorder struct {
// contains filtered or unexported fields
}
MockPriorityQueueMockRecorder is the mock recorder for MockPriorityQueue.
func (*MockPriorityQueueMockRecorder) Add ¶ added in v0.3.0
func (mr *MockPriorityQueueMockRecorder) Add(ctx, spec any) *gomock.Call
Add indicates an expected call of Add.
func (*MockPriorityQueueMockRecorder) CheckPolicy ¶ added in v0.4.0
func (mr *MockPriorityQueueMockRecorder) CheckPolicy(ctx, policyType, version any) *gomock.Call
CheckPolicy indicates an expected call of CheckPolicy.
func (*MockPriorityQueueMockRecorder) IsFailed ¶ added in v0.4.0
func (mr *MockPriorityQueueMockRecorder) IsFailed(version any) *gomock.Call
IsFailed indicates an expected call of IsFailed.
func (*MockPriorityQueueMockRecorder) Next ¶ added in v0.3.0
func (mr *MockPriorityQueueMockRecorder) Next(ctx any) *gomock.Call
Next indicates an expected call of Next.
type PriorityQueue ¶ added in v0.3.0
type PriorityQueue interface {
// Add adds a new spec to the scheduler
Add(ctx context.Context, spec *v1alpha1.Device)
// Next returns the next spec to process
Next(ctx context.Context) (*v1alpha1.Device, bool)
// Remove removes a spec from the scheduler
Remove(version int64)
// SetFailed marks a rendered spec version as failed
SetFailed(version int64)
// IsFailed returns true if a version is marked as failed
IsFailed(version int64) bool
// CheckPolicy validates the update policy is ready to process.
CheckPolicy(ctx context.Context, policyType policy.Type, version string) error
}
type RollbackOption ¶ added in v0.5.0
type RollbackOption func(*rollbackConfig)
func WithSetFailed ¶ added in v0.5.0
func WithSetFailed() RollbackOption
WithSetFailed enables setting the desired spec as failed.