util

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNodeCondition added in v0.2.1

func GetNodeCondition(node *v1.Node, conditionType v1.NodeConditionType) (v1.NodeCondition, bool)

GetNodeCondition returns the Node condition of a particular type returns the NodeCondition and true if found, otherwise returns an empty NodeCondition and false

func IsDomainName added in v0.1.13

func IsDomainName(s string) bool

IsDomainName checks if a string is a presentation-format domain name Copied from the stdlib: https://github.com/golang/go/blob/91b8cc0dfaae12af1a89e2b7ad3da10728883ee1/src/net/dnsclient.go#LL75C6-L75C6

func ParseNodeSelectors added in v0.1.7

func ParseNodeSelectors(selectors string) ([]string, error)

ParseNodeSelectors parses the node selector string as a JSON array if possible, otherwise it treats it as a literal.

func StringInSlice

func StringInSlice(str string, strs []string) bool

Types

type NodeReadyChecker added in v0.2.1

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

NodeReadyChecker is used to determine whether a node should be included in the list of available nodes. It contains a cache of the time each node was seen as unready so that it is only excluded from the list after a grace period. This is necessary because the Spec.Unschedulable field does not have an associated condition or timestamp and the NodeReady condition is tertiary (Unknown, True, False) and does not indicate the state it transitioned from to unready.

func NewNodeReadyChecker added in v0.2.1

func NewNodeReadyChecker(lister listerv1.NodeLister, downGracePeriod time.Duration) NodeReadyChecker

func (*NodeReadyChecker) IsReadyAndSchedulable added in v0.2.1

func (nrc *NodeReadyChecker) IsReadyAndSchedulable(node *v1.Node) bool

NodeIsReady returns true if the node is both marked Ready and schedulable false, otherwise.

func (*NodeReadyChecker) ShouldInclude added in v0.2.1

func (nrc *NodeReadyChecker) ShouldInclude(node *v1.Node) (bool, time.Duration)

ShouldInclude returns true if the node should be included in the list of available nodes based on whether the Node is ready and schedulable and the grace period has passed. If the node should not be included, the second return value is the amount of time to wait before checking again.

func (*NodeReadyChecker) UpdateCache added in v0.2.1

func (nrc *NodeReadyChecker) UpdateCache(node *v1.Node)

UpdateCache updates the cache with the new node state so that it can be used to determine whether the node should be included in the list of available nodes. This should only be called once per node update, but allows ShouldInclude to be called multiple times without the result changing.

Jump to

Keyboard shortcuts

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