node

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Labels
	NodeLabelBackend = "node.titus.netflix.com/backend"

	// Backends
	NodeBackendKubelet = "kubelet"

	// Possible node states
	NodeStateBootstrapping  = "bootstrapping"
	NodeStateActive         = "active"
	NodeStateDecommissioned = "decommissioned"
	NodeStateScalingDown    = "scalingDown"
	NodeStateBroken         = "broken"
	NodeStateRemovable      = "removable"
)
View Source
const (
	// TODO Use different resource pool name in tests
	ResourcePoolElastic = "elastic"
)

Variables

Functions

func Age added in v0.9.0

func Age(node *k8sCore.Node, now time.Time) time.Duration

func AsNodeReferenceList

func AsNodeReferenceList(nodeList *k8sCore.NodeList) []*k8sCore.Node

func ButNodeCreatedTimestamp added in v0.8.0

func ButNodeCreatedTimestamp(node *v1.Node, timestamp time.Time) *v1.Node

func ButNodeDecommissioned added in v0.8.0

func ButNodeDecommissioned(source string, node *v1.Node) *v1.Node

func ButNodeLabel added in v0.8.0

func ButNodeLabel(node *v1.Node, key string, value string) *v1.Node

func ButNodeRemovable added in v0.8.0

func ButNodeRemovable(node *v1.Node) *v1.Node

func ButNodeScalingDown added in v0.8.0

func ButNodeScalingDown(source string, node *v1.Node) *v1.Node

func ButNodeWithTaint added in v0.8.0

func ButNodeWithTaint(node *v1.Node, taint *v1.Taint) *v1.Node

func FindNodeResourcePool added in v0.13.0

func FindNodeResourcePool(node *k8sCore.Node) (string, bool)

func FindTaint added in v0.8.0

func FindTaint(node *k8sCore.Node, taintKey string) *k8sCore.Taint

func FormatNode added in v0.8.0

func FormatNode(node *v1.Node, ageThreshold time.Duration, options poolUtil.FormatterOptions) string

func FromNodeToComputeResource added in v0.8.0

func FromNodeToComputeResource(node *k8sCore.Node) poolApi.ComputeResource

func HasNoExecuteTaint added in v0.8.0

func HasNoExecuteTaint(node *k8sCore.Node) bool

func IsKubeletNode added in v0.6.0

func IsKubeletNode(node *k8sCore.Node) bool

Returns true, if a node is a Kubelet node

func IsNodeAvailableForScheduling added in v0.8.0

func IsNodeAvailableForScheduling(node *k8sCore.Node, now time.Time, ageThreshold time.Duration) bool

func IsNodeBootstrapping added in v0.8.0

func IsNodeBootstrapping(node *k8sCore.Node, now time.Time, ageThreshold time.Duration) bool

Returns true for a new node that is still bootstrapping. `ageThreshold` is a time limit for a node to be regarded as new.

func IsNodeBootstrapping2 added in v0.13.0

func IsNodeBootstrapping2(node *k8sCore.Node, pastDeadline func(*k8sCore.Node) bool) bool

func IsNodeBroken added in v0.8.0

func IsNodeBroken(node *k8sCore.Node) bool

func IsNodeDecommissioned added in v0.8.0

func IsNodeDecommissioned(node *k8sCore.Node) bool

func IsNodeOnItsWayOut added in v0.8.0

func IsNodeOnItsWayOut(node *k8sCore.Node) bool

func IsNodeRemovable added in v0.8.0

func IsNodeRemovable(node *k8sCore.Node) bool

func IsNodeScalingDown added in v0.8.0

func IsNodeScalingDown(node *k8sCore.Node) bool

func IsNodeTerminated added in v0.8.0

func IsNodeTerminated(node *k8sCore.Node) bool

TODO There is no obvious way to determine if a node object corresponds to an existing node instance. We trust here that node GC or node graceful shutdown deal with it quickly enough.

func IsNodeToRemove added in v0.8.0

func IsNodeToRemove(node *k8sCore.Node) bool

func Names added in v0.9.0

