package helpers
import "k8s.io/cloud-provider/node/helpers"
Index ¶
- func AddOrUpdateLabelsOnNode(kubeClient clientset.Interface, labelsToUpdate map[string]string, node *v1.Node) bool
- func AddOrUpdateTaintOnNode(c clientset.Interface, nodeName string, taints ...*v1.Taint) error
- func AddToNodeAddresses(addresses *[]v1.NodeAddress, addAddresses ...v1.NodeAddress)
- func GetNodeAddressesFromNodeIP(providedNodeIP string, cloudNodeAddresses []v1.NodeAddress) ([]v1.NodeAddress, error)
- func GetNodeAddressesFromNodeIPLegacy(nodeIP net.IP, cloudNodeAddresses []v1.NodeAddress) ([]v1.NodeAddress, error)
- func PatchNodeTaints(c clientset.Interface, nodeName string, oldNode *v1.Node, newNode *v1.Node) error
- func RemoveTaintOffNode(c clientset.Interface, nodeName string, node *v1.Node, taints ...*v1.Taint) error
Functions ¶
func AddOrUpdateLabelsOnNode ¶
func AddOrUpdateLabelsOnNode(kubeClient clientset.Interface, labelsToUpdate map[string]string, node *v1.Node) bool
AddOrUpdateLabelsOnNode updates the labels on the node and returns true on success and false on failure.
func AddOrUpdateTaintOnNode ¶
AddOrUpdateTaintOnNode add taints to the node. If taint was added into node, it'll issue API calls to update nodes; otherwise, no API calls. Return error if any.
func AddToNodeAddresses ¶
func AddToNodeAddresses(addresses *[]v1.NodeAddress, addAddresses ...v1.NodeAddress)
AddToNodeAddresses appends the NodeAddresses to the passed-by-pointer slice, only if they do not already exist
func GetNodeAddressesFromNodeIP ¶
func GetNodeAddressesFromNodeIP(providedNodeIP string, cloudNodeAddresses []v1.NodeAddress) ([]v1.NodeAddress, error)
GetNodeAddressesFromNodeIP filters the provided list of nodeAddresses to match the providedNodeIP from the Node annotation (which is assumed to be non-empty). This is used for external cloud providers.
It will return node addresses filtered such that:
- Any address matching nodeIP will be listed first.
- If nodeIP matches an address of a particular type (internal or external), that will be the *only* address of that type returned.
- All remaining addresses are listed after.
(This does not have the same behavior with `0.0.0.0` and `::` as GetNodeAddressesFromNodeIPLegacy, because that case never occurs for external cloud providers, because kubelet does not set the `provided-node-ip` annotation in that case.)
func GetNodeAddressesFromNodeIPLegacy ¶
func GetNodeAddressesFromNodeIPLegacy(nodeIP net.IP, cloudNodeAddresses []v1.NodeAddress) ([]v1.NodeAddress, error)
GetNodeAddressesFromNodeIPLegacy filters node addresses to prefer a specific node IP or address family. This function is used only with legacy cloud providers.
If nodeIP is either '0.0.0.0' or '::' it is taken to represent any address of that address family: IPv4 or IPv6. i.e. if nodeIP is '0.0.0.0' we will return node addresses sorted such that all IPv4 addresses are listed before IPv6 addresses.
If nodeIP is a specific IP, either IPv4 or IPv6, we will return node addresses filtered such that:
- Any address matching nodeIP will be listed first.
- If nodeIP matches an address of a particular type (internal or external), that will be the *only* address of that type returned.
- All remaining addresses are listed after.
func PatchNodeTaints ¶
func PatchNodeTaints(c clientset.Interface, nodeName string, oldNode *v1.Node, newNode *v1.Node) error
PatchNodeTaints patches node's taints.
func RemoveTaintOffNode ¶
func RemoveTaintOffNode(c clientset.Interface, nodeName string, node *v1.Node, taints ...*v1.Taint) error
RemoveTaintOffNode is for cleaning up taints temporarily added to node, won't fail if target taint doesn't exist or has been removed. If passed a node it'll check if there's anything to be done, if taint is not present it won't issue any API calls.
Source Files ¶
address.go labels.go taints.go
- Version
- v0.32.2 (latest)
- Published
- Feb 13, 2025
- Platform
- linux/amd64
- Imports
- 17 packages
- Last checked
- 2 months ago –
Tools for package owners.