Merge pull request #71 from negz/scheduleharder
Requeue when no resource claims match labels or default annotations
This commit is contained in:
commit
1b6638be27
|
|
@ -130,9 +130,12 @@ func (r *ClaimDefaultingReconciler) Reconcile(req reconcile.Request) (reconcile.
|
|||
}
|
||||
|
||||
if len(defaults) == 0 {
|
||||
// None of our classes are annotated as the default.
|
||||
// There's nothing for us to do.
|
||||
return reconcile.Result{Requeue: false}, nil
|
||||
// None of our classes are annotated as the default. We can't be sure
|
||||
// whether another controller owns the default class, or whether there
|
||||
// is no default class, so we requeue after a short wait. We'll abort
|
||||
// the next reconcile immediately if another controller defaulted the
|
||||
// claim.
|
||||
return reconcile.Result{RequeueAfter: aShortWait}, nil
|
||||
}
|
||||
|
||||
random := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ func TestClaimDefaultingReconciler(t *testing.T) {
|
|||
of: ClaimKind(MockGVK(&MockClaim{})),
|
||||
to: ClassKind(MockGVK(&MockClass{})),
|
||||
},
|
||||
want: want{result: reconcile.Result{Requeue: false}},
|
||||
want: want{result: reconcile.Result{RequeueAfter: aShortWait}},
|
||||
},
|
||||
"UpdateClaimError": {
|
||||
args: args{
|
||||
|
|
|
|||
|
|
@ -133,9 +133,11 @@ func (r *ClaimSchedulingReconciler) Reconcile(req reconcile.Request) (reconcile.
|
|||
}
|
||||
|
||||
if len(classes.Items) == 0 {
|
||||
// None of our classes matched the class selector.
|
||||
// There's nothing for us to do.
|
||||
return reconcile.Result{Requeue: false}, nil
|
||||
// None of our classes matched the selector. We can't be sure whether
|
||||
// another controller owns classes that matched the selector, or whether
|
||||
// no classes match, so we requeue after a short wait. We'll abort the
|
||||
// next reconcile immediately if another controller scheduled the claim.
|
||||
return reconcile.Result{RequeueAfter: aShortWait}, nil
|
||||
}
|
||||
|
||||
random := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ func TestClaimSchedulingReconciler(t *testing.T) {
|
|||
of: ClaimKind(MockGVK(&MockClaim{})),
|
||||
to: ClassKind(MockGVK(&MockClass{})),
|
||||
},
|
||||
want: want{result: reconcile.Result{Requeue: false}},
|
||||
want: want{result: reconcile.Result{RequeueAfter: aShortWait}},
|
||||
},
|
||||
"UpdateClaimError": {
|
||||
args: args{
|
||||
|
|
|
|||
Loading…
Reference in New Issue