spec

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package spec is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingRenderedSpec = fmt.Errorf("missing rendered spec")
	ErrNoContent           = fmt.Errorf("no content")
)

Functions

func IsUpdating

func IsUpdating(current *v1alpha1.RenderedDeviceSpec, desired *v1alpha1.RenderedDeviceSpec) bool

Types

type Manager

type Manager interface {
	// Initialize initializes the current, desired and rollback spec files on
	// disk. If the files already exist, they are overwritten.
	Initialize() error
	// Ensure ensures that spec files exist on disk and re initializes them if they do not.
	Ensure() error
	// Read returns the rendered device spec of the specified type from disk.
	Read(specType Type) (*v1alpha1.RenderedDeviceSpec, error)
	// Upgrade updates the current rendered spec to the desired rendered spec
	// and resets the rollback spec.
	Upgrade() error
	// IsOSUpdate returns true if an OS update is in progress by checking the current rendered spec.
	IsOSUpdate() (bool, error)
	// 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)
	// PrepareRollback creates a rollback version of the current rendered spec.
	PrepareRollback(ctx context.Context) error
	// Rollback reverts the device to the state of the rollback rendered spec.
	Rollback() error
	// SetClient sets the management API client.
	SetClient(client.Management)
	// GetDesired returns the desired rendered device spec from the management API.
	GetDesired(ctx context.Context, renderedVersion string) (*v1alpha1.RenderedDeviceSpec, error)
}

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

func (m *MockManager) CheckOsReconciliation(ctx context.Context) (string, bool, error)

CheckOsReconciliation 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) Ensure

func (m *MockManager) Ensure() error

Ensure mocks base method.

func (*MockManager) GetDesired

func (m *MockManager) GetDesired(ctx context.Context, renderedVersion string) (*v1alpha1.RenderedDeviceSpec, error)

GetDesired mocks base method.

func (*MockManager) Initialize

func (m *MockManager) Initialize() error

Initialize mocks base method.

func (*MockManager) IsOSUpdate

func (m *MockManager) IsOSUpdate() (bool, error)

IsOSUpdate mocks base method.

func (*MockManager) IsRollingBack

func (m *MockManager) IsRollingBack(ctx context.Context) (bool, error)

IsRollingBack mocks base method.

func (*MockManager) PrepareRollback

func (m *MockManager) PrepareRollback(ctx context.Context) error

PrepareRollback mocks base method.

func (*MockManager) Read

func (m *MockManager) Read(specType Type) (*v1alpha1.RenderedDeviceSpec, error)

Read mocks base method.

func (*MockManager) Rollback

func (m *MockManager) Rollback() error

Rollback mocks base method.

func (*MockManager) SetClient

func (m *MockManager) SetClient(arg0 client.Management)

SetClient mocks base method.

func (*MockManager) Upgrade

func (m *MockManager) Upgrade() error

Upgrade 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) Ensure

func (mr *MockManagerMockRecorder) Ensure() *gomock.Call

Ensure indicates an expected call of Ensure.

func (*MockManagerMockRecorder) GetDesired

func (mr *MockManagerMockRecorder) GetDesired(ctx, renderedVersion any) *gomock.Call

GetDesired indicates an expected call of GetDesired.

func (*MockManagerMockRecorder) Initialize

func (mr *MockManagerMockRecorder) Initialize() *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) PrepareRollback

func (mr *MockManagerMockRecorder) PrepareRollback(ctx any) *gomock.Call

PrepareRollback indicates an expected call of PrepareRollback.

func (*MockManagerMockRecorder) Read

func (mr *MockManagerMockRecorder) Read(specType any) *gomock.Call

Read indicates an expected call of Read.

func (*MockManagerMockRecorder) Rollback

func (mr *MockManagerMockRecorder) Rollback() *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) Upgrade

func (mr *MockManagerMockRecorder) Upgrade() *gomock.Call

Upgrade indicates an expected call of Upgrade.

type SpecManager

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

Manager is responsible for managing the rendered device spec.

func NewManager

func NewManager(
	deviceName string,
	dataDir string,
	deviceReadWriter fileio.ReadWriter,
	bootcClient container.BootcClient,
	backoff wait.Backoff,
	log *log.PrefixLogger,
) *SpecManager

NewManager creates a new device spec manager.

func (*SpecManager) CheckOsReconciliation

func (s *SpecManager) CheckOsReconciliation(ctx context.Context) (string, bool, error)

func (*SpecManager) Ensure

func (s *SpecManager) Ensure() error

func (*SpecManager) GetDesired

func (s *SpecManager) GetDesired(ctx context.Context, currentRenderedVersion string) (*v1alpha1.RenderedDeviceSpec, error)

func (*SpecManager) Initialize

func (s *SpecManager) Initialize() error

func (*SpecManager) IsOSUpdate

func (s *SpecManager) IsOSUpdate() (bool, error)

func (*SpecManager) IsRollingBack

func (s *SpecManager) IsRollingBack(ctx context.Context) (bool, error)

func (*SpecManager) PrepareRollback

func (s *SpecManager) PrepareRollback(ctx context.Context) error

func (*SpecManager) Read

func (s *SpecManager) Read(specType Type) (*v1alpha1.RenderedDeviceSpec, error)

func (*SpecManager) Rollback

func (s *SpecManager) Rollback() error

func (*SpecManager) SetClient

func (s *SpecManager) SetClient(client client.Management)

func (*SpecManager) Upgrade

func (s *SpecManager) Upgrade() error

type Type

type Type string
const (
	Current  Type = "current"
	Desired  Type = "desired"
	Rollback Type = "rollback"
)

Jump to

Keyboard shortcuts

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