mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 22:05:59 +00:00
Nodelifecycle: Emit event when deletion failed
The nodelifecycle controller emits an event before it deletes a node. Failures doing so for example due to a webhook are pretty hidden though, as they are only logged in the controller-manager. This change makes us emit an event for failing to delete a node including the error as well.
This commit is contained in:
parent
d3d06c3c7e
commit
b2eb6e7d03
@ -43,6 +43,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
deleteNodeEvent = "DeletingNode"
|
deleteNodeEvent = "DeletingNode"
|
||||||
|
deleteNodeFailedEvent = "DeletingNodeFailed"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ShutdownTaint = &v1.Taint{
|
var ShutdownTaint = &v1.Taint{
|
||||||
@ -175,6 +176,8 @@ func (c *CloudNodeLifecycleController) MonitorNodes(ctx context.Context) {
|
|||||||
|
|
||||||
if err := c.kubeClient.CoreV1().Nodes().Delete(ctx, node.Name, metav1.DeleteOptions{}); err != nil {
|
if err := c.kubeClient.CoreV1().Nodes().Delete(ctx, node.Name, metav1.DeleteOptions{}); err != nil {
|
||||||
klog.Errorf("unable to delete node %q: %v", node.Name, err)
|
klog.Errorf("unable to delete node %q: %v", node.Name, err)
|
||||||
|
c.recorder.Eventf(ref, v1.EventTypeWarning, deleteNodeFailedEvent,
|
||||||
|
"Failed deleting node %s: %v", node.Name, err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Node exists. We need to check this to get taint working in similar in all cloudproviders
|
// Node exists. We need to check this to get taint working in similar in all cloudproviders
|
||||||
|
Loading…
Reference in New Issue
Block a user