Documentation
¶
Index ¶
- Constants
- Variables
- func AddOrUpdateLabelsOnNode(ctx context.Context, kubeClient clientset.Interface, ...) bool
- func AddOrUpdateTaintOnNode(ctx context.Context, c clientset.Interface, nodeName string, ...) error
- func DeletePods(ctx context.Context, c client.Client, pods []*corev1.Pod, ...) (bool, error)
- func GetInternalIP(node *corev1.Node) (string, bool)
- func GetNodeCondition(status *corev1.NodeStatus, conditionType corev1.NodeConditionType) (int, *corev1.NodeCondition)
- func IsNodeReady(node corev1.Node) bool
- func IsPodBoundenToNode(node *corev1.Node) bool
- func MarkPodsNotReady(ctx context.Context, c client.Client, recorder record.EventRecorder, ...) error
- func PatchNodeTaints(ctx context.Context, c clientset.Interface, nodeName string, ...) error
- func RecordNodeEvent(ctx context.Context, recorder record.EventRecorder, ...)
- func RecordNodeStatusChange(recorder record.EventRecorder, node *corev1.Node, newStatus string)
- func RemoveTaintOffNode(ctx context.Context, c clientset.Interface, nodeName string, node *corev1.Node, ...) error
- func SetPodTerminationReason(ctx context.Context, c client.Client, pod *corev1.Pod, nodeName string) (*corev1.Pod, error)
- func SwapNodeControllerTaint(ctx context.Context, kubeClient clientset.Interface, ...) bool
Constants ¶
const ( // NodeUnreachablePodReason is the reason on a pod when its state cannot be confirmed as kubelet is unresponsive // on the node it is (was) running. NodeUnreachablePodReason = "NodeLost" // NodeUnreachablePodMessage is the message on a pod when its state cannot be confirmed as kubelet is unresponsive // on the node it is (was) running. NodeUnreachablePodMessage = "Node %v which was running pod %v is unresponsive" // PodBindingAnnotation can be added into pod annotation, which indicates that this pod will be bound to the node that it is scheduled to. PodBindingAnnotation = "apps.openyurt.io/binding" )
Variables ¶
var UpdateLabelBackoff = wait.Backoff{ Steps: 5, Duration: 100 * time.Millisecond, Jitter: 1.0, }
var UpdateTaintBackoff = wait.Backoff{ Steps: 5, Duration: 100 * time.Millisecond, Jitter: 1.0, }
Functions ¶
func AddOrUpdateLabelsOnNode ¶
func AddOrUpdateLabelsOnNode( ctx context.Context, kubeClient clientset.Interface, labelsToUpdate map[string]string, node *corev1.Node, ) bool
AddOrUpdateLabelsOnNode updates the labels on the node and returns true on success and false on failure.
func AddOrUpdateTaintOnNode ¶
func AddOrUpdateTaintOnNode( ctx context.Context, c clientset.Interface, nodeName string, taints ...*corev1.Taint, ) error
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 DeletePods ¶
func DeletePods( ctx context.Context, c client.Client, pods []*corev1.Pod, recorder record.EventRecorder, nodeName, nodeUID string, ) (bool, error)
DeletePods will delete all pods from master running on given node, and return true if any pods were deleted, or were found pending deletion.
func GetInternalIP ¶ added in v1.7.0
GetInternalIP returns the internal IP of the node.
func GetNodeCondition ¶
func GetNodeCondition(status *corev1.NodeStatus, conditionType corev1.NodeConditionType) (int, *corev1.NodeCondition)
GetNodeCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.
func IsNodeReady ¶ added in v1.7.0
IsNodeReady checks if the `node` is `corev1.NodeReady`
func IsPodBoundenToNode ¶
IsPodBoundenToNode checks if the pod is bound to the node based on annotations. If the pod is bound to the node, it will return true; otherwise, it will return false. The pod is bound to the node if the pod has the following annotations: - apps.openyurt.io/binding: "true" - node.beta.openyurt.io/autonomy: "true" - node.openyurt.io/autonomy-duration: "duration"
func MarkPodsNotReady ¶
func MarkPodsNotReady( ctx context.Context, c client.Client, recorder record.EventRecorder, pods []*corev1.Pod, nodeName string, ) error
MarkPodsNotReady updates ready status of given pods running on given node from master return true if success
func PatchNodeTaints ¶
func PatchNodeTaints( ctx context.Context, c clientset.Interface, nodeName string, oldNode *corev1.Node, newNode *corev1.Node, ) error
PatchNodeTaints patches node's taints.
func RecordNodeEvent ¶
func RecordNodeEvent( ctx context.Context, recorder record.EventRecorder, nodeName, nodeUID, eventtype, reason, event string, )
RecordNodeEvent records a event related to a node.
func RecordNodeStatusChange ¶
func RecordNodeStatusChange(recorder record.EventRecorder, node *corev1.Node, newStatus string)
RecordNodeStatusChange records a event related to a node status change. (Common to lifecycle and ipam)
func RemoveTaintOffNode ¶
func RemoveTaintOffNode( ctx context.Context, c clientset.Interface, nodeName string, node *corev1.Node, taints ...*corev1.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.
func SetPodTerminationReason ¶
func SetPodTerminationReason( ctx context.Context, c client.Client, pod *corev1.Pod, nodeName string, ) (*corev1.Pod, error)
SetPodTerminationReason attempts to set a reason and message in the pod status, updates it in the apiserver, and returns an error if it encounters one.
Types ¶
This section is empty.