resources

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 23 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
	//DefaultLeaseDuration is the default time lease would be held before it would need extending assuming escalation timeout does not exist (i.e. without escalation)
	DefaultLeaseDuration = 10 * 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 UpdateStatusNodeConditionsHealthy added in v0.6.0

func UpdateStatusNodeConditionsHealthy(node *corev1.Node, nhc *remediationv1alpha1.NodeHealthCheck, now time.Time) *time.Time

func UpdateStatusNodeHealthy

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

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(remediationCR *unstructured.Unstructured, nhc *remediationv1alpha1.NodeHealthCheck) (*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, remediationCR *unstructured.Unstructured, nhc *remediationv1alpha1.NodeHealthCheck) (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, nhc *remediationv1alpha1.NodeHealthCheck, 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)
	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
	GenerateRemediationCR(node *corev1.Node, nhc *remediationv1alpha1.NodeHealthCheck, template *unstructured.Unstructured) (*unstructured.Unstructured, error)
	CreateRemediationCR(remediationCR *unstructured.Unstructured, nhc *remediationv1alpha1.NodeHealthCheck) (bool, *time.Duration, error)
	DeleteRemediationCR(remediationCR *unstructured.Unstructured, nhc *remediationv1alpha1.NodeHealthCheck) (bool, error)
	UpdateRemediationCR(remediationCR *unstructured.Unstructured) error
	ListRemediationCRs(nhc *remediationv1alpha1.NodeHealthCheck, remediationCRFilter func(r unstructured.Unstructured) bool) ([]unstructured.Unstructured, error)
	GetNodes(labelSelector metav1.LabelSelector) ([]corev1.Node, error)
	HandleHealthyNode(nodeName string, nhc *remediationv1alpha1.NodeHealthCheck, recorder record.EventRecorder) error
}

func NewManager

func NewManager(c client.Client, ctx context.Context, log logr.Logger, onOpenshift bool, leaseManager LeaseManager) 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

Jump to

Keyboard shortcuts

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