[full-ci] enhancement: use reva client pool selectors (#6452)

* enhancement: use reva client pool selectors

register mock service to registry and pass tests

* enhancement: bump reva

* Fix a couple of linter issues

---------

Co-authored-by: Ralf Haferkamp <rhaferkamp@owncloud.com>
This commit is contained in:
Florian Schade
2023-06-08 12:41:04 +02:00
committed by GitHub
co-authored by Ralf Haferkamp
parent 021c9fcdd9
commit 4f26424db6
157 changed files with 2845 additions and 1901 deletions
+16 -24
View File
@@ -10,7 +10,7 @@ import (
"github.com/gofrs/uuid"
"github.com/oklog/run"
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
"github.com/owncloud/ocis/v2/ocis-pkg/service/external"
"github.com/owncloud/ocis/v2/ocis-pkg/registry"
"github.com/owncloud/ocis/v2/ocis-pkg/sync"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
"github.com/owncloud/ocis/v2/services/storage-system/pkg/config"
@@ -42,12 +42,16 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
rcfg := revaconfig.StorageSystemFromStruct(cfg)
gr.Add(func() error {
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
rCfg := revaconfig.StorageSystemFromStruct(cfg)
reg := registry.GetRegistry()
runtime.RunWithOptions(rCfg, pidFile,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
)
return nil
}, func(err error) {
logger.Error().
@@ -77,26 +81,14 @@ func Server(cfg *config.Config) *cli.Command {
sync.Trap(&gr, cancel)
}
if err := external.RegisterGRPCEndpoint(
ctx,
cfg.GRPC.Namespace+"."+cfg.Service.Name,
uuid.Must(uuid.NewV4()).String(),
cfg.GRPC.Addr,
version.GetString(),
logger,
); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, uuid.Must(uuid.NewV4()).String(), cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service")
}
if err := external.RegisterHTTPEndpoint(
ctx,
cfg.HTTP.Namespace+"."+cfg.Service.Name,
uuid.Must(uuid.NewV4()).String(),
cfg.HTTP.Addr,
version.GetString(),
logger,
); err != nil {
logger.Fatal().Err(err).Msg("failed to register the http endpoint")
httpScv := registry.BuildHTTPService(cfg.HTTP.Namespace+"."+cfg.Service.Name, uuid.Must(uuid.NewV4()).String(), cfg.HTTP.Addr, version.GetString())
if err := registry.RegisterService(ctx, httpScv, logger); err != nil {
logger.Fatal().Err(err).Msg("failed to register the http service")
}
return gr.Run()
@@ -34,12 +34,12 @@ func StorageSystemFromStruct(cfg *config.Config) map[string]interface{} {
"services": map[string]interface{}{
"gateway": map[string]interface{}{
// registries are located on the gateway
"authregistrysvc": cfg.GRPC.Addr,
"storageregistrysvc": cfg.GRPC.Addr,
"authregistrysvc": "com.owncloud.api.storage-system",
"storageregistrysvc": "com.owncloud.api.storage-system",
// user metadata is located on the users services
"userprovidersvc": cfg.GRPC.Addr,
"groupprovidersvc": cfg.GRPC.Addr,
"permissionssvc": cfg.GRPC.Addr,
"userprovidersvc": "com.owncloud.api.storage-system",
"groupprovidersvc": "com.owncloud.api.storage-system",
"permissionssvc": "com.owncloud.api.storage-system",
// other
"disable_home_creation_on_login": true, // metadata manually creates a space
// metadata always uses the simple upload, so no transfer secret or datagateway needed
@@ -69,7 +69,7 @@ func StorageSystemFromStruct(cfg *config.Config) map[string]interface{} {
"drivers": map[string]interface{}{
"static": map[string]interface{}{
"rules": map[string]interface{}{
"machine": cfg.GRPC.Addr,
"machine": "com.owncloud.api.storage-system",
},
},
},
@@ -79,7 +79,7 @@ func StorageSystemFromStruct(cfg *config.Config) map[string]interface{} {
"auth_managers": map[string]interface{}{
"machine": map[string]interface{}{
"api_key": cfg.SystemUserAPIKey,
"gateway_addr": cfg.GRPC.Addr,
"gateway_addr": "com.owncloud.api.storage-system",
},
},
},
@@ -95,7 +95,7 @@ func StorageSystemFromStruct(cfg *config.Config) map[string]interface{} {
"static": map[string]interface{}{
"rules": map[string]interface{}{
"/": map[string]interface{}{
"address": cfg.GRPC.Addr,
"address": "com.owncloud.api.storage-system",
},
},
},
@@ -161,7 +161,7 @@ func metadataDrivers(cfg *config.Config) map[string]interface{} {
"user_layout": "{{.Id.OpaqueId}}",
"treetime_accounting": false,
"treesize_accounting": false,
"permissionssvc": cfg.GRPC.Addr,
"permissionssvc": "com.owncloud.api.storage-system",
"max_acquire_lock_cycles": cfg.Drivers.OCIS.MaxAcquireLockCycles,
"lock_cycle_duration_factor": cfg.Drivers.OCIS.LockCycleDurationFactor,
"statcache": map[string]interface{}{