@@ -173,6 +173,7 @@ func TestSetDefaultStatefulSet(t *testing.T) {
173
173
defaultLabels := map [string ]string {"foo" : "bar" }
174
174
var defaultPartition int32 = 0
175
175
var defaultReplicas int32 = 1
176
+ var notTheDefaultPartition int32 = 42
176
177
177
178
period := int64 (v1 .DefaultTerminationGracePeriodSeconds )
178
179
defaultTemplate := v1.PodTemplateSpec {
@@ -265,6 +266,35 @@ func TestSetDefaultStatefulSet(t *testing.T) {
265
266
},
266
267
},
267
268
},
269
+ { // UpdateStrategy.RollingUpdate.Partition is not lost when UpdateStrategy.Type is not set
270
+ original : & appsv1.StatefulSet {
271
+ Spec : appsv1.StatefulSetSpec {
272
+ Template : defaultTemplate ,
273
+ UpdateStrategy : appsv1.StatefulSetUpdateStrategy {
274
+ RollingUpdate : & appsv1.RollingUpdateStatefulSetStrategy {
275
+ Partition : & notTheDefaultPartition ,
276
+ },
277
+ },
278
+ },
279
+ },
280
+ expected : & appsv1.StatefulSet {
281
+ ObjectMeta : metav1.ObjectMeta {
282
+ Labels : defaultLabels ,
283
+ },
284
+ Spec : appsv1.StatefulSetSpec {
285
+ Replicas : & defaultReplicas ,
286
+ Template : defaultTemplate ,
287
+ PodManagementPolicy : appsv1 .OrderedReadyPodManagement ,
288
+ UpdateStrategy : appsv1.StatefulSetUpdateStrategy {
289
+ Type : appsv1 .RollingUpdateStatefulSetStrategyType ,
290
+ RollingUpdate : & appsv1.RollingUpdateStatefulSetStrategy {
291
+ Partition : & notTheDefaultPartition ,
292
+ },
293
+ },
294
+ RevisionHistoryLimit : utilpointer .Int32Ptr (10 ),
295
+ },
296
+ },
297
+ },
268
298
}
269
299
270
300
for i , test := range tests {
0 commit comments