resources

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	//LeaseBuffer is used to make sure we have a bit of buffer before extending the lease, so it won't be taken by another component
	LeaseBuffer         = time.Minute
	RequeueIfLeaseTaken = time.Minute
)

Functions

func FindStatusRemediation

func FindStatusRemediation(node *corev1.Node, nhc *remediationv1alpha1.NodeHealthCheck, remediationFilter func(r *remediationv1alpha1.Remediation) bool) *remediationv1alpha1.Remediation

FindStatusRemediation return the first remediation in the NHC's status for the given node which matches the remediationFilter

func IsOwner added in v0.6.0

func IsOwner(remediationCR *unstructured.Unstructured, owner client.Object) bool

func UpdateStatusNodeConditionsHealthy added in v0.6.0

func UpdateStatusNodeConditionsHealthy(nodeName string, nhc *remediationv1alpha1.NodeHealthCheck, now time.Time) *time.Time

func UpdateStatusNodeHealthy

func UpdateStatusNodeHealthy(nodeName string, nhc *remediationv1alpha1.NodeHealthCheck)

func UpdateStatusNodeUnhealthy added in v0.6.0

func UpdateStatusNodeUnhealthy(node *corev1.Node, nhc *remediationv1alpha1.NodeHealthCheck)

func UpdateStatusRemediationStarted

func UpdateStatusRemediationStarted(node *corev1.Node, nhc *remediationv1alpha1.NodeHealthCheck, remediationCR *unstructured.Unstructured)

Types

type LeaseManager added in v0.6.0

type LeaseManager interface {
	// ObtainNodeLease will attempt to get a node lease with the correct duration, the duration is affected by whether escalation is used and the remediation timeOut.
	//The first return value (*time.Duration) is an indicator on when a new reconcile should be scheduled (mainly in order to extend the lease)
	ObtainNodeLease(ctx context.Context, nodeName string, currentRemediationDuration time.Duration) (*time.Duration, error)
	//ManageLease extends or releases a lease based on the CR status, type of remediation and how long the lease is already leased
	ManageLease(ctx context.Context, nodeName string, currentRemediationDuration, previousRemediationsDuration time.Duration) (time.Duration, error)
	// InvalidateLease invalidates the lease for the node with the given name
	InvalidateLease(ctx context.Context, nodeName string) error
}

func NewLeaseManager added in v0.6.0

func NewLeaseManager(client client.Client, holderIdent string, log logr.Logger) (LeaseManager, error)

type LeaseOverDueError added in v0.6.0

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

func (LeaseOverDueError) Error added in v0.6.0

func (e LeaseOverDueError) Error() string

type Manager

type Manager interface {
	GetCurrentTemplateWithTimeout(node *corev1.Node, nhc *remediationv1alpha1.NodeHealthCheck) (*unstructured.Unstructured, *time.Duration, error)
	GetTemplate(mhc *machinev1beta1.MachineHealthCheck) (*unstructured.Unstructured, error)
	GenerateTemplate(reference *corev1.ObjectReference) *unstructured.Unstructured
	ValidateTemplates(nhc *remediationv1alpha1.NodeHealthCheck) (valid bool, reason string, message string, err error)
	GenerateRemediationCRBase(gvk schema.GroupVersionKind) *unstructured.Unstructured
	GenerateRemediationCRBaseNamed(gvk schema.GroupVersionKind, namespace string, name string) *unstructured.Unstructured
	GenerateRemediationCRForNode(node *corev1.Node, owner client.Object, template *unstructured.Unstructured) (*unstructured.Unstructured, error)
	GenerateRemediationCRForMachine(machine *machinev1beta1.Machine, owner client.Object, template *unstructured.Unstructured) (*unstructured.Unstructured, error)
	CreateRemediationCR(remediationCR *unstructured.Unstructured, owner client.Object, nodeName *string, currentRemediationDuration, previousRemediationsDuration time.Duration) (bool, *time.Duration, error)
	DeleteRemediationCR(remediationCR *unstructured.Unstructured, owner client.Object) (bool, error)
	UpdateRemediationCR(remediationCR *unstructured.Unstructured) error
	ListRemediationCRs(remediationTemplates []*corev1.ObjectReference, remediationCRFilter func(r unstructured.Unstructured) bool) ([]unstructured.Unstructured, error)
	GetNodes(labelSelector metav1.LabelSelector) ([]corev1.Node, error)
	GetMHCTargets(mhc *machinev1beta1.MachineHealthCheck) ([]Target, error)
	HandleHealthyNode(nodeName string, crName string, owner client.Object) ([]unstructured.Unstructured, error)
	CleanUp(nodeName string) error
}

func NewManager

func NewManager(c client.Client, ctx context.Context, log logr.Logger, onOpenshift bool, leaseManager LeaseManager, recorder record.EventRecorder) Manager

type NoTemplateLeftError

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

func (NoTemplateLeftError) Error

func (nt NoTemplateLeftError) Error() string

type RemediationCRNotOwned

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

func (RemediationCRNotOwned) Error

func (r RemediationCRNotOwned) Error() string

type Target added in v0.7.0

type Target struct {
	Machine *machinev1beta1.Machine
	Node    *corev1.Node
	MHC     *machinev1beta1.MachineHealthCheck
}

func (*Target) String added in v0.7.0

func (t *Target) String() string

Jump to

Keyboard shortcuts

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