Documentation ¶
Index ¶
- Constants
- Variables
- func Age(node *k8sCore.Node, now time.Time) time.Duration
- func AsNodeReferenceList(nodeList *k8sCore.NodeList) []*k8sCore.Node
- func ButNodeCreatedTimestamp(node *v1.Node, timestamp time.Time) *v1.Node
- func ButNodeDecommissioned(source string, node *v1.Node) *v1.Node
- func ButNodeLabel(node *v1.Node, key string, value string) *v1.Node
- func ButNodeRemovable(node *v1.Node) *v1.Node
- func ButNodeScalingDown(source string, node *v1.Node) *v1.Node
- func ButNodeWithTaint(node *v1.Node, taint *v1.Taint) *v1.Node
- func FindNodeResourcePool(node *k8sCore.Node) (string, bool)
- func FindTaint(node *k8sCore.Node, taintKey string) *k8sCore.Taint
- func FormatNode(node *v1.Node, ageThreshold time.Duration, options poolUtil.FormatterOptions) string
- func FromNodeToComputeResource(node *k8sCore.Node) poolApi.ComputeResource
- func HasNoExecuteTaint(node *k8sCore.Node) bool
- func IsKubeletNode(node *k8sCore.Node) bool
- func IsNodeAvailableForScheduling(node *k8sCore.Node, now time.Time, ageThreshold time.Duration) bool
- func IsNodeBootstrapping(node *k8sCore.Node, now time.Time, ageThreshold time.Duration) bool
- func IsNodeBootstrapping2(node *k8sCore.Node, pastDeadline func(*k8sCore.Node) bool) bool
- func IsNodeBroken(node *k8sCore.Node) bool
- func IsNodeDecommissioned(node *k8sCore.Node) bool
- func IsNodeOnItsWayOut(node *k8sCore.Node) bool
- func IsNodeRemovable(node *k8sCore.Node) bool
- func IsNodeScalingDown(node *k8sCore.Node) bool
- func IsNodeTerminated(node *k8sCore.Node) bool
- func IsNodeToRemove(node *k8sCore.Node) bool
- func Names(nodes []*k8sCore.Node) []string
- func NewDecommissioningTaint(source string, now time.Time) *v1.Taint
- func NewNode(name string, resourcePoolName string, ...) *coreV1.Node
- func NewNodes(count int64, namePrefix string, resourcePoolName string, ...) []*coreV1.Node
- func NewRandomNode(transformers ...func(node *coreV1.Node)) *coreV1.Node
- func NewScalingDownTaint(source string, now time.Time) *v1.Taint
- func NewScalingDownTaintWithValue(now time.Time, value string) *v1.Taint
- func NodeBelongsToResourcePool(node *k8sCore.Node, resourcePool string) bool
- func SortNodesByAge(nodes []*k8sCore.Node) []*k8sCore.Node
- func SumNodeResources(nodes []*k8sCore.Node) poolApi.ComputeResource
- func SumNodeResourcesInMap(nodes map[string]*k8sCore.Node) poolApi.ComputeResource
- func UniqueNodeState(node *k8sCore.Node, now time.Time, ageThreshold time.Duration) string
- type Metadata
- type Options
- type Snapshot
Constants ¶
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" )
const (
// TODO Use different resource pool name in tests
ResourcePoolElastic = "elastic"
)
Variables ¶
var NodeStatesAll = []string{ NodeStateBootstrapping, NodeStateActive, NodeStateDecommissioned, NodeStateScalingDown, NodeStateBroken, NodeStateRemovable, }
Functions ¶
func ButNodeCreatedTimestamp ¶ added in v0.8.0
func ButNodeDecommissioned ¶ added in v0.8.0
func ButNodeLabel ¶ added in v0.8.0
func ButNodeScalingDown ¶ added in v0.8.0
func ButNodeWithTaint ¶ added in v0.8.0
func FindNodeResourcePool ¶ added in v0.13.0
func FormatNode ¶ added in v0.8.0
func FromNodeToComputeResource ¶ added in v0.8.0
func FromNodeToComputeResource(node *k8sCore.Node) poolApi.ComputeResource
func HasNoExecuteTaint ¶ added in v0.8.0
func IsKubeletNode ¶ added in v0.6.0
Returns true, if a node is a Kubelet node
func IsNodeAvailableForScheduling ¶ added in v0.8.0
func IsNodeBootstrapping ¶ added in v0.8.0
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 IsNodeBroken ¶ added in v0.8.0
func IsNodeDecommissioned ¶ added in v0.8.0
func IsNodeOnItsWayOut ¶ added in v0.8.0
func IsNodeRemovable ¶ added in v0.8.0
func IsNodeScalingDown ¶ added in v0.8.0
func IsNodeTerminated ¶ added in v0.8.0
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 NewDecommissioningTaint ¶ added in v0.8.0
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 NewScalingDownTaint ¶ added in v0.8.0
func NewScalingDownTaintWithValue ¶ added in v0.8.0
func NodeBelongsToResourcePool ¶ added in v0.13.0
func SortNodesByAge ¶ added in v0.8.0
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
Types ¶
type Metadata ¶ added in v0.13.0
type Metadata struct { ResourcePool string NodeResources v1.ComputeResource }
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
Add a node. If a node already exists, it is overridden. Returns true if the node was not in the snapshot yet.