Documentation
¶
Index ¶
- Constants
- Variables
- func FindStatusRemediation(node *corev1.Node, nhc *remediationv1alpha1.NodeHealthCheck, ...) *remediationv1alpha1.Remediation
- func IsOwner(remediationCR *unstructured.Unstructured, owner client.Object) bool
- func UpdateStatusNodeConditionsHealthy(nodeName string, nhc *remediationv1alpha1.NodeHealthCheck, now time.Time) *time.Time
- func UpdateStatusNodeDelayedHealthy(nodeName string, nhc *remediationv1alpha1.NodeHealthCheck, ...)
- func UpdateStatusNodeHealthy(nodeName string, nhc *remediationv1alpha1.NodeHealthCheck)
- func UpdateStatusNodeUnhealthy(node *corev1.Node, nhc *remediationv1alpha1.NodeHealthCheck)
- func UpdateStatusRemediationStarted(node *corev1.Node, nhc *remediationv1alpha1.NodeHealthCheck, ...)
- type LeaseManager
- type LeaseOverDueError
- type Manager
- type NoTemplateLeftError
- type RemediationCRNotOwned
- type Target
- type WatchManager
Constants ¶
View Source
const ( HealthyDelayContextKey = "healthyDelay" // RemediationHealthyDelayAnnotationKey annotation storing the time in minutes to postponed node regaining health RemediationHealthyDelayAnnotationKey = "remediation.medik8s.io/healthy-delay" // RemediationManuallyConfirmedHealthyAnnotationKey annotation is placed by the user on the node to indelicate a node is healthy, it's relevant when Healthy Delay is applied RemediationManuallyConfirmedHealthyAnnotationKey = "remediation.medik8s.io/manually-confirmed-healthy" )
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 UpdateStatusNodeDelayedHealthy ¶ added in v0.10.0
func UpdateStatusNodeDelayedHealthy(nodeName string, nhc *remediationv1alpha1.NodeHealthCheck, remediationCRs []unstructured.Unstructured)
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
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, nodeName string) (*unstructured.Unstructured, error)
CreateRemediationCR(remediationCR *unstructured.Unstructured, owner client.Object, nodeName *string, currentRemediationDuration, previousRemediationsDuration time.Duration) (bool, *time.Duration, *unstructured.Unstructured, 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, *time.Duration, error)
CleanUp(nodeName string, isManuallyConfirmedHealthy bool) error
}
func NewManager ¶
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
}
type WatchManager ¶ added in v0.10.0
type WatchManager interface {
AddWatchesNhc(rm Manager, nhc *v1alpha1.NodeHealthCheck) error
AddWatchesMhc(rm Manager, mhc *v1beta1.MachineHealthCheck) error
SetController(controller.Controller)
}
func NewWatchManager ¶ added in v0.10.0
NewWatchManager creates a new instance of WatchManager.
Click to show internal directories.
Click to hide internal directories.