зеркало из https://github.com/Azure/ARO-RP.git
Merge pull request #3720 from Azure/atokubi/node
fix repeated reconciliation in node controller
This commit is contained in:
Коммит
ef9b8d1ab8
|
@ -11,6 +11,7 @@ import (
|
|||
|
||||
"github.com/sirupsen/logrus"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
|
@ -64,9 +65,12 @@ func (r *Reconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.
|
|||
node := &corev1.Node{}
|
||||
err = r.Client.Get(ctx, types.NamespacedName{Name: request.Name}, node)
|
||||
if err != nil {
|
||||
if kerrors.IsNotFound(err) {
|
||||
r.Log.Debug(fmt.Sprintf("node %s not found", node.Name))
|
||||
return reconcile.Result{}, nil
|
||||
}
|
||||
r.Log.Error(err)
|
||||
r.SetDegraded(ctx, err)
|
||||
|
||||
return reconcile.Result{}, err
|
||||
}
|
||||
|
||||
|
|
|
@ -68,16 +68,9 @@ func TestReconciler(t *testing.T) {
|
|||
},
|
||||
},
|
||||
featureFlag: true,
|
||||
wantErr: `nodes "nonexistent-node" not found`,
|
||||
wantErr: "",
|
||||
startConditions: defaultConditions,
|
||||
wantConditions: []operatorv1.OperatorCondition{defaultAvailable, defaultProgressing,
|
||||
{
|
||||
Type: ControllerName + "Controller" + operatorv1.OperatorStatusTypeDegraded,
|
||||
Status: operatorv1.ConditionTrue,
|
||||
LastTransitionTime: transitionTime,
|
||||
Message: `nodes "nonexistent-node" not found`,
|
||||
},
|
||||
},
|
||||
wantConditions: defaultConditions,
|
||||
},
|
||||
{
|
||||
name: "can't fetch cluster instance",
|
||||
|
|
Загрузка…
Ссылка в новой задаче