address review
This commit is contained in:
		
							parent
							
								
									901901fb05
								
							
						
					
					
						commit
						617c2a2191
					
				|  | @ -221,24 +221,26 @@ class EndToEndTestCase(unittest.TestCase): | |||
|         pod1 = "acid-minimal-cluster-1" | ||||
| 
 | ||||
|         # enable lazy update | ||||
|         conf_image = "registry.opensource.zalan.do/acid/spilo-cdp-12:1.6-p16" | ||||
|         patch_lazy_spilo_upgrade = { | ||||
|             "data": { | ||||
|                 "enable_lazy_spilo_upgrade": "true", | ||||
|                 "docker_image": "registry.opensource.zalan.do/acid/spilo-cdp-12:1.6-p16" | ||||
|                 "docker_image": conf_image | ||||
|             } | ||||
|         } | ||||
|         k8s.update_config(patch_lazy_spilo_upgrade) | ||||
| 
 | ||||
|         # wait for sts update | ||||
|         time.sleep(60) | ||||
| 
 | ||||
|         # restart the pod to get a container with the new image  | ||||
|         k8s.api.core_v1.delete_namespaced_pod(pod0, "default") | ||||
|         time.sleep(60) | ||||
|         k8s.wait_for_pod_start('spilo-role=replica') | ||||
| 
 | ||||
|         # sanity check: restarted pod runs the image specified in operator's conf | ||||
|         new_image = k8s.get_effective_pod_image(pod0) | ||||
|         self.assertEqual(conf_image, new_image,  | ||||
|             "Lazy updated failed: restarted pod runs image {} different from the one in operator conf {}".format(new_image, conf_image)) | ||||
| 
 | ||||
|         # lazy update works if the restarted pod and older pods have different Spilo versions | ||||
|         # i.e. the update did not immediately affect all pods | ||||
|         new_image = k8s.get_effective_pod_image(pod0) | ||||
|         old_image = k8s.get_effective_pod_image(pod1) | ||||
|         self.assertNotEqual(old_image, new_image, "Lazy updated failed: pods have the same image {}".format(new_image)) | ||||
| 
 | ||||
|  |  | |||
|  | @ -253,10 +253,6 @@ func (c *Cluster) syncPodDisruptionBudget(isUpdate bool) error { | |||
| 
 | ||||
| func (c *Cluster) mustUpdatePodsAfterLazyUpdate(desiredSset *appsv1.StatefulSet) (bool, error) { | ||||
| 
 | ||||
| 	if c.OpConfig.EnableLazySpiloUpgrade { | ||||
| 		return false, nil | ||||
| 	} | ||||
| 
 | ||||
| 	pods, err := c.listPods() | ||||
| 	if err != nil { | ||||
| 		return false, fmt.Errorf("could not list pods of the statefulset: %v", err) | ||||
|  | @ -356,7 +352,7 @@ func (c *Cluster) syncStatefulSet() error { | |||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		if !podsRollingUpdateRequired { | ||||
| 		if !podsRollingUpdateRequired && !c.OpConfig.EnableLazySpiloUpgrade { | ||||
| 			// even if desired and actual statefulsets match
 | ||||
| 			// there still may be not up-to-date pods on condition
 | ||||
| 			//  (a) the lazy update was just disabled
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue