Documentation ¶
Index ¶
- Constants
- Variables
- func Contains(list []string, strToSearch string) bool
- type ClientGetter
- type ClusterManager
- func (s *ClusterManager) ControlPlaneEndpoint() ([]infrav1.APIEndpoint, error)
- func (s *ClusterManager) CountDescendants(ctx context.Context) (int, error)
- func (s *ClusterManager) Create(_ context.Context) error
- func (s *ClusterManager) Delete() error
- func (s *ClusterManager) SetFinalizer()
- func (s *ClusterManager) UnsetFinalizer()
- func (s *ClusterManager) UpdateClusterStatus() error
- type ClusterManagerInterface
- type DataManager
- type DataManagerInterface
- type DataTemplateManager
- type DataTemplateManagerInterface
- type MachineManager
- func (m *MachineManager) Associate(ctx context.Context) error
- func (m *MachineManager) AssociateM3Metadata(ctx context.Context) error
- func (m *MachineManager) Delete(ctx context.Context) error
- func (m *MachineManager) DeleteOwnerRef(refList []metav1.OwnerReference) ([]metav1.OwnerReference, error)
- func (m *MachineManager) DissociateM3Metadata(ctx context.Context) error
- func (m *MachineManager) FindOwnerRef(refList []metav1.OwnerReference) (int, error)
- func (m *MachineManager) GetBaremetalHostID(ctx context.Context) (*string, error)
- func (m *MachineManager) GetProviderIDAndBMHID() (string, *string)
- func (m *MachineManager) HasAnnotation() bool
- func (m *MachineManager) IsBootstrapReady() bool
- func (m *MachineManager) IsProvisioned() bool
- func (m *MachineManager) RemovePauseAnnotation(ctx context.Context) error
- func (m *MachineManager) SetConditionMetal3MachineToFalse(t clusterv1.ConditionType, reason string, severity clusterv1.ConditionSeverity, ...)
- func (m *MachineManager) SetConditionMetal3MachineToTrue(t clusterv1.ConditionType)
- func (m *MachineManager) SetError(message string, reason capierrors.MachineStatusError)
- func (m *MachineManager) SetFinalizer()
- func (m *MachineManager) SetNodeProviderID(ctx context.Context, providerIDOnM3M *string, clientFactory ClientGetter) error
- func (m *MachineManager) SetOwnerRef(refList []metav1.OwnerReference, controller bool) ([]metav1.OwnerReference, error)
- func (m *MachineManager) SetPauseAnnotation(ctx context.Context) error
- func (m *MachineManager) SetProviderID(providerID string)
- func (m *MachineManager) UnsetFinalizer()
- func (m *MachineManager) Update(ctx context.Context) error
- func (m *MachineManager) WaitForM3Metadata(ctx context.Context) error
- type MachineManagerInterface
- type MachineTemplateManager
- type ManagerFactory
- func (f ManagerFactory) NewClusterManager(cluster *clusterv1.Cluster, capm3Cluster *infrav1.Metal3Cluster, ...) (ClusterManagerInterface, error)
- func (f ManagerFactory) NewDataManager(metadata *infrav1.Metal3Data, metadataLog logr.Logger) (DataManagerInterface, error)
- func (f ManagerFactory) NewDataTemplateManager(metadata *infrav1.Metal3DataTemplate, metadataLog logr.Logger) (DataTemplateManagerInterface, error)
- func (f ManagerFactory) NewMachineManager(capiCluster *clusterv1.Cluster, capm3Cluster *infrav1.Metal3Cluster, ...) (MachineManagerInterface, error)
- func (f ManagerFactory) NewMachineTemplateManager(capm3Template *infrav1.Metal3MachineTemplate, ...) (TemplateManagerInterface, error)
- func (f ManagerFactory) NewRemediationManager(remediation *infrav1.Metal3Remediation, metal3machine *infrav1.Metal3Machine, ...) (RemediationManagerInterface, error)
- type ManagerFactoryInterface
- type NotFoundError
- type ReconcileError
- type ReconcileErrorType
- type RemediationManager
- func (r *RemediationManager) AddOutOfServiceTaint(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error
- func (r *RemediationManager) DeleteNode(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error
- func (r *RemediationManager) GetCapiMachine(ctx context.Context) (*clusterv1.Machine, error)
- func (r *RemediationManager) GetClusterClient(ctx context.Context) (v1.CoreV1Interface, error)
- func (r *RemediationManager) GetLastRemediatedTime() *metav1.Time
- func (r *RemediationManager) GetNode(ctx context.Context, clusterClient v1.CoreV1Interface) (*corev1.Node, error)
- func (r *RemediationManager) GetNodeBackupAnnotations() (annotations, labels string)
- func (r *RemediationManager) GetRemediationPhase() string
- func (r *RemediationManager) GetRemediationType() infrav1.RemediationType
- func (r *RemediationManager) GetTimeout() *metav1.Duration
- func (r *RemediationManager) GetUnhealthyHost(ctx context.Context) (*bmov1alpha1.BareMetalHost, *patch.Helper, error)
- func (r *RemediationManager) HasFinalizer() bool
- func (r *RemediationManager) HasOutOfServiceTaint(node *corev1.Node) bool
- func (r *RemediationManager) HasReachRetryLimit() bool
- func (r *RemediationManager) IncreaseRetryCount()
- func (r *RemediationManager) IsNodeDrained(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) bool
- func (r *RemediationManager) IsPowerOffRequested(ctx context.Context) (bool, error)
- func (r *RemediationManager) IsPoweredOn(ctx context.Context) (bool, error)
- func (r *RemediationManager) OnlineStatus(host *bmov1alpha1.BareMetalHost) bool
- func (r *RemediationManager) RemoveNodeBackupAnnotations()
- func (r *RemediationManager) RemoveOutOfServiceTaint(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error
- func (r *RemediationManager) RemovePowerOffAnnotation(ctx context.Context) error
- func (r *RemediationManager) RetryLimitIsSet() bool
- func (r *RemediationManager) SetFinalizer()
- func (r *RemediationManager) SetLastRemediationTime(remediationTime *metav1.Time)
- func (r *RemediationManager) SetNodeBackupAnnotations(annotations string, labels string) bool
- func (r *RemediationManager) SetOwnerRemediatedConditionNew(ctx context.Context) error
- func (r *RemediationManager) SetPowerOffAnnotation(ctx context.Context) error
- func (r *RemediationManager) SetRemediationPhase(phase string)
- func (r *RemediationManager) SetUnhealthyAnnotation(ctx context.Context) error
- func (r *RemediationManager) TimeToRemediate(timeout time.Duration) (bool, time.Duration)
- func (r *RemediationManager) UnsetFinalizer()
- func (r *RemediationManager) UpdateNode(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error
- type RemediationManagerInterface
- type TemplateManagerInterface
Constants ¶
const ( DataLabelName = "infrastructure.cluster.x-k8s.io/data-name" PoolLabelName = "infrastructure.cluster.x-k8s.io/pool-name" )
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 is an annotation to be used for pausing a BMH. PausedAnnotationKey = "metal3.io/capm3" // ProviderIDPrefix is a prefix for ProviderID. ProviderIDPrefix = "metal3://" // ProviderLabelPrefix is a label prefix for ProviderID. ProviderLabelPrefix = "metal3.io/uuid" )
Variables ¶
var ( // Capm3FastTrack is the variable fetched from the CAPM3_FAST_TRACK environment variable. Capm3FastTrack = os.Getenv("CAPM3_FAST_TRACK") )
var (
EnableBMHNameBasedPreallocation bool
)
Functions ¶
Types ¶
type ClientGetter ¶
type ClientGetter func(ctx context.Context, c client.Client, cluster *clusterv1.Cluster) (clientcorev1.CoreV1Interface, error)
ClientGetter prototype.
type ClusterManager ¶
type ClusterManager struct { Cluster *clusterv1.Cluster Metal3Cluster *infrav1.Metal3Cluster Log logr.Logger // contains filtered or unexported fields }
ClusterManager is responsible for performing metal3 cluster reconciliation.
func (*ClusterManager) ControlPlaneEndpoint ¶
func (s *ClusterManager) ControlPlaneEndpoint() ([]infrav1.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(_ 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 *clusterv1.Cluster, metal3Cluster *infrav1.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 *infrav1.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 *infrav1.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
Reconcile handles Metal3Data events.
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 *infrav1.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 *infrav1.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 *clusterv1.Cluster) error
SetClusterOwnerRef sets ownerRef.
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
UpdateDatas handles the Metal3DataClaims and creates or deletes Metal3Data accordingly. It returns if there are still Data object and undeleted DataClaims objects.
type DataTemplateManagerInterface ¶ added in v0.4.0
type DataTemplateManagerInterface interface { SetFinalizer() UnsetFinalizer() SetClusterOwnerRef(*clusterv1.Cluster) error // UpdateDatas handles the Metal3DataClaims and creates or deletes Metal3Data accordingly. // It returns if there are still Data object and undeleted DataClaims objects. UpdateDatas(context.Context) (bool, bool, error) }
DataTemplateManagerInterface is an interface for a DataTemplateManager.
type MachineManager ¶
type MachineManager struct { Cluster *clusterv1.Cluster Metal3Cluster *infrav1.Metal3Cluster MachineList *clusterv1.MachineList Machine *clusterv1.Machine Metal3Machine *infrav1.Metal3Machine Metal3MachineTemplate *infrav1.Metal3MachineTemplate MachineSet *clusterv1.MachineSet MachineSetList *clusterv1.MachineSetList Log logr.Logger // contains filtered or unexported fields }
MachineManager is responsible for performing machine reconciliation.
func NewMachineManager ¶
func NewMachineManager(client client.Client, cluster *clusterv1.Cluster, metal3Cluster *infrav1.Metal3Cluster, machine *clusterv1.Machine, metal3machine *infrav1.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 *clusterv1.Machine, machineSetList *clusterv1.MachineSetList, 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
AssociateM3Metadata 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 Metal3Machine.
func (*MachineManager) DissociateM3Metadata ¶ added in v0.4.0
func (m *MachineManager) DissociateM3Metadata(ctx context.Context) error
DissociateM3Metadata removes 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 Metal3Machine 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) SetConditionMetal3MachineToFalse ¶ added in v1.1.0
func (m *MachineManager) SetConditionMetal3MachineToFalse(t clusterv1.ConditionType, reason string, severity clusterv1.ConditionSeverity, messageFormat string, messageArgs ...interface{})
SetConditionMetal3MachineToFalse sets Metal3Machine condition status to False.
func (*MachineManager) SetConditionMetal3MachineToTrue ¶ added in v1.1.0
func (m *MachineManager) SetConditionMetal3MachineToTrue(t clusterv1.ConditionType)
SetConditionMetal3MachineToTrue sets Metal3Machine condition status to True.
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, providerIDOnM3M *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 Metal3Machine.
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, ClientGetter) error SetProviderID(string) SetPauseAnnotation(context.Context) error RemovePauseAnnotation(context.Context) error DissociateM3Metadata(context.Context) error AssociateM3Metadata(context.Context) error SetError(string, capierrors.MachineStatusError) SetConditionMetal3MachineToFalse(clusterv1.ConditionType, string, clusterv1.ConditionSeverity, string, ...interface{}) SetConditionMetal3MachineToTrue(clusterv1.ConditionType) }
MachineManagerInterface is an interface for a MachineManager.
type MachineTemplateManager ¶ added in v0.5.0
type MachineTemplateManager struct { Metal3MachineList *infrav1.Metal3MachineList Metal3MachineTemplate *infrav1.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 *infrav1.Metal3MachineTemplate, metal3MachineList *infrav1.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 *clusterv1.Cluster, capm3Cluster *infrav1.Metal3Cluster, clusterLog logr.Logger) (ClusterManagerInterface, error)
NewClusterManager creates a new ClusterManager.
func (ManagerFactory) NewDataManager ¶ added in v0.4.0
func (f ManagerFactory) NewDataManager(metadata *infrav1.Metal3Data, metadataLog logr.Logger) (DataManagerInterface, error)
NewDataManager creates a new DataManager.
func (ManagerFactory) NewDataTemplateManager ¶ added in v0.4.0
func (f ManagerFactory) NewDataTemplateManager(metadata *infrav1.Metal3DataTemplate, metadataLog logr.Logger) (DataTemplateManagerInterface, error)
NewDataTemplateManager creates a new DataTemplateManager.
func (ManagerFactory) NewMachineManager ¶
func (f ManagerFactory) NewMachineManager(capiCluster *clusterv1.Cluster, capm3Cluster *infrav1.Metal3Cluster, capiMachine *clusterv1.Machine, capm3Machine *infrav1.Metal3Machine, machineLog logr.Logger) (MachineManagerInterface, error)
NewMachineManager creates a new MachineManager.
func (ManagerFactory) NewMachineTemplateManager ¶ added in v0.5.0
func (f ManagerFactory) NewMachineTemplateManager(capm3Template *infrav1.Metal3MachineTemplate, capm3MachineList *infrav1.Metal3MachineList, metadataLog logr.Logger) (TemplateManagerInterface, error)
NewMachineTemplateManager creates a new Metal3MachineTemplateManager.
func (ManagerFactory) NewRemediationManager ¶ added in v0.5.2
func (f ManagerFactory) NewRemediationManager(remediation *infrav1.Metal3Remediation, metal3machine *infrav1.Metal3Machine, machine *clusterv1.Machine, remediationLog logr.Logger) (RemediationManagerInterface, error)
NewRemediationManager creates a new RemediationManager.
type ManagerFactoryInterface ¶
type ManagerFactoryInterface interface { NewClusterManager(cluster *clusterv1.Cluster, metal3Cluster *infrav1.Metal3Cluster, clusterLog logr.Logger, ) (ClusterManagerInterface, error) NewMachineManager(*clusterv1.Cluster, *infrav1.Metal3Cluster, *clusterv1.Machine, *infrav1.Metal3Machine, logr.Logger, ) (MachineManagerInterface, error) NewDataTemplateManager(*infrav1.Metal3DataTemplate, logr.Logger) ( DataTemplateManagerInterface, error, ) NewDataManager(*infrav1.Metal3Data, logr.Logger) ( DataManagerInterface, error, ) NewMachineTemplateManager(capm3Template *infrav1.Metal3MachineTemplate, capm3MachineList *infrav1.Metal3MachineList, metadataLog logr.Logger, ) (TemplateManagerInterface, error) NewRemediationManager(*infrav1.Metal3Remediation, *infrav1.Metal3Machine, *clusterv1.Machine, logr.Logger) ( RemediationManagerInterface, error, ) }
ManagerFactoryInterface is a collection of new managers.
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 ReconcileError ¶ added in v1.4.2
func WithTerminalError ¶ added in v1.4.2
func WithTerminalError(err error) ReconcileError
WithTerminalError wraps the error in a ReconcileError with errorType as `Terminal`.
func WithTransientError ¶ added in v1.4.2
func WithTransientError(err error, requeueAfter time.Duration) ReconcileError
WithTransientError wraps the error in a ReconcileError with errorType as `Transient`.
func (ReconcileError) Error ¶ added in v1.4.2
func (e ReconcileError) Error() string
Error returns the error message for a ReconcileError.
func (ReconcileError) GetRequeueAfter ¶ added in v1.4.2
func (e ReconcileError) GetRequeueAfter() time.Duration
GetRequeueAfter gets the duration to wait until the managed object is requeued for further processing.
func (ReconcileError) IsTerminal ¶ added in v1.4.2
func (e ReconcileError) IsTerminal() bool
IsTerminal returns if the ReconcileError is non recoverable.
func (ReconcileError) IsTransient ¶ added in v1.4.2
func (e ReconcileError) IsTransient() bool
IsTransient returns if the ReconcileError is recoverable.
type ReconcileErrorType ¶ added in v1.4.2
type ReconcileErrorType string
ReconcileErrorType represents the type of a ReconcileError.
const ( // TransientErrorType can be recovered, will be requeued after a configured time interval. TransientErrorType ReconcileErrorType = "Transient" // TerminalErrorType cannot be recovered, will not be requeued. TerminalErrorType ReconcileErrorType = "Terminal" )
type RemediationManager ¶ added in v0.5.2
type RemediationManager struct { Client client.Client CapiClientGetter ClientGetter Metal3Remediation *infrav1.Metal3Remediation Metal3Machine *infrav1.Metal3Machine Machine *clusterv1.Machine Log logr.Logger }
RemediationManager is responsible for performing remediation reconciliation.
func NewRemediationManager ¶ added in v0.5.2
func NewRemediationManager(client client.Client, capiClientGetter ClientGetter, metal3remediation *infrav1.Metal3Remediation, metal3Machine *infrav1.Metal3Machine, machine *clusterv1.Machine, remediationLog logr.Logger) (*RemediationManager, error)
NewRemediationManager returns a new helper for managing a Metal3Remediation object.
func (*RemediationManager) AddOutOfServiceTaint ¶ added in v1.8.0
func (r *RemediationManager) AddOutOfServiceTaint(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error
func (*RemediationManager) DeleteNode ¶ added in v1.1.3
func (r *RemediationManager) DeleteNode(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error
DeleteNode deletes the given node.
func (*RemediationManager) GetCapiMachine ¶ added in v0.5.2
GetCapiMachine returns CAPI machine object owning the current resource.
func (*RemediationManager) GetClusterClient ¶ added in v1.1.3
func (r *RemediationManager) GetClusterClient(ctx context.Context) (v1.CoreV1Interface, error)
GetClusterClient returns the client for interacting with the target cluster.
func (*RemediationManager) GetLastRemediatedTime ¶ added in v0.5.2
func (r *RemediationManager) GetLastRemediatedTime() *metav1.Time
GetLastRemediatedTime returns last remediation time.
func (*RemediationManager) GetNode ¶ added in v1.1.3
func (r *RemediationManager) GetNode(ctx context.Context, clusterClient v1.CoreV1Interface) (*corev1.Node, error)
GetNode returns the Node associated with the machine in the current context.
func (*RemediationManager) GetNodeBackupAnnotations ¶ added in v1.1.3
func (r *RemediationManager) GetNodeBackupAnnotations() (annotations, labels string)
GetNodeBackupAnnotations gets the stringified annotations and labels from the remediation annotations.
func (*RemediationManager) GetRemediationPhase ¶ added in v0.5.2
func (r *RemediationManager) GetRemediationPhase() string
GetRemediationPhase returns current status of the remediation.
func (*RemediationManager) GetRemediationType ¶ added in v0.5.2
func (r *RemediationManager) GetRemediationType() infrav1.RemediationType
GetRemediationType return type of remediation strategy.
func (*RemediationManager) GetTimeout ¶ added in v0.5.2
func (r *RemediationManager) GetTimeout() *metav1.Duration
GetTimeout returns timeout duration from remediation request Spec.
func (*RemediationManager) GetUnhealthyHost ¶ added in v0.5.2
func (r *RemediationManager) GetUnhealthyHost(ctx context.Context) (*bmov1alpha1.BareMetalHost, *patch.Helper, error)
GetUnhealthyHost gets the associated host for unhealthy machine. Returns nil if not found. Assumes the host is in the same namespace as the unhealthy machine.
func (*RemediationManager) HasFinalizer ¶ added in v1.1.3
func (r *RemediationManager) HasFinalizer() bool
HasFinalizer returns if finalizer is set.
func (*RemediationManager) HasOutOfServiceTaint ¶ added in v1.8.0
func (r *RemediationManager) HasOutOfServiceTaint(node *corev1.Node) bool
func (*RemediationManager) HasReachRetryLimit ¶ added in v0.5.2
func (r *RemediationManager) HasReachRetryLimit() bool
HasReachRetryLimit returns true if retryLimit is reached.
func (*RemediationManager) IncreaseRetryCount ¶ added in v0.5.2
func (r *RemediationManager) IncreaseRetryCount()
IncreaseRetryCount increases the retry count on Status.
func (*RemediationManager) IsNodeDrained ¶ added in v1.8.0
func (r *RemediationManager) IsNodeDrained(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) bool
func (*RemediationManager) IsPowerOffRequested ¶ added in v1.1.3
func (r *RemediationManager) IsPowerOffRequested(ctx context.Context) (bool, error)
IsPowerOffRequested returns true if poweroff annotation is set.
func (*RemediationManager) IsPoweredOn ¶ added in v1.1.3
func (r *RemediationManager) IsPoweredOn(ctx context.Context) (bool, error)
IsPoweredOn returns true if the host is powered on.
func (*RemediationManager) OnlineStatus ¶ added in v0.5.2
func (r *RemediationManager) OnlineStatus(host *bmov1alpha1.BareMetalHost) bool
OnlineStatus returns hosts Online field value.
func (*RemediationManager) RemoveNodeBackupAnnotations ¶ added in v1.1.3
func (r *RemediationManager) RemoveNodeBackupAnnotations()
RemoveNodeBackupAnnotations removes the node backup annotation from the remediation resource.
func (*RemediationManager) RemoveOutOfServiceTaint ¶ added in v1.8.0
func (r *RemediationManager) RemoveOutOfServiceTaint(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error
func (*RemediationManager) RemovePowerOffAnnotation ¶ added in v1.1.3
func (r *RemediationManager) RemovePowerOffAnnotation(ctx context.Context) error
RemovePowerOffAnnotation removes poweroff annotation from unhealthy host.
func (*RemediationManager) RetryLimitIsSet ¶ added in v0.5.2
func (r *RemediationManager) RetryLimitIsSet() bool
RetryLimitIsSet returns true if retryLimit is set, false if not.
func (*RemediationManager) SetFinalizer ¶ added in v0.5.2
func (r *RemediationManager) SetFinalizer()
SetFinalizer sets finalizer. Return if it was set.
func (*RemediationManager) SetLastRemediationTime ¶ added in v0.5.2
func (r *RemediationManager) SetLastRemediationTime(remediationTime *metav1.Time)
SetLastRemediationTime setting last remediation timestamp on Status.
func (*RemediationManager) SetNodeBackupAnnotations ¶ added in v1.1.3
func (r *RemediationManager) SetNodeBackupAnnotations(annotations string, labels string) bool
SetNodeBackupAnnotations sets the given node annotations and labels as remediation annotations. Returns whether annotations were set or modified, or not.
func (*RemediationManager) SetOwnerRemediatedConditionNew ¶ added in v0.5.2
func (r *RemediationManager) SetOwnerRemediatedConditionNew(ctx context.Context) error
SetOwnerRemediatedConditionNew sets MachineOwnerRemediatedCondition on CAPI machine object that have failed a healthcheck.
func (*RemediationManager) SetPowerOffAnnotation ¶ added in v1.1.3
func (r *RemediationManager) SetPowerOffAnnotation(ctx context.Context) error
SetPowerOffAnnotation sets poweroff annotation on unhealthy host.
func (*RemediationManager) SetRemediationPhase ¶ added in v0.5.2
func (r *RemediationManager) SetRemediationPhase(phase string)
SetRemediationPhase setting the state of the remediation.
func (*RemediationManager) SetUnhealthyAnnotation ¶ added in v0.5.2
func (r *RemediationManager) SetUnhealthyAnnotation(ctx context.Context) error
SetUnhealthyAnnotation sets capm3.UnhealthyAnnotation on unhealthy host.
func (*RemediationManager) TimeToRemediate ¶ added in v0.5.2
TimeToRemediate checks if it is time to execute a next remediation step and returns seconds to next remediation time.
func (*RemediationManager) UnsetFinalizer ¶ added in v0.5.2
func (r *RemediationManager) UnsetFinalizer()
UnsetFinalizer unsets finalizer.
func (*RemediationManager) UpdateNode ¶ added in v1.1.3
func (r *RemediationManager) UpdateNode(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error
UpdateNode updates the given node.
type RemediationManagerInterface ¶ added in v0.5.2
type RemediationManagerInterface interface { SetFinalizer() UnsetFinalizer() HasFinalizer() bool TimeToRemediate(timeout time.Duration) (bool, time.Duration) SetPowerOffAnnotation(ctx context.Context) error RemovePowerOffAnnotation(ctx context.Context) error IsPowerOffRequested(ctx context.Context) (bool, error) IsPoweredOn(ctx context.Context) (bool, error) SetUnhealthyAnnotation(ctx context.Context) error GetUnhealthyHost(ctx context.Context) (*bmov1alpha1.BareMetalHost, *patch.Helper, error) OnlineStatus(host *bmov1alpha1.BareMetalHost) bool GetRemediationType() infrav1.RemediationType RetryLimitIsSet() bool HasReachRetryLimit() bool SetRemediationPhase(phase string) GetRemediationPhase() string GetLastRemediatedTime() *metav1.Time SetLastRemediationTime(remediationTime *metav1.Time) GetTimeout() *metav1.Duration IncreaseRetryCount() SetOwnerRemediatedConditionNew(ctx context.Context) error GetCapiMachine(ctx context.Context) (*clusterv1.Machine, error) GetNode(ctx context.Context, clusterClient v1.CoreV1Interface) (*corev1.Node, error) UpdateNode(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error DeleteNode(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error GetClusterClient(ctx context.Context) (v1.CoreV1Interface, error) SetNodeBackupAnnotations(annotations string, labels string) bool GetNodeBackupAnnotations() (annotations, labels string) RemoveNodeBackupAnnotations() AddOutOfServiceTaint(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error RemoveOutOfServiceTaint(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) error HasOutOfServiceTaint(node *corev1.Node) bool IsNodeDrained(ctx context.Context, clusterClient v1.CoreV1Interface, node *corev1.Node) bool }
RemediationManagerInterface is an interface for a RemediationManager.
type TemplateManagerInterface ¶ added in v0.5.0
TemplateManagerInterface is an interface for a TemplateManager.