baremetal

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderName is exported.
	ProviderName = "metal3"
	// HostAnnotation is the key for an annotation that should go on a Metal3Machine to
	// reference what BareMetalHost it corresponds to.
	HostAnnotation = "metal3.io/BareMetalHost"

	PausedAnnotationKey = "metal3.io/capm3"
)

Variables

This section is empty.

Functions

func Contains added in v0.3.1

func Contains(list []string, strToSearch string) bool

Contains returns true if a list contains a string.

func Filter added in v0.3.1

func Filter(list []string, strToFilter string) (newList []string)

Filter filters a list for a string.

Types

type ClientGetter

type ClientGetter func(ctx context.Context, c client.Client, cluster *capi.Cluster) (clientcorev1.CoreV1Interface, error)

ClientGetter prototype

type ClusterManager

type ClusterManager struct {
	Cluster       *capi.Cluster
	Metal3Cluster *capm3.Metal3Cluster
	Log           logr.Logger
	// contains filtered or unexported fields
}

ClusterManager is responsible for performing metal3 cluster reconciliation

func (*ClusterManager) ControlPlaneEndpoint

func (s *ClusterManager) ControlPlaneEndpoint() ([]capm3.APIEndpoint, error)

ControlPlaneEndpoint returns cluster controlplane endpoint

func (*ClusterManager) CountDescendants

func (s *ClusterManager) CountDescendants(ctx context.Context) (int, error)

CountDescendants will return the number of descendants objects of the metal3Cluster

func (*ClusterManager) Create

func (s *ClusterManager) Create(ctx context.Context) error

Create creates a cluster manager for the cluster.

func (*ClusterManager) Delete

func (s *ClusterManager) Delete() error

Delete function, no-op for now

func (*ClusterManager) SetFinalizer

func (s *ClusterManager) SetFinalizer()

SetFinalizer sets finalizer

func (*ClusterManager) UnsetFinalizer

func (s *ClusterManager) UnsetFinalizer()

UnsetFinalizer unsets finalizer

func (*ClusterManager) UpdateClusterStatus

func (s *ClusterManager) UpdateClusterStatus() error

UpdateClusterStatus updates a metal3Cluster object's status.

type ClusterManagerInterface

type ClusterManagerInterface interface {
	Create(context.Context) error
	Delete() error
	UpdateClusterStatus() error
	SetFinalizer()
	UnsetFinalizer()
	CountDescendants(context.Context) (int, error)
}

ClusterManagerInterface is an interface for a ClusterManager

func NewClusterManager

func NewClusterManager(client client.Client, cluster *capi.Cluster,
	metal3Cluster *capm3.Metal3Cluster,
	clusterLog logr.Logger) (ClusterManagerInterface, error)

NewClusterManager returns a new helper for managing a cluster with a given name.

type DataManager added in v0.4.0

type DataManager struct {
	Data *capm3.Metal3Data
	Log  logr.Logger
	// contains filtered or unexported fields
}

DataManager is responsible for performing machine reconciliation

func NewDataManager added in v0.4.0

func NewDataManager(client client.Client,
	data *capm3.Metal3Data, dataLog logr.Logger) (*DataManager, error)

NewDataManager returns a new helper for managing a Metal3Data object

func (*DataManager) Reconcile added in v0.4.0

func (m *DataManager) Reconcile(ctx context.Context) error

func (*DataManager) ReleaseLeases added in v0.4.0

func (m *DataManager) ReleaseLeases(ctx context.Context) error

ReleaseLeases releases addresses from pool.

func (*DataManager) SetFinalizer added in v0.4.0

func (m *DataManager) SetFinalizer()

SetFinalizer sets finalizer

func (*DataManager) UnsetFinalizer added in v0.4.0

func (m *DataManager) UnsetFinalizer()

UnsetFinalizer unsets finalizer

type DataManagerInterface added in v0.4.0

type DataManagerInterface interface {
	SetFinalizer()
	UnsetFinalizer()
	Reconcile(ctx context.Context) error
	ReleaseLeases(ctx context.Context) error
}

DataManagerInterface is an interface for a DataManager

type DataTemplateManager added in v0.4.0

type DataTemplateManager struct {
	DataTemplate *capm3.Metal3DataTemplate
	Log          logr.Logger
	// contains filtered or unexported fields
}

