Documentation ¶
Index ¶
- Constants
- type ManagerFactory
- type ManagerFactoryInterface
- type RemediationManager
- func (r *RemediationManager) CanReprovision(ctx context.Context) (bool, error)
- func (r *RemediationManager) DeleteMachine(ctx context.Context) error
- func (r *RemediationManager) DeleteNode(ctx context.Context, node *corev1.Node) error
- func (r *RemediationManager) GetLastRemediatedTime() *metav1.Time
- func (r *RemediationManager) GetNode(ctx context.Context) (*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) HasReachRetryLimit() bool
- func (r *RemediationManager) IncreaseRetryCount()
- 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) 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) 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, node *corev1.Node) error
- type RemediationManagerInterface
Constants ¶
const ( // HostAnnotation is the key for an annotation that should go on a Metal3Machine to // reference what BareMetalHost it corresponds to. HostAnnotation = "metal3.io/BareMetalHost" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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) NewRemediationManager ¶
func (f ManagerFactory) NewRemediationManager(remediation *infrav1.Metal3Remediation, ocpMachine *machinev1beta1.Machine, remediationLog logr.Logger) (RemediationManagerInterface, error)
NewRemediationManager creates a new RemediationManager.
type ManagerFactoryInterface ¶
type ManagerFactoryInterface interface { NewRemediationManager(*infrav1.Metal3Remediation, *machinev1beta1.Machine, logr.Logger) ( RemediationManagerInterface, error, ) }
ManagerFactoryInterface is a collection of new managers.
type RemediationManager ¶
type RemediationManager struct { Client client.Client Metal3Remediation *infrav1.Metal3Remediation OCPMachine *machinev1beta1.Machine Log logr.Logger }
RemediationManager is responsible for performing remediation reconciliation.
func NewRemediationManager ¶
func NewRemediationManager(client client.Client, metal3remediation *infrav1.Metal3Remediation, ocpMachine *machinev1beta1.Machine, remediationLog logr.Logger) (*RemediationManager, error)
NewRemediationManager returns a new helper for managing a Metal3Remediation object.
func (*RemediationManager) CanReprovision ¶
func (r *RemediationManager) CanReprovision(ctx context.Context) (bool, error)
func (*RemediationManager) DeleteMachine ¶
func (r *RemediationManager) DeleteMachine(ctx context.Context) error
func (*RemediationManager) DeleteNode ¶
DeleteNode deletes the given node.
func (*RemediationManager) GetLastRemediatedTime ¶
func (r *RemediationManager) GetLastRemediatedTime() *metav1.Time
GetLastRemediatedTime returns last remediation time.
func (*RemediationManager) GetNode ¶
GetNode returns the Node associated with the machine in the current context.
func (*RemediationManager) GetNodeBackupAnnotations ¶
func (r *RemediationManager) GetNodeBackupAnnotations() (annotations, labels string)
GetNodeBackupAnnotations gets the stringified annotations and labels from the remediation annotations.
func (*RemediationManager) GetRemediationPhase ¶
func (r *RemediationManager) GetRemediationPhase() string
GetRemediationPhase returns current status of the remediation.
func (*RemediationManager) GetRemediationType ¶
func (r *RemediationManager) GetRemediationType() infrav1.RemediationType
GetRemediationType return type of remediation strategy.
func (*RemediationManager) GetTimeout ¶
func (r *RemediationManager) GetTimeout() *metav1.Duration
GetTimeout returns timeout duration from remediation request Spec.
func (*RemediationManager) GetUnhealthyHost ¶
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 ¶
func (r *RemediationManager) HasFinalizer() bool
HasFinalizer returns if finalizer is set.
func (*RemediationManager) HasReachRetryLimit ¶
func (r *RemediationManager) HasReachRetryLimit() bool
HasReachRetryLimit returns true if retryLimit is reached.
func (*RemediationManager) IncreaseRetryCount ¶
func (r *RemediationManager) IncreaseRetryCount()
IncreaseRetryCount increases the retry count on Status.
func (*RemediationManager) IsPowerOffRequested ¶
func (r *RemediationManager) IsPowerOffRequested(ctx context.Context) (bool, error)
IsPowerOffRequested returns true if poweroff annotation is set.
func (*RemediationManager) IsPoweredOn ¶
func (r *RemediationManager) IsPoweredOn(ctx context.Context) (bool, error)
IsPoweredOn returns true if the host is powered on.
func (*RemediationManager) OnlineStatus ¶
func (r *RemediationManager) OnlineStatus(host *bmov1alpha1.BareMetalHost) bool
OnlineStatus returns hosts Online field value.
func (*RemediationManager) RemoveNodeBackupAnnotations ¶
func (r *RemediationManager) RemoveNodeBackupAnnotations()
RemoveNodeBackupAnnotations removes the node backup annotation from the remediation resource.
func (*RemediationManager) RemovePowerOffAnnotation ¶
func (r *RemediationManager) RemovePowerOffAnnotation(ctx context.Context) error
RemovePowerOffAnnotation removes poweroff annotation from unhealthy host.
func (*RemediationManager) RetryLimitIsSet ¶
func (r *RemediationManager) RetryLimitIsSet() bool
RetryLimitIsSet returns true if retryLimit is set, false if not.
func (*RemediationManager) SetFinalizer ¶
func (r *RemediationManager) SetFinalizer()
SetFinalizer sets finalizer. Return if it was set.
func (*RemediationManager) SetLastRemediationTime ¶
func (r *RemediationManager) SetLastRemediationTime(remediationTime *metav1.Time)
SetLastRemediationTime setting last remediation timestamp on Status.
func (*RemediationManager) SetNodeBackupAnnotations ¶
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) SetPowerOffAnnotation ¶
func (r *RemediationManager) SetPowerOffAnnotation(ctx context.Context) error
SetPowerOffAnnotation sets poweroff annotation on unhealthy host.
func (*RemediationManager) SetRemediationPhase ¶
func (r *RemediationManager) SetRemediationPhase(phase string)
SetRemediationPhase setting the state of the remediation.
func (*RemediationManager) SetUnhealthyAnnotation ¶
func (r *RemediationManager) SetUnhealthyAnnotation(ctx context.Context) error
SetUnhealthyAnnotation sets capm3.UnhealthyAnnotation on unhealthy host.
func (*RemediationManager) TimeToRemediate ¶
TimeToRemediate checks if it is time to execute a next remediation step and returns seconds to next remediation time.
func (*RemediationManager) UnsetFinalizer ¶
func (r *RemediationManager) UnsetFinalizer()
UnsetFinalizer unsets finalizer.
func (*RemediationManager) UpdateNode ¶
UpdateNode updates the given node.
type RemediationManagerInterface ¶
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() GetNode(ctx context.Context) (*corev1.Node, error) UpdateNode(ctx context.Context, node *corev1.Node) error DeleteNode(ctx context.Context, node *corev1.Node) error SetNodeBackupAnnotations(annotations string, labels string) bool GetNodeBackupAnnotations() (annotations, labels string) RemoveNodeBackupAnnotations() CanReprovision(context.Context) (bool, error) DeleteMachine(ctx context.Context) error }
RemediationManagerInterface is an interface for a RemediationManager.