@@ -222,6 +222,7 @@ func (ndr *SingleNodeDisruptionReconciler) getRetryDate() metav1.Time {
222
222
// tryTransitionToGranted attempt to transition to the granted state but can result in either pending or rejected
223
223
func (ndr * SingleNodeDisruptionReconciler ) tryTransitionToGranted (ctx context.Context ) (err error ) {
224
224
nextRetryDate := ndr .getRetryDate ()
225
+ logger := log .FromContext (ctx )
225
226
226
227
var state nodedisruptionv1alpha1.NodeDisruptionState
227
228
@@ -245,6 +246,11 @@ func (ndr *SingleNodeDisruptionReconciler) tryTransitionToGranted(ctx context.Co
245
246
if ! nextRetryDate .IsZero () {
246
247
state = nodedisruptionv1alpha1 .Pending
247
248
} else {
249
+ for _ , status := range statuses {
250
+ if ! status .Ok {
251
+ logger .Info ("Disruption rejected" , "status" , status )
252
+ }
253
+ }
248
254
state = nodedisruptionv1alpha1 .Rejected
249
255
}
250
256
}
@@ -314,7 +320,7 @@ func (ndr *SingleNodeDisruptionReconciler) ValidateWithInternalConstraints(ctx c
314
320
if ndr .NodeDisruption .Spec .Retry .IsAfterDeadline () {
315
321
status := nodedisruptionv1alpha1.DisruptedBudgetStatus {
316
322
Reference : ndr .getNodeDisruptionReference (),
317
- Reason : "Deadline exceeded" ,
323
+ Reason : fmt . Sprintf ( "Failed to grant maintenance before deadline (deadline: %s)" , ndr . NodeDisruption . Spec . Retry . Deadline ) ,
318
324
Ok : false ,
319
325
}
320
326
// Conserve the statuses of the previous iteration to conserve the reason of rejection
@@ -338,7 +344,7 @@ func (ndr *SingleNodeDisruptionReconciler) ValidateWithInternalConstraints(ctx c
338
344
if len (ndr .Config .NodeDisruptionTypes ) != 0 && ! slices .Contains (ndr .Config .NodeDisruptionTypes , ndr .NodeDisruption .Spec .Type ) {
339
345
status := nodedisruptionv1alpha1.DisruptedBudgetStatus {
340
346
Reference : ndr .getNodeDisruptionReference (),
341
- Reason : "Type provided of node disruption is not managed" ,
347
+ Reason : fmt . Sprintf ( "Type of node disruption provided is not allowed (supported: %s) (see --node-disruption-types on the controller)" , ndr . Config . NodeDisruptionTypes ) ,
342
348
Ok : false ,
343
349
}
344
350
return true , []nodedisruptionv1alpha1.DisruptedBudgetStatus {status }, nil
@@ -350,7 +356,6 @@ func (ndr *SingleNodeDisruptionReconciler) ValidateWithInternalConstraints(ctx c
350
356
// ValidateBudgetConstraints check that the Node Disruption is valid against the budgets defined in the cluster
351
357
func (ndr * SingleNodeDisruptionReconciler ) ValidateWithBudgetConstraints (ctx context.Context , budgets []Budget ) (anyFailed bool , statuses []nodedisruptionv1alpha1.DisruptedBudgetStatus ) {
352
358
disruptedNodes := resolver .NewNodeSetFromStringList (ndr .NodeDisruption .Status .DisruptedNodes )
353
- logger := log .FromContext (ctx )
354
359
anyFailed = false
355
360
356
361
impactedBudgets := []Budget {}
@@ -368,7 +373,6 @@ func (ndr *SingleNodeDisruptionReconciler) ValidateWithBudgetConstraints(ctx con
368
373
Ok : false ,
369
374
}
370
375
statuses = append (statuses , status )
371
- logger .Info ("Disruption rejected because: " , "status" , status )
372
376
DisruptionBudgetRejectedTotal .WithLabelValues (ref .Namespace , ref .Name , ref .Kind ).Inc ()
373
377
break
374
378
}
@@ -390,7 +394,6 @@ func (ndr *SingleNodeDisruptionReconciler) ValidateWithBudgetConstraints(ctx con
390
394
Ok : false ,
391
395
}
392
396
statuses = append (statuses , status )
393
- logger .Info ("Disruption rejected because: " , "status" , status )
394
397
DisruptionBudgetRejectedTotal .WithLabelValues (ref .Namespace , ref .Name , ref .Kind ).Inc ()
395
398
break
396
399
}
0 commit comments