Skip to content

Commit a7b9cc5

Browse files
authored
v1beta2: Delete .enable field from WaitForPodsReady API in config (#7628)
1 parent 47397f8 commit a7b9cc5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+156
-180
lines changed

apis/config/v1beta1/configuration_conversion.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ func Convert_v1beta1_Configuration_To_v1beta2_Configuration(in *Configuration, o
4343
if in.FairSharing == nil || !in.FairSharing.Enable {
4444
out.FairSharing = nil
4545
}
46+
if in.WaitForPodsReady == nil || !in.WaitForPodsReady.Enable {
47+
out.WaitForPodsReady = nil
48+
}
4649
return nil
4750
}
4851

@@ -59,3 +62,12 @@ func Convert_v1beta2_FairSharing_To_v1beta1_FairSharing(in *v1beta2.FairSharing,
5962
out.Enable = true
6063
return autoConvert_v1beta2_FairSharing_To_v1beta1_FairSharing(in, out, s)
6164
}
65+
66+
func Convert_v1beta1_WaitForPodsReady_To_v1beta2_WaitForPodsReady(in *WaitForPodsReady, out *v1beta2.WaitForPodsReady, s conversionapi.Scope) error {
67+
return autoConvert_v1beta1_WaitForPodsReady_To_v1beta2_WaitForPodsReady(in, out, s)
68+
}
69+
70+
func Convert_v1beta2_WaitForPodsReady_To_v1beta1_WaitForPodsReady(in *v1beta2.WaitForPodsReady, out *WaitForPodsReady, s conversionapi.Scope) error {
71+
out.Enable = true
72+
return autoConvert_v1beta2_WaitForPodsReady_To_v1beta1_WaitForPodsReady(in, out, s)
73+
}

apis/config/v1beta1/configuration_conversion_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,26 @@ func TestConfigurationQueueConvertTo(t *testing.T) {
5757
FairSharing: nil,
5858
},
5959
},
60+
"with WaitForPodsReady": {
61+
input: &Configuration{
62+
WaitForPodsReady: &WaitForPodsReady{
63+
Enable: true,
64+
},
65+
},
66+
expected: &v1beta2.Configuration{
67+
WaitForPodsReady: &v1beta2.WaitForPodsReady{},
68+
},
69+
},
70+
"with WaitForPodsReady disabled": {
71+
input: &Configuration{
72+
WaitForPodsReady: &WaitForPodsReady{
73+
Enable: false,
74+
},
75+
},
76+
expected: &v1beta2.Configuration{
77+
WaitForPodsReady: nil,
78+
},
79+
},
6080
}
6181

6282
for name, tc := range testCases {
@@ -94,6 +114,16 @@ func TestConfigurationQueueConvertFrom(t *testing.T) {
94114
},
95115
},
96116
},
117+
"with WaitForPodsReady": {
118+
input: &v1beta2.Configuration{
119+
WaitForPodsReady: &v1beta2.WaitForPodsReady{},
120+
},
121+
expected: &Configuration{
122+
WaitForPodsReady: &WaitForPodsReady{
123+
Enable: true,
124+
},
125+
},
126+
},
97127
}
98128

99129
for name, tc := range testCases {
@@ -124,6 +154,13 @@ func TestConfigurationQueueConversion_RoundTrip(t *testing.T) {
124154
},
125155
},
126156
},
157+
"with WaitForPodsReady": {
158+
v1beta1Obj: &Configuration{
159+
WaitForPodsReady: &WaitForPodsReady{
160+
Enable: true,
161+
},
162+
},
163+
},
127164
}
128165

