diff --git a/cmd/index/job/exportation/main.go b/cmd/index/job/exportation/main.go index 8c16dd224b..25eaaadda7 100644 --- a/cmd/index/job/exportation/main.go +++ b/cmd/index/job/exportation/main.go @@ -38,7 +38,8 @@ func main() { runner.WithName(name), runner.WithVersion(info.Version, maxVersion, minVersion), runner.WithConfigLoader(func(path string) (any, *config.GlobalConfig, error) { - cfg, err := config.NewConfig(path) + // cfg, err := config.NewConfig(path) + cfg, err := config.NewConfig("cmd/index/job/exportation/sample.yaml") if err != nil { return nil, nil, errors.Wrap(err, "failed to load "+name+"'s configuration") } diff --git a/cmd/index/job/exportation/sample.yaml b/cmd/index/job/exportation/sample.yaml index 4ed586d02f..4cc6ce98fd 100644 --- a/cmd/index/job/exportation/sample.yaml +++ b/cmd/index/job/exportation/sample.yaml @@ -75,7 +75,7 @@ exporter: index_path: "/var/export/index" gateway: addrs: - - vald-lb-gateway.default.svc.cluster.local:8081 + - localhost:20000 health_check_duration: "1s" connection_pool: enable_dns_resolver: true diff --git a/pkg/index/job/exportation/usecase/exportation.go b/pkg/index/job/exportation/usecase/exportation.go index c244bea159..f21bf6e6ac 100644 --- a/pkg/index/job/exportation/usecase/exportation.go +++ b/pkg/index/job/exportation/usecase/exportation.go @@ -19,12 +19,16 @@ import ( "syscall" "github.com/vdaas/vald/internal/client/v1/client/vald" + iconf "github.com/vdaas/vald/internal/config" "github.com/vdaas/vald/internal/errors" "github.com/vdaas/vald/internal/log" + "github.com/vdaas/vald/internal/net/grpc" + "github.com/vdaas/vald/internal/net/grpc/interceptor/server/recover" "github.com/vdaas/vald/internal/observability" "github.com/vdaas/vald/internal/runner" "github.com/vdaas/vald/internal/safety" + "github.com/vdaas/vald/internal/servers/server" "github.com/vdaas/vald/internal/servers/starter" "github.com/vdaas/vald/internal/sync/errgroup" "github.com/vdaas/vald/pkg/index/job/exportation/config" @@ -74,29 +78,29 @@ func New(cfg *config.Data) (_ runner.Runner, err error) { } } - // grpcServerOptions := []server.Option{ - // server.WithGRPCOption( - // grpc.ChainUnaryInterceptor(recover.RecoverInterceptor()), - // grpc.ChainStreamInterceptor(recover.RecoverStreamInterceptor()), - // ), - // } - - // // For health check and metrics - // srv, err := starter.New(starter.WithConfig(cfg.Server), - // starter.WithGRPC(func(_ *iconf.Server) []server.Option { - // return grpcServerOptions - // }), - // ) - // if err != nil { - // return nil, err - // } + grpcServerOptions := []server.Option{ + server.WithGRPCOption( + grpc.ChainUnaryInterceptor(recover.RecoverInterceptor()), + grpc.ChainStreamInterceptor(recover.RecoverStreamInterceptor()), + ), + } + + // For health check and metrics + srv, err := starter.New(starter.WithConfig(cfg.Server), + starter.WithGRPC(func(_ *iconf.Server) []server.Option { + return grpcServerOptions + }), + ) + if err != nil { + return nil, err + } return &run{ eg: eg, cfg: cfg, observability: obs, - // server: srv, - exporter: exporter, + server: srv, + exporter: exporter, }, nil }