mirror of https://github.com/k3s-io/k3s
Delete taint annotation when removing last taint
parent
424286996a
commit
eecc840074
|
@ -2587,10 +2587,14 @@ func RemoveTaintOffNode(c clientset.Interface, nodeName string, taint api.Taint)
|
||||||
|
|
||||||
newTaints, err := deleteTaint(nodeTaints, taint)
|
newTaints, err := deleteTaint(nodeTaints, taint)
|
||||||
ExpectNoError(err)
|
ExpectNoError(err)
|
||||||
|
if len(newTaints) == 0 {
|
||||||
|
delete(node.Annotations, api.TaintsAnnotationKey)
|
||||||
|
} else {
|
||||||
|
taintsData, err := json.Marshal(newTaints)
|
||||||
|
ExpectNoError(err)
|
||||||
|
node.Annotations[api.TaintsAnnotationKey] = string(taintsData)
|
||||||
|
}
|
||||||
|
|
||||||
taintsData, err := json.Marshal(newTaints)
|
|
||||||
ExpectNoError(err)
|
|
||||||
node.Annotations[api.TaintsAnnotationKey] = string(taintsData)
|
|
||||||
_, err = c.Core().Nodes().Update(node)
|
_, err = c.Core().Nodes().Update(node)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !apierrs.IsConflict(err) {
|
if !apierrs.IsConflict(err) {
|
||||||
|
|
Loading…
Reference in New Issue