mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 02:08:13 +00:00 
			
		
		
		
	Fix: UpdateStrategy.RollingUpdate.Partition is lost when UpdateStrategy.Type is not set
This commit is contained in:
		| @@ -173,6 +173,7 @@ func TestSetDefaultStatefulSet(t *testing.T) { | ||||
| 	defaultLabels := map[string]string{"foo": "bar"} | ||||
| 	var defaultPartition int32 = 0 | ||||
| 	var defaultReplicas int32 = 1 | ||||
| 	var notTheDefaultPartition int32 = 42 | ||||
|  | ||||
| 	period := int64(v1.DefaultTerminationGracePeriodSeconds) | ||||
| 	defaultTemplate := v1.PodTemplateSpec{ | ||||
| @@ -265,6 +266,35 @@ func TestSetDefaultStatefulSet(t *testing.T) { | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ // UpdateStrategy.RollingUpdate.Partition is not lost when UpdateStrategy.Type is not set | ||||
| 			original: &appsv1.StatefulSet{ | ||||
| 				Spec: appsv1.StatefulSetSpec{ | ||||
| 					Template: defaultTemplate, | ||||
| 					UpdateStrategy: appsv1.StatefulSetUpdateStrategy{ | ||||
| 						RollingUpdate: &appsv1.RollingUpdateStatefulSetStrategy{ | ||||
| 							Partition: ¬TheDefaultPartition, | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 			expected: &appsv1.StatefulSet{ | ||||
| 				ObjectMeta: metav1.ObjectMeta{ | ||||
| 					Labels: defaultLabels, | ||||
| 				}, | ||||
| 				Spec: appsv1.StatefulSetSpec{ | ||||
| 					Replicas:            &defaultReplicas, | ||||
| 					Template:            defaultTemplate, | ||||
| 					PodManagementPolicy: appsv1.OrderedReadyPodManagement, | ||||
| 					UpdateStrategy: appsv1.StatefulSetUpdateStrategy{ | ||||
| 						Type: appsv1.RollingUpdateStatefulSetStrategyType, | ||||
| 						RollingUpdate: &appsv1.RollingUpdateStatefulSetStrategy{ | ||||
| 							Partition: ¬TheDefaultPartition, | ||||
| 						}, | ||||
| 					}, | ||||
| 					RevisionHistoryLimit: utilpointer.Int32Ptr(10), | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| 	for i, test := range tests { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Philipp Stehle
					Philipp Stehle