func Names(nodes []*k8sCore.Node) []string

func NewDecommissioningTaint added in v0.8.0

func NewDecommissioningTaint(source string, now time.Time) *v1.Taint

func NewNode added in v0.8.0

func NewNode(name string, resourcePoolName string, machineTypeConfig *machineTypeV1.MachineTypeConfig) *coreV1.Node

func NewNodes added in v0.8.0

func NewNodes(count int64, namePrefix string, resourcePoolName string,
	machineTypeConfig *machineTypeV1.MachineTypeConfig) []*coreV1.Node

func NewRandomNode added in v0.8.0

func NewRandomNode(transformers ...func(node *coreV1.Node)) *coreV1.Node

func NewScalingDownTaint added in v0.8.0

func NewScalingDownTaint(source string, now time.Time) *v1.Taint

func NewScalingDownTaintWithValue added in v0.8.0

func NewScalingDownTaintWithValue(now time.Time, value string) *v1.Taint

func NodeBelongsToResourcePool added in v0.13.0

func NodeBelongsToResourcePool(node *k8sCore.Node, resourcePool string) bool

func SortNodesByAge added in v0.8.0

func SortNodesByAge(nodes []*k8sCore.Node) []*k8sCore.Node

Sort in place an array of nodes by the creation timestamp.

func SumNodeResources added in v0.8.0

func SumNodeResources(nodes []*k8sCore.Node) poolApi.ComputeResource

func SumNodeResourcesInMap added in v0.13.0

func SumNodeResourcesInMap(nodes map[string]*k8sCore.Node) poolApi.ComputeResource

func UniqueNodeState added in v0.3.0

func UniqueNodeState(node *k8sCore.Node, now time.Time, ageThreshold time.Duration) string

Resolve node state.

Types

type Metadata added in v0.13.0

type Metadata struct {
	ResourcePool  string
	NodeResources v1.ComputeResource
}

type Options added in v0.13.0

type Options struct {
	// A predicate telling if a node is past its bootstrap stage.
	PastBootstrapDeadline func(node *k8sCore.Node, now time.Time) bool
	// A predicate for identifying nodes to be excluded.
	Exclude func(node *k8sCore.Node) bool
}

type Snapshot added in v0.13.0

type Snapshot struct {
	AllByName           map[string]*k8sCore.Node
	BootstrappingByName map[string]*k8sCore.Node
	ActiveByName        map[string]*k8sCore.Node
	OnWayOutByName      map[string]*k8sCore.Node
	MetadataByteName    map[string]*Metadata
	// Explicitly excluded nodes which otherwise would be in AllByName and one of the BootstrappingByName, ActiveByName
	// or OnWayOutByName collections. Primary use case is to exclude nodes running experimental Kube backends.
	ExcludedByName map[string]*k8sCore.Node
	// contains filtered or unexported fields
}

Node data snapshot with useful indexes for fast access. Snapshot struct can be mutated by calling the provided functions (Add, Transform). Those updates are applied in place, so if a client keeps reference to a collection (for example AllByName), it may change as well. To support fast O(1) mutations, only map collections are provided.

func NewEmptySnapshot added in v0.13.0

func NewEmptySnapshot() *Snapshot

func NewSnapshotOfResourcePool added in v0.13.0

func NewSnapshotOfResourcePool(nodes []*k8sCore.Node, resourcePool string, options Options) (*Snapshot, []*k8sCore.Node)

Returns Snapshot of nodes associated with the given resource pool and the list of the remaining nodes.

func (*Snapshot) Add added in v0.13.0

func (s *Snapshot) Add(node *k8sCore.Node) bool

Add a node. If a node already exists, it is overridden. Returns true if the node was not in the snapshot yet.

func (*Snapshot) ContainsName added in v0.13.0

func (s *Snapshot) ContainsName(nodeName string) bool

func (*Snapshot) Transform added in v0.13.0

func (s *Snapshot) Transform(nodeName string, transformer func(*k8sCore.Node)) (*k8sCore.Node, error)

Jump to

Keyboard shortcuts

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