11//
22// DISCLAIMER
33//
4- // Copyright 2023 ArangoDB GmbH, Cologne, Germany
4+ // Copyright 2023-2024 ArangoDB GmbH, Cologne, Germany
55//
66// Licensed under the Apache License, Version 2.0 (the "License");
77// you may not use this file except in compliance with the License.
@@ -25,8 +25,11 @@ import (
2525
2626 "github.com/rs/zerolog/log"
2727 "github.com/spf13/cobra"
28+ "google.golang.org/grpc"
2829
30+ pbShutdown "github.com/arangodb/kube-arangodb/pkg/api/shutdown/v1"
2931 "github.com/arangodb/kube-arangodb/pkg/ml/storage"
32+ "github.com/arangodb/kube-arangodb/pkg/util/probe"
3033 "github.com/arangodb/kube-arangodb/pkg/util/shutdown"
3134 "github.com/arangodb/kube-arangodb/pkg/util/svc"
3235)
4952 storage.ServiceConfig
5053 }
5154
52- cmdMLShutdownOptions struct {
53- shutdown. ServiceConfig
55+ cmdMLStorageControllerOptions struct {
56+ svc. GRPCConfig
5457 }
5558)
5659
@@ -59,7 +62,7 @@ func init() {
5962 cmdMLStorage .AddCommand (cmdMLStorageS3 )
6063
6164 f := cmdMLStorageS3 .PersistentFlags ()
62- f .StringVar (& cmdMLShutdownOptions .ListenAddress , "shutdown .address" , "" , "Address the GRPC shutdown service will listen on (IP:port)" )
65+ f .StringVar (& cmdMLStorageControllerOptions .ListenAddress , "controller .address" , "" , "Address the GRPC controller service will listen on (IP:port)" )
6366 f .StringVar (& cmdMLStorageS3Options .ListenAddress , "server.address" , "" , "Address the GRPC service will listen on (IP:port)" )
6467
6568 f .StringVar (& cmdMLStorageS3Options .S3 .Endpoint , "s3.endpoint" , "" , "Endpoint of S3 API implementation" )
@@ -81,10 +84,16 @@ func cmdMLStorageS3Run(cmd *cobra.Command, _ []string) {
8184}
8285
8386func cmdMLStorageS3RunE (_ * cobra.Command ) error {
84- service , err := storage .NewService (shutdown .Context (), storage .StorageTypeS3Proxy , cmdMLStorageS3Options .ServiceConfig )
87+ storageService , err := storage .NewService (shutdown .Context (), storage .StorageTypeS3Proxy , cmdMLStorageS3Options .ServiceConfig )
8588 if err != nil {
8689 return err
8790 }
8891
89- return svc .RunServices (shutdown .Context (), service , shutdown .ServiceCentral (cmdMLShutdownOptions .ServiceConfig ))
92+ healthService := probe .NewHealthService ()
93+
94+ controllerService := svc .NewGRPC (cmdMLStorageControllerOptions .GRPCConfig , func (server * grpc.Server ) {
95+ pbShutdown .RegisterShutdownServer (server , shutdown .NewShutdownableShutdownServer ())
96+ healthService .Register (server )
97+ })
98+ return svc .RunServices (shutdown .Context (), healthService , storageService , controllerService )
9099}
0 commit comments