nodes

package
v0.0.0-...-9c5689a Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NodesSelector string

NodesSelector represent the label selector used to filter impacted nodes.

Functions

func AddRoleTo

func AddRoleTo(nodeName, role string) error

AddRoleTo adds the "node-role.kubernetes.io/<role>" to the given node

func AvailableForSelector

func AvailableForSelector(nodeSelector map[string]string) ([]corev1.Node, error)

AvailableForSelector returns nodes available for given nodeSelector

func ExecCommandOnMachineConfigDaemon

func ExecCommandOnMachineConfigDaemon(cs *testclient.ClientSet, node *corev1.Node, command []string) ([]byte, error)

ExecCommandOnMachineConfigDaemon returns the output of the command execution on the machine-config-daemon pod that runs on the specified node

func FilterByResource

func FilterByResource(cs *testclient.ClientSet, nodes []corev1.Node, resource corev1.ResourceName) []corev1.Node

FilterByResource returns all nodes with the specified allocated resource greater than 0

func FindRoleLabel

func FindRoleLabel(node *corev1.Node) string

FindRoleLabel loops over node labels and return the first with key like "node-role.kubernetest.io/*", except "node-role.kubernetest.io/worker".

Consider that a node is suppose to have only one "custom role" (role != "worker"). If a node has two or more custom roles, MachineConfigOperato stops managing that node.

func GetByRole

func GetByRole(cs *testclient.ClientSet, role string) ([]corev1.Node, error)

GetByRole returns all nodes with the specified role

func GetKubeletConfig

GetKubeletConfig returns KubeletConfiguration loaded from the node /etc/kubernetes/kubelet.conf

func GetMachineConfigDaemonByNode

func GetMachineConfigDaemonByNode(cs *testclient.ClientSet, node *corev1.Node) (*corev1.Pod, error)

GetMachineConfigDaemonByNode returns the machine-config-daemon pod that runs on the specified node

func GetOvnkubePodByNode

func GetOvnkubePodByNode(cs *testclient.ClientSet, node *corev1.Node) (*corev1.Pod, error)

GetOvsPodByNode returns the ovs-node pod that runs on the specified node

func HasSCTPEnabled

func HasSCTPEnabled(node *corev1.Node) (bool, error)

func HavingSCTPEnabled

func HavingSCTPEnabled(inputNodeNames []string) ([]string, error)

HavingSCTPEnabled takes a list node names and return the same list with only the nodes that has SCTP enabled.

func IsSingleNodeCluster

func IsSingleNodeCluster() (bool, error)

func LabelNode

func LabelNode(nodeName, key, value string) (*corev1.Node, error)

LabelNode labels a node.

func LabeledNodesCount

func LabeledNodesCount(label string) (int, error)

LabeledNodesCount return the number of nodes with the given label.

func MatchingCustomSelectorByName

func MatchingCustomSelectorByName(toFilter []string, nodesSelector string) ([]string, error)

MatchingCustomSelectorByName filter the given slice with only the nodes matching the given custom selector. The nodesSelector must be in the form of label=value. For example: nodesSelector="sctp=true"

func MatchingOptionalSelector

func MatchingOptionalSelector(toFilter []corev1.Node) ([]corev1.Node, error)

MatchingOptionalSelector filter the given slice with only the nodes matching the optional selector. If no selector is set, it returns the same list. The NODES_SELECTOR must be set with a labelselector expression. For example: NODES_SELECTOR="sctp=true"

func MatchingOptionalSelectorByName

func MatchingOptionalSelectorByName(toFilter []string) ([]string, error)

MatchingOptionalSelectorByName filter the given slice with only the nodes matching the optional selector. If no selector is set, it returns the same list. The NODES_SELECTOR must be in the form of label=value. For example: NODES_SELECTOR="sctp=true"

func MatchingOptionalSelectorPTP

func MatchingOptionalSelectorPTP(toFilter []ptpv1.NodePtpDevice) ([]ptpv1.NodePtpDevice, error)

MatchingOptionalSelectorPTP filter the given slice with only the nodes matching the optional selector. If no selector is set, it returns the same list. The NODES_SELECTOR must be set with a labelselector expression. For example: NODES_SELECTOR="sctp=true"

func PodLabelSelector

func PodLabelSelector() (map[string]string, bool)

PodLabelSelector returns a map based on the optional NODES_SELECTOR variable.

func RemoveRoleFrom

func RemoveRoleFrom(nodeName, role string) error

RemoveRoleFrom removes the "node-role.kubernetes.io/<role>" from the given node

func SelectorUnion

func SelectorUnion(nodeSelector1 map[string]string, nodeSelector2 map[string]string) map[string]string

SelectorUnion returns a union of 2 node selectors

Types

type NodeTopology

type NodeTopology struct {
	NodeName      string
	InterfaceList []string
	NodeObject    *corev1.Node
}

NodeTopology represents a subset of the node topology structure.

func PtpEnabled

func PtpEnabled(client *client.ClientSet) ([]NodeTopology, error)

PtpEnabled returns the topology of a given node, filtering using the given selector.

Jump to

Keyboard shortcuts

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