diff --git a/cmd/yurt-manager/yurt-manager b/cmd/yurt-manager/yurt-manager new file mode 100755 index 00000000000..7710cd7f039 Binary files /dev/null and b/cmd/yurt-manager/yurt-manager differ diff --git a/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/loadbalancerset_controller.go b/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/loadbalancerset_controller.go index b9813d412d5..654bac4d6e9 100644 --- a/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/loadbalancerset_controller.go +++ b/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/loadbalancerset_controller.go @@ -503,5 +503,5 @@ func (r *ReconcileLoadBalancerSet) compareAndUpdateService(svc *corev1.Service, return nil } - return r.Update(context.Background(), svc) + return r.Status().Update(context.Background(), svc) } diff --git a/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/predicate.go b/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/predicate.go index c329d17b151..0c4f0d55152 100644 --- a/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/predicate.go +++ b/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/predicate.go @@ -116,6 +116,10 @@ func isServiceChange(oldSvc, newSvc *v1.Service) bool { return true } + if isStatusChange(oldSvc, newSvc) { + return true + } + return false } @@ -142,6 +146,10 @@ func isAggregateAnnotationsChange(oldSvc, newSvc *v1.Service) bool { return !reflect.DeepEqual(oldAggregateAnnotations, newAggregateAnnotations) } +func isStatusChange(oldSvc, newSvc *v1.Service) bool { + return !reflect.DeepEqual(oldSvc.Status, newSvc.Status) +} + func NewPoolServicePredicated() predicate.Predicate { return predicate.Funcs{ CreateFunc: func(createEvent event.CreateEvent) bool { diff --git a/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/predicate_test.go b/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/predicate_test.go index b293f4cbe4e..ffd6add52c6 100644 --- a/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/predicate_test.go +++ b/pkg/yurtmanager/controller/loadbalancerset/loadbalancerset/predicate_test.go @@ -163,6 +163,15 @@ func TestServicePredicate(t *testing.T) { got := f.Update(event.UpdateEvent{ObjectOld: svc1, ObjectNew: svc2}) assertBool(t, true, got) }) + + t.Run("modify service status", func(t *testing.T) { + svc1 := newService(v1.NamespaceDefault, mockServiceName) + svc2 := newService(v1.NamespaceDefault, mockServiceName) + svc2.Status.LoadBalancer.Ingress = []v1.LoadBalancerIngress{{IP: "1.2.3.4"}} + + got := f.Update(event.UpdateEvent{ObjectOld: svc1, ObjectNew: svc2}) + assertBool(t, true, got) + }) } func assertBool(t testing.TB, expected, got bool) {