From dfb9db8f61ae0e50be7aa28d47ae1b8724a695b1 Mon Sep 17 00:00:00 2001 From: liuwei Date: Fri, 11 Dec 2020 13:40:31 +0800 Subject: [PATCH] update managed cluster unknown condition message Signed-off-by: liuwei --- pkg/hub/lease/controller.go | 9 ++++----- pkg/hub/lease/controller_test.go | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/hub/lease/controller.go b/pkg/hub/lease/controller.go index 20f846890..2d074e577 100644 --- a/pkg/hub/lease/controller.go +++ b/pkg/hub/lease/controller.go @@ -108,11 +108,10 @@ func (c *leaseController) sync(ctx context.Context, syncCtx factory.SyncContext) // the lease is not constantly updated, update it to unknown conditionUpdateFn := helpers.UpdateManagedClusterConditionFn(metav1.Condition{ - Type: clusterv1.ManagedClusterConditionAvailable, - Status: metav1.ConditionUnknown, - Reason: "ManagedClusterLeaseUpdateStopped", - Message: fmt.Sprintf("Registration agent stopped updating its lease within %.0f minutes.", - now.Sub(observedLease.Spec.RenewTime.Time).Minutes()), + Type: clusterv1.ManagedClusterConditionAvailable, + Status: metav1.ConditionUnknown, + Reason: "ManagedClusterLeaseUpdateStopped", + Message: fmt.Sprintf("Registration agent stopped updating its lease."), }) _, updated, err := helpers.UpdateManagedClusterStatus(ctx, c.clusterClient, cluster.Name, conditionUpdateFn) if err != nil { diff --git a/pkg/hub/lease/controller_test.go b/pkg/hub/lease/controller_test.go index e38b45456..b26329940 100644 --- a/pkg/hub/lease/controller_test.go +++ b/pkg/hub/lease/controller_test.go @@ -53,7 +53,7 @@ func TestSync(t *testing.T) { Type: clusterv1.ManagedClusterConditionAvailable, Status: metav1.ConditionUnknown, Reason: "ManagedClusterLeaseUpdateStopped", - Message: "Registration agent stopped updating its lease within 5 minutes.", + Message: "Registration agent stopped updating its lease.", } testinghelpers.AssertActions(t, clusterActions, "get", "update") actual := clusterActions[1].(clienttesting.UpdateActionImpl).Object