Documentation
¶
Index ¶
- Constants
- Variables
- func GetAllRemediationTemplates(healthCheck client.Object) []*v1.ObjectReference
- func GetDeploymentNamespace() (string, error)
- func GetLogWithNHC(log logr.Logger, nhc *v1alpha1.NodeHealthCheck) logr.Logger
- func GetMachineNamespaceName(node *v1.Node) (namespace, name string, err error)
- func GetNodeNameFromCR(cr unstructured.Unstructured) string
- func GetOwningDeployment(ctx context.Context, cl client.Client, namespace, podName string) (*appsv1.Deployment, error)
- func GetPodName() (string, error)
- func GetRemediationDuration(nhc *v1alpha1.NodeHealthCheck, remediationCR *unstructured.Unstructured) (currentRemediationDuration, previousRemediationsDuration time.Duration)
- func GetTemplateNameFromCR(cr unstructured.Unstructured) string
- func IsConditionFalseWithReason(conditions []metav1.Condition, conditionType string, reason string) bool
- func IsConditionSet(conditions []metav1.Condition, conditionType string) bool
- func IsConditionTrue(conditions []metav1.Condition, conditionType string) bool
- func IsConditionTrueWithReason(conditions []metav1.Condition, conditionType string, reason string) bool
- func IsHealthyMHC(unhealthyConditions []v1beta1.UnhealthyCondition, ...) (bool, *time.Duration)
- func IsHealthyNHC(unhealthyConditions []remediationv1alpha1.UnhealthyCondition, ...) (bool, *time.Duration)
- func MHCByFeatureGateEventMapperFunc(c client.Client, logger logr.Logger, featureGates featuregates.Accessor) handler.MapFunc
- func MHCByMachineMapperFunc(c client.Client, logger logr.Logger, featureGates featuregates.Accessor) handler.MapFunc
- func MHCByNodeMapperFunc(c client.Client, logger logr.Logger, featureGates featuregates.Accessor) handler.MapFunc
- func MHCByRemediationTemplateCRMapperFunc(c client.Client, logger logr.Logger) handler.MapFunc
- func MinRequeueDuration(old, new *time.Duration) *time.Duration
- func NHCByMHCEventMapperFunc(c client.Client, logger logr.Logger) handler.MapFunc
- func NHCByNodeMapperFunc(c client.Client, logger logr.Logger) handler.MapFunc
- func NHCByRemediationTemplateCRMapperFunc(c client.Client, logger logr.Logger) handler.MapFunc
- func RemediationCRMapperFunc(logger logr.Logger, watchType WatchType) handler.MapFunc
- func SetMachineCondition(mhc *v1beta1.MachineHealthCheck, condition *v1beta1.Condition)
- type WatchType
Constants ¶
const ( EventReasonDetectedUnhealthy = "DetectedUnhealthy" EventReasonRemediationCreated = "RemediationCreated" EventReasonRemediationSkipped = "RemediationSkipped" EventReasonRemediationRemoved = "RemediationRemoved" EventReasonInvalidNodeLabel = "InvalidNodeLabel" EventReasonDisabled = "Disabled" EventReasonEnabled = "Enabled" )
const (
MachineNodeNameIndex = "machineNodeNameIndex"
)
Variables ¶
var ( // DefaultRemediationDuration is used for node lease calculations for remediations without configured timeout DefaultRemediationDuration = 10 * time.Minute )
var MachineAnnotationNotFoundError = errors.New("machine annotation not found")
MachineAnnotationNotFoundError indicates that in GetMachineNsName the machine annotation wasn't found on the given node
Functions ¶
func GetAllRemediationTemplates ¶
func GetAllRemediationTemplates(healthCheck client.Object) []*v1.ObjectReference
GetAllRemediationTemplates returns a slice of all ObjectReferences used as RemedediationTemplate in the given NodeHealthCheck
func GetDeploymentNamespace ¶
GetDeploymentNamespace returns the Namespace this operator is deployed on.
func GetLogWithNHC ¶
GetLogWithNHC return a logger with NHC namespace and name
func GetMachineNamespaceName ¶
GetMachineNamespaceName returns machine namespace and name of the given Node. Returns MachineAnnotationNotFoundError in case the needed annotation doesn't exist on the given node
func GetNodeNameFromCR ¶
func GetNodeNameFromCR(cr unstructured.Unstructured) string
GetNodeNameFromCR returns the node name from the given CR. If the CR has a nodeName annotation, it will return its value, otherwise it will return the CR name.
func GetOwningDeployment ¶
func GetOwningDeployment(ctx context.Context, cl client.Client, namespace, podName string) (*appsv1.Deployment, error)
GetOwningDeployment walks the ownership chain from the current pod to find its controlling Deployment. It follows the chain: Pod → ReplicaSet → Deployment. Returns a specific error for the step in the ownership chain that cannot be resolved.
func GetPodName ¶
GetPodName returns the name of the pod this operator is running in.
func GetRemediationDuration ¶
func GetRemediationDuration(nhc *v1alpha1.NodeHealthCheck, remediationCR *unstructured.Unstructured) (currentRemediationDuration, previousRemediationsDuration time.Duration)
GetRemediationDuration returns the expected remediation duration for the given CR, and all previous used templates
func GetTemplateNameFromCR ¶
func GetTemplateNameFromCR(cr unstructured.Unstructured) string
GetTemplateNameFromCR returns the template name from the given CR, if set.
func IsConditionFalseWithReason ¶
func IsConditionFalseWithReason(conditions []metav1.Condition, conditionType string, reason string) bool
IsConditionFalseWithReason return true when the conditions contain a condition of given type and reason with status false, this isn't the logical opposite of IsConditionTrueWithReason because the condition is expected to be set with a false status.
func IsConditionSet ¶
IsConditionSet return true when the conditions contain a condition of given type
func IsConditionTrue ¶
IsConditionTrue returns true when the conditions contain a condition of given type with status true, regardless of reason
func IsConditionTrueWithReason ¶
func IsConditionTrueWithReason(conditions []metav1.Condition, conditionType string, reason string) bool
IsConditionTrueWithReason return true when the conditions contain a condition of given type and reason with status true
func IsHealthyMHC ¶
func IsHealthyMHC(unhealthyConditions []v1beta1.UnhealthyCondition, nodeConditions []corev1.NodeCondition, now time.Time) (bool, *time.Duration)
func IsHealthyNHC ¶
func IsHealthyNHC(unhealthyConditions []remediationv1alpha1.UnhealthyCondition, nodeConditions []corev1.NodeCondition, now time.Time) (bool, *time.Duration)
func MHCByFeatureGateEventMapperFunc ¶
func MHCByFeatureGateEventMapperFunc(c client.Client, logger logr.Logger, featureGates featuregates.Accessor) handler.MapFunc
MHCByFeatureGateEventMapperFunc return the FeatureGateEvent-to-NHC mapper function
func MHCByMachineMapperFunc ¶
func MHCByMachineMapperFunc(c client.Client, logger logr.Logger, featureGates featuregates.Accessor) handler.MapFunc
MHCByMachineMapperFunc return the Machine-to-MHC mapper function
func MHCByNodeMapperFunc ¶
func MHCByNodeMapperFunc(c client.Client, logger logr.Logger, featureGates featuregates.Accessor) handler.MapFunc
MHCByNodeMapperFunc return the Node-to-MHC mapper function
func MHCByRemediationTemplateCRMapperFunc ¶
MHCByRemediationTemplateCRMapperFunc return the RemediationTemplateCR-to-MHC mapper function
func MinRequeueDuration ¶
MinRequeueDuration returns the minimal valid requeue duration
func NHCByMHCEventMapperFunc ¶
NHCByMHCEventMapperFunc return the MHC-event-to-NHC mapper function
func NHCByNodeMapperFunc ¶
NHCByNodeMapperFunc return the Node-to-NHC mapper function
func NHCByRemediationTemplateCRMapperFunc ¶
NHCByRemediationTemplateCRMapperFunc return the RemediationTemplateCR-to-NHC mapper function
func RemediationCRMapperFunc ¶
RemediationCRMapperFunc return the RemediationCR-to-NHC/MHC mapper function
func SetMachineCondition ¶
func SetMachineCondition(mhc *v1beta1.MachineHealthCheck, condition *v1beta1.Condition)