Delete taint annotation when removing last taint

pull/6/head
gmarek 2016-11-17 16:02:34 +01:00
parent 424286996a
commit eecc840074
1 changed files with 7 additions and 3 deletions

View File

@ -2587,10 +2587,14 @@ func RemoveTaintOffNode(c clientset.Interface, nodeName string, taint api.Taint)
newTaints, err := deleteTaint(nodeTaints, taint)
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)
if err != nil {
if !apierrs.IsConflict(err) {