mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-03 23:40:03 +00:00 
			
		
		
		
	In AddOrUpdateTaintOnNode create annotation map if its nil
This commit is contained in:
		@@ -2914,6 +2914,10 @@ func AddOrUpdateTaintOnNode(c *client.Client, nodeName string, taint api.Taint)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	taintsData, err := json.Marshal(newTaints)
 | 
						taintsData, err := json.Marshal(newTaints)
 | 
				
			||||||
	ExpectNoError(err)
 | 
						ExpectNoError(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if node.Annotations == nil {
 | 
				
			||||||
 | 
							node.Annotations = make(map[string]string)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	node.Annotations[api.TaintsAnnotationKey] = string(taintsData)
 | 
						node.Annotations[api.TaintsAnnotationKey] = string(taintsData)
 | 
				
			||||||
	_, err = c.Nodes().Update(node)
 | 
						_, err = c.Nodes().Update(node)
 | 
				
			||||||
	ExpectNoError(err)
 | 
						ExpectNoError(err)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user