DataTemplateManager is responsible for performing machine reconciliation

func NewDataTemplateManager added in v0.4.0

func NewDataTemplateManager(client client.Client,
	dataTemplate *capm3.Metal3DataTemplate, dataTemplateLog logr.Logger) (*DataTemplateManager, error)

NewDataTemplateManager returns a new helper for managing a dataTemplate object

func (*DataTemplateManager) SetClusterOwnerRef added in v0.4.0

func (m *DataTemplateManager) SetClusterOwnerRef(cluster *capi.Cluster) error

func (*DataTemplateManager) SetFinalizer added in v0.4.0

func (m *DataTemplateManager) SetFinalizer()

SetFinalizer sets finalizer

func (*DataTemplateManager) UnsetFinalizer added in v0.4.0

func (m *DataTemplateManager) UnsetFinalizer()

UnsetFinalizer unsets finalizer

func (*DataTemplateManager) UpdateDatas added in v0.4.0

func (m *DataTemplateManager) UpdateDatas(ctx context.Context) (int, error)

UpdateDatas manages the claims and creates or deletes Metal3Data accordingly. It returns the number of current allocations

type DataTemplateManagerInterface added in v0.4.0

type DataTemplateManagerInterface interface {
	SetFinalizer()
	UnsetFinalizer()
	SetClusterOwnerRef(*capi.Cluster) error
	UpdateDatas(context.Context) (int, error)
}

DataTemplateManagerInterface is an interface for a DataTemplateManager

type HasRequeueAfterError

type HasRequeueAfterError interface {
	// GetRequeueAfter gets the duration to wait until the managed object is
	// requeued for further processing.
	GetRequeueAfter() time.Duration
}

HasRequeueAfterError represents that an actuator managed object should be requeued for further processing after the given RequeueAfter time has passed.

type MachineManager

type MachineManager struct {
	Cluster               *capi.Cluster
	Metal3Cluster         *capm3.Metal3Cluster
	Machine               *capi.Machine
	Metal3Machine         *capm3.Metal3Machine
	Metal3MachineTemplate *capm3.Metal3MachineTemplate
	MachineSetList        []*capi.MachineSet
	Log                   logr.Logger
	// contains filtered or unexported fields
}

MachineManager is responsible for performing machine reconciliation

func NewMachineManager

func NewMachineManager(client client.Client,
	cluster *capi.Cluster, metal3Cluster *capm3.Metal3Cluster,
	machine *capi.Machine, metal3machine *capm3.Metal3Machine,
	machineLog logr.Logger) (*MachineManager, error)

NewMachineManager returns a new helper for managing a machine

func NewMachineSetManager added in v0.4.2

func NewMachineSetManager(client client.Client,
	machine *capi.Machine, machinesetlist []*capi.MachineSet,
	machineset *capi.MachineSet, machineLog logr.Logger) (*MachineManager, error)

NewMachineSetManager returns a new helper for managing a machineset

func (*MachineManager) Associate

func (m *MachineManager) Associate(ctx context.Context) error

Associate associates a machine and is invoked by the Machine Controller

func (*MachineManager) AssociateM3Metadata added in v0.4.0

func (m *MachineManager) AssociateM3Metadata(ctx context.Context) error

RetrieveMetadata fetches the Metal3DataTemplate object and sets the owner references

func (*MachineManager) Delete

func (m *MachineManager) Delete(ctx context.Context) error

Delete deletes a metal3 machine and is invoked by the Machine Controller

func (*MachineManager) DeleteOwnerRef

func (m *MachineManager) DeleteOwnerRef(refList []metav1.OwnerReference) ([]metav1.OwnerReference, error)

DeleteOwnerRef removes the ownerreference to this Metal3 machine

func (*MachineManager) DissociateM3Metadata added in v0.4.0

func (m *MachineManager) DissociateM3Metadata(ctx context.Context) error

remove machine from OwnerReferences of meta3DataTemplate, on failure requeue

func (*MachineManager) FindOwnerRef

func (m *MachineManager) FindOwnerRef(refList []metav1.OwnerReference) (int, error)

FindOwnerRef checks if an ownerreference to this Metal3 machine exists and returns the index

func (*MachineManager) GetBaremetalHostID

func (m *MachineManager) GetBaremetalHostID(ctx context.Context) (*string, error)

