From b5de93d3c55710429513c9cab59d47dd20c5cf78 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Mon, 18 Dec 2023 02:12:47 +0000 Subject: [PATCH] Disable service controller for now --- pkg/discoverer/k8s/handler/grpc/handler.go | 2 +- pkg/discoverer/k8s/service/discover.go | 50 +++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/pkg/discoverer/k8s/handler/grpc/handler.go b/pkg/discoverer/k8s/handler/grpc/handler.go index 650acc8eb0..8635e20124 100644 --- a/pkg/discoverer/k8s/handler/grpc/handler.go +++ b/pkg/discoverer/k8s/handler/grpc/handler.go @@ -224,7 +224,7 @@ func (s *server) Nodes(ctx context.Context, req *payload.Discoverer_Request) (*p return cn, nil } -// Services returns the services infomation that match the request. +// Services returns the services information that match the request. func (s *server) Services(ctx context.Context, req *payload.Discoverer_Request) (*payload.Info_Services, error) { ctx, span := trace.StartSpan(ctx, apiName+".Services") defer func() { diff --git a/pkg/discoverer/k8s/service/discover.go b/pkg/discoverer/k8s/service/discover.go index aac64ad8d2..b0d72595ad 100644 --- a/pkg/discoverer/k8s/service/discover.go +++ b/pkg/discoverer/k8s/service/discover.go @@ -182,31 +182,31 @@ func New(selector *config.Selectors, opts ...Option) (dsc Discoverer, err error) node.WithLabels(selector.GetNodeLabels()), )), // Only required when service reconciation is required like read replica. - k8s.WithResourceController(service.New( - service.WithControllerName("service discoverer"), - service.WithOnErrorFunc(func(err error) { - log.Error("failed to reconcile:", err) - }), - service.WithOnReconcileFunc(func(svcs []service.Service) { - log.Debugf("svc resource reconciled\t%#v", svcs) - svcsmap := make(map[string]struct{}, len(svcs)) - for i := range svcs { - svc := &svcs[i] - svcsmap[svc.Name] = struct{}{} - d.services.Store(svc.Name, svc) - } - d.services.Range(func(name string, _ *service.Service) bool { - _, ok := svcsmap[name] - if !ok { - d.services.Delete(name) - } - return true - }) - }), - service.WithNamespace(d.namespace), - service.WithFields(selector.GetServiceFields()), - service.WithLabels(selector.GetServiceLabels()), - )), + // k8s.WithResourceController(service.New( + // service.WithControllerName("service discoverer"), + // service.WithOnErrorFunc(func(err error) { + // log.Error("failed to reconcile:", err) + // }), + // service.WithOnReconcileFunc(func(svcs []service.Service) { + // log.Debugf("svc resource reconciled\t%#v", svcs) + // svcsmap := make(map[string]struct{}, len(svcs)) + // for i := range svcs { + // svc := &svcs[i] + // svcsmap[svc.Name] = struct{}{} + // d.services.Store(svc.Name, svc) + // } + // d.services.Range(func(name string, _ *service.Service) bool { + // _, ok := svcsmap[name] + // if !ok { + // d.services.Delete(name) + // } + // return true + // }) + // }), + // service.WithNamespace(d.namespace), + // service.WithFields(selector.GetServiceFields()), + // service.WithLabels(selector.GetServiceLabels()), + // )), ) d.ctrl, err = k8s.New(k8sOpts...)