baremetal

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

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

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 machine 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 machine 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 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
	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 (*MachineManager) Associate

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

Associate associates a machine and is invoked by the Machine Controller

func (*MachineManager) Delete

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

Delete deletes a bare metal 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) 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) GetUserData

func (m *MachineManager) GetUserData(ctx context.Context, host *bmh.BareMetalHost) error

GetUserData gets the UserData from the machine and exposes it as a secret for the BareMetalHost. The UserData might already be in a secret with CABPK v0.3.0+, but if it is in a different namespace than the BareMetalHost, then we need to create the secret. Same as if the UserData is in the data field.

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 machine is provisioned

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 bare metal 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) SetProviderID

func (m *MachineManager) SetProviderID(providerID string)

SetProviderID sets the bare metal 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

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
	SetNodeProviderID(context.Context, string, string, ClientGetter) error
	SetProviderID(string)
}

MachineManagerInterface is an interface for a ClusterManager

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

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

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.

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