utils

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IsRebootCapableAnnotation value is the key name for the node's annotation that will determine if node is reboot capable
	IsRebootCapableAnnotation = "is-reboot-capable.self-node-remediation.medik8s.io"
	// WatchdogTimeoutSecondsAnnotation value is the key name for the node's annotation that will hold the watchdog timeout in seconds
	WatchdogTimeoutSecondsAnnotation = "self-node-remediation.medik8s.io/watchdog-timeout"
	IsSoftwareRebootEnabledEnvVar    = "IS_SOFTWARE_REBOOT_ENABLED"
)
View Source
const (
	MinNrOfNodesInBatch      = 3
	MaxNrOfBatchesAfterFirst = 10
)

Variables

View Source
var (

	//IsOutOfServiceTaintSupported will be set to true in case OutOfServiceTaint is supported (k8s 1.26 or higher)
	IsOutOfServiceTaintSupported bool
	//IsOutOfServiceTaintGA will be set to true in case OutOfServiceTaint is GA (k8s 1.28 or higher)
	IsOutOfServiceTaintGA bool
)

Functions

func DeleteTaint

func DeleteTaint(taints []v1.Taint, taintToDelete *v1.Taint) ([]v1.Taint, bool)

DeleteTaint removes all the taints that have the same key and effect to given taintToDelete.

func GetDeploymentNamespace

func GetDeploymentNamespace() (string, error)

GetDeploymentNamespace returns the Namespace this operator is deployed on.

func GetLinuxUptime

func GetLinuxUptime() (time.Duration, error)

GetLinuxUptime returns the uptime of a linux host

func GetNextBatchSize added in v0.9.0

func GetNextBatchSize(totalNrOfNodes, remainingNrOfNodes int) int

GetNextBatchSize returns the number of nodes to ask in the next batch

func GetNrOfBatches added in v0.9.0

func GetNrOfBatches(totalNrOfNodes int) int

GetNrOfBatches returns the number of batches we need for the given total number of nodes

func GetSelfNodeRemediationAgentPod

func GetSelfNodeRemediationAgentPod(nodeName string, r client.Reader) (*v1.Pod, error)

func GetWatchdogTimeout added in v0.9.0

func GetWatchdogTimeout(node *v1.Node) (time.Duration, error)

func InitOutOfServiceTaintFlagsWithRetry added in v0.10.0

func InitOutOfServiceTaintFlagsWithRetry(ctx context.Context, config *rest.Config) error

InitOutOfServiceTaintFlagsWithRetry tries to initialize the OutOfService flags based on k8s version, in case it fails (potentially due to network issues) it will retry for a limited number of times

func IsSoftwareRebootEnabled

func IsSoftwareRebootEnabled() (bool, error)

func TaintExists

func TaintExists(taints []v1.Taint, taintToFind *v1.Taint) bool

TaintExists checks if the given taint exists in list of taints. Returns true if exists false otherwise.

func UpdateNodeAnnotations added in v0.9.0

func UpdateNodeAnnotations(watchdogInitiated bool, watchdogTimeout time.Duration, nodeName string, mgr manager.Manager) error

UpdateNodeAnnotations updates the is-reboot-capable and watchdog timeout node annotations

Types

This section is empty.

Jump to

Keyboard shortcuts

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