129166
for name, tc := range testCases {

apis/config/v1beta1/zz_generated.conversion.go

Lines changed: 29 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/config/v1beta2/configuration_types.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,6 @@ type ControllerConfigurationSpec struct {
215215
// WaitForPodsReady defines configuration for the Wait For Pods Ready feature,
216216
// which is used to ensure that all Pods are ready within the specified time.
217217
type WaitForPodsReady struct {
218-
// Enable indicates whether to enable wait for pods ready feature.
219-
// Defaults to false.
220-
Enable bool `json:"enable,omitempty"`
221-
222218
// Timeout defines the time for an admitted workload to reach the
223219
// PodsReady=true condition. When the timeout is exceeded, the workload
224220
// evicted and requeued in the same cluster queue.
@@ -229,6 +225,8 @@ type WaitForPodsReady struct {
229225
// BlockAdmission when true, cluster queue will block admissions for all
230226
// subsequent jobs until the jobs reach the PodsReady=true condition.
231227
// This setting is only honored when `Enable` is set to true.
228+
// Defaults to true.
229+
// +optional
232230
BlockAdmission *bool `json:"blockAdmission,omitempty"`
233231

234232
// RequeuingStrategy defines the strategy for requeuing a Workload.

apis/config/v1beta2/defaults.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,9 @@ func SetDefaults_Configuration(cfg *Configuration) {
9292
cfg.ClientConnection.QPS = cmp.Or(cfg.ClientConnection.QPS, ptr.To(DefaultClientConnectionQPS))
9393
cfg.ClientConnection.Burst = cmp.Or(cfg.ClientConnection.Burst, ptr.To(DefaultClientConnectionBurst))
9494

95-
cfg.WaitForPodsReady = cmp.Or(cfg.WaitForPodsReady, &WaitForPodsReady{Enable: false})
96-
if cfg.WaitForPodsReady.Enable {
95+
if cfg.WaitForPodsReady != nil {
9796
cfg.WaitForPodsReady.Timeout = cmp.Or(cfg.WaitForPodsReady.Timeout, &metav1.Duration{Duration: defaultPodsReadyTimeout})
98-
cfg.WaitForPodsReady.BlockAdmission = cmp.Or(cfg.WaitForPodsReady.BlockAdmission, &cfg.WaitForPodsReady.Enable)
97+
cfg.WaitForPodsReady.BlockAdmission = cmp.Or(cfg.WaitForPodsReady.BlockAdmission, ptr.To(true))
9998
cfg.WaitForPodsReady.RequeuingStrategy = cmp.Or(cfg.WaitForPodsReady.RequeuingStrategy, &RequeuingStrategy{})
10099
cfg.WaitForPodsReady.RequeuingStrategy.Timestamp = cmp.Or(cfg.WaitForPodsReady.RequeuingStrategy.Timestamp, ptr.To(EvictionTimestamp))
101100
cfg.WaitForPodsReady.RequeuingStrategy.BackoffBaseSeconds = cmp.Or(cfg.WaitForPodsReady.RequeuingStrategy.BackoffBaseSeconds, ptr.To[int32](DefaultRequeuingBackoffBaseSeconds))

apis/config/v1beta2/defaults_test.go

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
118118
Integrations: defaultIntegrations,
119119
MultiKueue: defaultMultiKueue,
120120
ManagedJobsNamespaceSelector: defaultManagedJobsNamespaceSelector,
121-
WaitForPodsReady: &WaitForPodsReady{},
122121
},
123122
},
124123
"defaulting ControllerManager": {
@@ -161,7 +160,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
161160
Integrations: defaultIntegrations,
162161
MultiKueue: defaultMultiKueue,
163162
ManagedJobsNamespaceSelector: defaultManagedJobsNamespaceSelector,
164-
WaitForPodsReady: &WaitForPodsReady{},
165163
},
166164
},
167165
"should not default ControllerManager": {
@@ -220,7 +218,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
220218
Integrations: defaultIntegrations,
221219
MultiKueue: defaultMultiKueue,
222220
ManagedJobsNamespaceSelector: defaultManagedJobsNamespaceSelector,
223-
WaitForPodsReady: &WaitForPodsReady{},
224221
},
225222
},
226223
"should not set LeaderElectionID": {
@@ -263,7 +260,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
263260
Integrations: defaultIntegrations,
264261
MultiKueue: defaultMultiKueue,
265262
ManagedJobsNamespaceSelector: defaultManagedJobsNamespaceSelector,
266-
WaitForPodsReady: &WaitForPodsReady{},
267263
},
268264
},
269265
"defaulting InternalCertManagement": {
@@ -282,7 +278,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
282278
Integrations: overwriteNamespaceIntegrations,
283279
MultiKueue: defaultMultiKueue,
284280
ManagedJobsNamespaceSelector: overwriteNamespaceSelector,
285-
WaitForPodsReady: &WaitForPodsReady{},
286281
},
287282
},
288283
"should not default InternalCertManagement": {
@@ -302,7 +297,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
302297
Integrations: overwriteNamespaceIntegrations,
303298
MultiKueue: defaultMultiKueue,
304299
ManagedJobsNamespaceSelector: overwriteNamespaceSelector,
305-
WaitForPodsReady: &WaitForPodsReady{},
306300
},
307301
},
308302
"should not default values in custom ClientConnection": {
@@ -329,7 +323,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
329323
Integrations: overwriteNamespaceIntegrations,
330324
MultiKueue: defaultMultiKueue,
331325
ManagedJobsNamespaceSelector: overwriteNamespaceSelector,
332-
WaitForPodsReady: &WaitForPodsReady{},
333326
},
334327
},
335328
"should default empty custom ClientConnection": {
@@ -350,21 +343,17 @@ func TestSetDefaults_Configuration(t *testing.T) {
350343
Integrations: overwriteNamespaceIntegrations,
351344
MultiKueue: defaultMultiKueue,
352345
ManagedJobsNamespaceSelector: overwriteNamespaceSelector,
353-
WaitForPodsReady: &WaitForPodsReady{},
354346
},
355347
},
356348
"defaulting waitForPodsReady values": {
357349
original: &Configuration{
358-
WaitForPodsReady: &WaitForPodsReady{
359-
Enable: true,
360-
},
350+
WaitForPodsReady: &WaitForPodsReady{},
361351
InternalCertManagement: &InternalCertManagement{
362352
Enable: ptr.To(false),
363353
},
364354
},
365355
want: &Configuration{
366356
WaitForPodsReady: &WaitForPodsReady{
367-
Enable: true,
368357
BlockAdmission: ptr.To(true),
369358
Timeout: &podsReadyTimeout,
370359
RecoveryTimeout: nil,
@@ -385,34 +374,9 @@ func TestSetDefaults_Configuration(t *testing.T) {
385374
ManagedJobsNamespaceSelector: defaultManagedJobsNamespaceSelector,
386375
},
387376
},
388-
"set waitForPodsReady.blockAdmission to false, and waitForPodsReady.recoveryTimeout to nil when enable is false": {
389-
original: &Configuration{
390-
WaitForPodsReady: &WaitForPodsReady{
391-
Enable: false,
392-
},
393-
InternalCertManagement: &InternalCertManagement{
394-
Enable: ptr.To(false),
395-
},
396-
},
397-
want: &Configuration{
398-
WaitForPodsReady: &WaitForPodsReady{
399-
Enable: false,
400-
},
401-
Namespace: ptr.To(DefaultNamespace),
402-
ControllerManager: defaultCtrlManagerConfigurationSpec,
403-
InternalCertManagement: &InternalCertManagement{
404-
Enable: ptr.To(false),
405-
},
406-
ClientConnection: defaultClientConnection,
407-
Integrations: defaultIntegrations,
408-
MultiKueue: defaultMultiKueue,
409-
ManagedJobsNamespaceSelector: defaultManagedJobsNamespaceSelector,
410-
},
411-
},
412377
"respecting provided waitForPodsReady values": {
413378
original: &Configuration{
414379
WaitForPodsReady: &WaitForPodsReady{
415-
Enable: true,
416380
Timeout: &podsReadyTimeoutOverwrite,
417381
RequeuingStrategy: &RequeuingStrategy{
418382
Timestamp: ptr.To(CreationTimestamp),
@@ -427,7 +391,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
427391
},
428392
want: &Configuration{
429393
WaitForPodsReady: &WaitForPodsReady{
430-
Enable: true,
431394
BlockAdmission: ptr.To(true),
432395
Timeout: &podsReadyTimeoutOverwrite,
433396
RecoveryTimeout: &metav1.Duration{Duration: time.Minute},
@@ -469,7 +432,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
469432
},
470433
MultiKueue: defaultMultiKueue,
471434
ManagedJobsNamespaceSelector: defaultManagedJobsNamespaceSelector,
472-
WaitForPodsReady: &WaitForPodsReady{},
473435
},
474436
},
475437
"multiKueue": {
@@ -499,7 +461,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
499461
DispatcherName: ptr.To(MultiKueueDispatcherModeIncremental),
500462
},
501463
ManagedJobsNamespaceSelector: defaultManagedJobsNamespaceSelector,
502-
WaitForPodsReady: &WaitForPodsReady{},
503464
},
504465
},
505466
"multiKueue origin is an empty value": {
@@ -529,7 +490,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
529490
DispatcherName: defaultMultiKueue.DispatcherName,
530491
},
531492
ManagedJobsNamespaceSelector: defaultManagedJobsNamespaceSelector,
532-
WaitForPodsReady: &WaitForPodsReady{},
533493
},
534494
},
535495
"multiKueue GCInterval 0": {
@@ -557,7 +517,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
557517
DispatcherName: defaultMultiKueue.DispatcherName,
558518
},
559519
ManagedJobsNamespaceSelector: defaultManagedJobsNamespaceSelector,
560-
WaitForPodsReady: &WaitForPodsReady{},
561520
},
562521
},
563522
"add default fair sharing configuration when enabled": {
@@ -580,7 +539,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
580539
FairSharing: &FairSharing{
581540
PreemptionStrategies: []PreemptionStrategy{LessThanOrEqualToFinalShare, LessThanInitialShare},
582541
},
583-
WaitForPodsReady: &WaitForPodsReady{},
584542
},
585543
},
586544
"set object retention policy for workloads": {
@@ -611,7 +569,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
611569
AfterDeactivatedByKueue: &metav1.Duration{Duration: 30 * time.Minute},
612570
},
613571
},
614-
WaitForPodsReady: &WaitForPodsReady{},
615572
},
616573
},
617574
"resources.transformations strategy": {
@@ -644,7 +601,6 @@ func TestSetDefaults_Configuration(t *testing.T) {
644601
{Input: corev1.ResourceEphemeralStorage, Strategy: ptr.To(DefaultResourceTransformationStrategy)},
645602
},
646603
},
647-
WaitForPodsReady: &WaitForPodsReady{},
648604
},
649605
},
650606
}

0 commit comments

Comments
 (0)