Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: yurt-controller-manager reboot cannot remove taint node.openyurt.io/unschedulable (#1233) #1337

Merged
merged 1 commit into from
Mar 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ type Controller struct {
leaseLister leaselisterv1.LeaseNamespaceLister
nodeUpdateQueue workqueue.Interface

ldc *utils.LeaseDelegatedCounter
ldc *utils.LeaseDelegatedCounter
delLdc *utils.LeaseDelegatedCounter
}

func (c *Controller) onLeaseCreate(n interface{}) {
Expand Down Expand Up @@ -87,6 +88,7 @@ func NewController(kc client.Interface, informerFactory informers.SharedInformer
client: kc,
nodeUpdateQueue: workqueue.NewNamed("poolcoordinator_node"),
ldc: utils.NewLeaseDelegatedCounter(),
delLdc: utils.NewLeaseDelegatedCounter(),
}

if informerFactory != nil {
Expand Down Expand Up @@ -152,6 +154,7 @@ func (c *Controller) doDeTaintNodeNotSchedulable(node *corev1.Node) *corev1.Node
taints := node.Spec.Taints
taints, deleted := utils.DeleteTaintsByKey(taints, constant.NodeNotSchedulableTaint)
if !deleted {
c.delLdc.Inc(node.Name)
klog.Infof("detaint %s: no key %s exists, nothing to do\n", node.Name, constant.NodeNotSchedulableTaint)
return node
}
Expand All @@ -162,6 +165,8 @@ func (c *Controller) doDeTaintNodeNotSchedulable(node *corev1.Node) *corev1.Node
nn, err = c.client.CoreV1().Nodes().Update(context.TODO(), nn, metav1.UpdateOptions{})
if err != nil {
klog.Error(err)
} else {
c.delLdc.Inc(node.Name)
}
}
return nn
Expand All @@ -186,9 +191,10 @@ func (c *Controller) syncHandler(key string) error {
c.ldc.Inc(nl.Name)
if c.ldc.Counter(nl.Name) >= constant.LeaseDelegationThreshold {
c.taintNodeNotSchedulable(nl.Name)
c.delLdc.Reset(nl.Name)
}
} else {
if c.ldc.Counter(nl.Name) >= constant.LeaseDelegationThreshold {
if c.delLdc.Counter(nl.Name) == 0 {
c.deTaintNodeNotSchedulable(nl.Name)
}
c.ldc.Reset(nl.Name)
Expand Down