GetBaremetalHostID return the provider identifier for this machine

func (*MachineManager) GetProviderIDAndBMHID added in v0.3.2

func (m *MachineManager) GetProviderIDAndBMHID() (string, *string)

GetProviderIDAndBMHID returns providerID and bmhID

func (*MachineManager) HasAnnotation

func (m *MachineManager) HasAnnotation() bool

HasAnnotation makes sure the machine has an annotation that references a host

func (*MachineManager) IsBootstrapReady

func (m *MachineManager) IsBootstrapReady() bool

IsBootstrapReady checks if the machine is given Bootstrap data

func (*MachineManager) IsProvisioned

func (m *MachineManager) IsProvisioned() bool

IsProvisioned checks if the metal3machine is provisioned

func (*MachineManager) RemovePauseAnnotation added in v0.4.0

func (m *MachineManager) RemovePauseAnnotation(ctx context.Context) error

RemovePauseAnnotation checks and/or Removes the pause annotations on associated bmh

func (*MachineManager) SetError added in v0.4.0

func (m *MachineManager) SetError(message string, reason capierrors.MachineStatusError)

SetError sets the ErrorMessage and ErrorReason fields on the machine and logs the message. It assumes the reason is invalid configuration, since that is currently the only relevant MachineStatusError choice.

func (*MachineManager) SetFinalizer

func (m *MachineManager) SetFinalizer()

SetFinalizer sets finalizer

func (*MachineManager) SetNodeProviderID

func (m *MachineManager) SetNodeProviderID(ctx context.Context, bmhID, providerID string, clientFactory ClientGetter) error

SetNodeProviderID sets the metal3 provider ID on the kubernetes node

func (*MachineManager) SetOwnerRef

func (m *MachineManager) SetOwnerRef(refList []metav1.OwnerReference, controller bool) ([]metav1.OwnerReference, error)

SetOwnerRef adds an ownerreference to this Metal3 machine

func (*MachineManager) SetPauseAnnotation added in v0.4.0

func (m *MachineManager) SetPauseAnnotation(ctx context.Context) error

SetPauseAnnotation sets the pause annotations on associated bmh

func (*MachineManager) SetProviderID

func (m *MachineManager) SetProviderID(providerID string)

SetProviderID sets the metal3 provider ID on the metal3machine

func (*MachineManager) UnsetFinalizer

func (m *MachineManager) UnsetFinalizer()

UnsetFinalizer unsets finalizer

func (*MachineManager) Update

func (m *MachineManager) Update(ctx context.Context) error

Update updates a machine and is invoked by the Machine Controller

func (*MachineManager) WaitForM3Metadata added in v0.4.0

func (m *MachineManager) WaitForM3Metadata(ctx context.Context) error

WaitForM3Metadata fetches the Metal3DataTemplate object and sets the owner references

type MachineManagerInterface

type MachineManagerInterface interface {
	SetFinalizer()
	UnsetFinalizer()
	IsProvisioned() bool
	IsBootstrapReady() bool
	GetBaremetalHostID(context.Context) (*string, error)
	Associate(context.Context) error
	Delete(context.Context) error
	Update(context.Context) error
	HasAnnotation() bool
	GetProviderIDAndBMHID() (string, *string)
	SetNodeProviderID(context.Context, string, string, ClientGetter) error
	SetProviderID(string)
	SetPauseAnnotation(context.Context) error
	RemovePauseAnnotation(context.Context) error
	DissociateM3Metadata(context.Context) error
	AssociateM3Metadata(context.Context) error
	SetError(string, capierrors.MachineStatusError)
}

MachineManagerInterface is an interface for a ClusterManager

type MachineTemplateManager added in v0.5.0

type MachineTemplateManager struct {
	Metal3MachineList     *capm3.Metal3MachineList
	Metal3MachineTemplate *capm3.Metal3MachineTemplate
	Log                   logr.Logger
	// contains filtered or unexported fields
}

MachineTemplateManager is responsible for performing metal3MachineTemplate reconciliation

func NewMachineTemplateManager added in v0.5.0

func NewMachineTemplateManager(client client.Client,
	metal3MachineTemplate *capm3.Metal3MachineTemplate,

	metal3MachineList *capm3.Metal3MachineList,
	metal3MachineTemplateLog logr.Logger) (*MachineTemplateManager, error)

