mirror of https://github.com/kubernetes/kops.git
				
				
				
			Stop with rolling update if bastions or masters failed to update
This commit is contained in:
		
							parent
							
								
									498b5d72b6
								
							
						
					
					
						commit
						b06e3efa4d
					
				|  | @ -111,6 +111,13 @@ func (c *RollingUpdateCluster) RollingUpdate(groups map[string]*cloudinstances.C | ||||||
| 		wg.Wait() | 		wg.Wait() | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	// Do not continue update if bastion(s) failed
 | ||||||
|  | 	for _, err := range results { | ||||||
|  | 		if err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	// Upgrade master next
 | 	// Upgrade master next
 | ||||||
| 	{ | 	{ | ||||||
| 		var wg sync.WaitGroup | 		var wg sync.WaitGroup | ||||||
|  | @ -135,17 +142,37 @@ func (c *RollingUpdateCluster) RollingUpdate(groups map[string]*cloudinstances.C | ||||||
| 					err = g.RollingUpdate(c, cluster, instanceGroups, false, c.MasterInterval, c.ValidationTimeout) | 					err = g.RollingUpdate(c, cluster, instanceGroups, false, c.MasterInterval, c.ValidationTimeout) | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
|  | 				if err != nil { | ||||||
|  | 					// Remove function panic errors if an actual error occurred, otherwise that would be displayed
 | ||||||
|  | 					for k := range masterGroups { | ||||||
|  | 						resultsMutex.Lock() | ||||||
|  | 						results[k] = nil | ||||||
|  | 						resultsMutex.Unlock() | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
| 				resultsMutex.Lock() | 				resultsMutex.Lock() | ||||||
| 				results[k] = err | 				results[k] = err | ||||||
| 				resultsMutex.Unlock() | 				resultsMutex.Unlock() | ||||||
| 
 | 
 | ||||||
| 				// TODO: Bail on error?
 | 				if err != nil { | ||||||
|  | 					// Stop before all masters are updated if an error occurs,
 | ||||||
|  | 					// to prevent more masters from failing and causing an outage
 | ||||||
|  | 					return | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		}() | 		}() | ||||||
| 
 | 
 | ||||||
| 		wg.Wait() | 		wg.Wait() | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	// Do not continue update if master(s) failed, cluster is potentially in an unhealthy state
 | ||||||
|  | 	for _, err := range results { | ||||||
|  | 		if err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	// Upgrade nodes, with greater parallelism
 | 	// Upgrade nodes, with greater parallelism
 | ||||||
| 	{ | 	{ | ||||||
| 		var wg sync.WaitGroup | 		var wg sync.WaitGroup | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue