In AddOrUpdateTaintOnNode create annotation map if its nil

This commit is contained in:
Pawel Skrzynski 2016-08-08 19:48:07 +02:00
parent e18eda9b2b
commit 292cea1a18

View File

@ -2914,6 +2914,10 @@ func AddOrUpdateTaintOnNode(c *client.Client, nodeName string, taint api.Taint)
taintsData, err := json.Marshal(newTaints)
ExpectNoError(err)
if node.Annotations == nil {
node.Annotations = make(map[string]string)
}
node.Annotations[api.TaintsAnnotationKey] = string(taintsData)
_, err = c.Nodes().Update(node)
ExpectNoError(err)