NewMachineTemplateManager returns a new helper for managing a metal3MachineTemplate

func (*MachineTemplateManager) UpdateAutomatedCleaningMode added in v0.5.0

func (m *MachineTemplateManager) UpdateAutomatedCleaningMode(ctx context.Context) error

UpdateAutomatedCleaningMode synchronizes automatedCleaningMode field value between metal3MachineTemplate and all the metal3Machines cloned from this metal3MachineTemplate.

type ManagerFactory

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

ManagerFactory only contains a client

func NewManagerFactory

func NewManagerFactory(client client.Client) ManagerFactory

NewManagerFactory returns a new factory.

func (ManagerFactory) NewClusterManager

func (f ManagerFactory) NewClusterManager(cluster *capi.Cluster, capm3Cluster *capm3.Metal3Cluster, clusterLog logr.Logger) (ClusterManagerInterface, error)

NewClusterManager creates a new ClusterManager

func (ManagerFactory) NewDataManager added in v0.4.0

func (f ManagerFactory) NewDataManager(metadata *capm3.Metal3Data, metadataLog logr.Logger) (DataManagerInterface, error)

NewDataManager creates a new DataManager

func (ManagerFactory) NewDataTemplateManager added in v0.4.0

func (f ManagerFactory) NewDataTemplateManager(metadata *capm3.Metal3DataTemplate, metadataLog logr.Logger) (DataTemplateManagerInterface, error)

NewDataTemplateManager creates a new DataTemplateManager

func (ManagerFactory) NewMachineManager

func (f ManagerFactory) NewMachineManager(capiCluster *capi.Cluster,
	capm3Cluster *capm3.Metal3Cluster,
	capiMachine *capi.Machine, capm3Machine *capm3.Metal3Machine,
	machineLog logr.Logger) (MachineManagerInterface, error)

NewMachineManager creates a new MachineManager

func (ManagerFactory) NewMachineTemplateManager added in v0.5.0

func (f ManagerFactory) NewMachineTemplateManager(capm3Template *capm3.Metal3MachineTemplate,
	capm3MachineList *capm3.Metal3MachineList,
	metadataLog logr.Logger) (TemplateManagerInterface, error)

NewMachineTemplateManager creates a new Metal3MachineTemplateManager

type ManagerFactoryInterface

type ManagerFactoryInterface interface {
	NewClusterManager(cluster *capi.Cluster,
		metal3Cluster *capm3.Metal3Cluster,
		clusterLog logr.Logger,
	) (ClusterManagerInterface, error)
	NewMachineManager(*capi.Cluster, *capm3.Metal3Cluster, *capi.Machine,
		*capm3.Metal3Machine, logr.Logger,
	) (MachineManagerInterface, error)
	NewDataTemplateManager(*capm3.Metal3DataTemplate, logr.Logger) (
		DataTemplateManagerInterface, error,
	)
	NewDataManager(*capm3.Metal3Data, logr.Logger) (
		DataManagerInterface, error,
	)
	NewMachineTemplateManager(capm3Template *capm3.Metal3MachineTemplate,
		capm3MachineList *capm3.Metal3MachineList,
		metadataLog logr.Logger,
	) (TemplateManagerInterface, error)
}

type NotFoundError added in v0.3.1

type NotFoundError struct {
}

NotFoundError represents that an object was not found

func (*NotFoundError) Error added in v0.3.1

func (e *NotFoundError) Error() string

Error implements the error interface

type RequeueAfterError

type RequeueAfterError struct {
	RequeueAfter time.Duration
}

RequeueAfterError represents that an actuator managed object should be requeued for further processing after the given RequeueAfter time has passed.

func (*RequeueAfterError) Error

func (e *RequeueAfterError) Error() string

Error implements the error interface

func (*RequeueAfterError) GetRequeueAfter

func (e *RequeueAfterError) GetRequeueAfter() time.Duration

GetRequeueAfter gets the duration to wait until the managed object is requeued for further processing.

type TemplateManagerInterface added in v0.5.0

type TemplateManagerInterface interface {
	UpdateAutomatedCleaningMode(context.Context) error
}

TemplateManagerInterface is an interface for a TemplateManager

Directories

Path Synopsis
Package baremetal_mocks is a generated GoMock package.
Package baremetal_mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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