[#1486] node: Introduce dual service support
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m17s
DCO action / DCO (pull_request) Successful in 1m48s
Vulncheck / Vulncheck (pull_request) Successful in 2m20s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m38s
Build / Build Components (pull_request) Successful in 2m54s
Tests and linters / Staticcheck (pull_request) Successful in 3m3s
Tests and linters / gopls check (pull_request) Successful in 3m13s
Tests and linters / Lint (pull_request) Successful in 4m0s
Tests and linters / Tests (pull_request) Successful in 4m46s
Tests and linters / Tests with -race (pull_request) Successful in 6m15s
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m17s
DCO action / DCO (pull_request) Successful in 1m48s
Vulncheck / Vulncheck (pull_request) Successful in 2m20s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m38s
Build / Build Components (pull_request) Successful in 2m54s
Tests and linters / Staticcheck (pull_request) Successful in 3m3s
Tests and linters / gopls check (pull_request) Successful in 3m13s
Tests and linters / Lint (pull_request) Successful in 4m0s
Tests and linters / Tests (pull_request) Successful in 4m46s
Tests and linters / Tests with -race (pull_request) Successful in 6m15s
* Register GRPC services for both neo.fs.v2 and frost.fs namespaces * Use this temporary solution until all nodes are updated Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
8a57c78f5f
commit
546332b471
6 changed files with 38 additions and 0 deletions
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/balance"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/balance"
|
||||||
accountingTransportGRPC "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/network/transport/accounting/grpc"
|
accountingTransportGRPC "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/network/transport/accounting/grpc"
|
||||||
|
@ -30,5 +31,27 @@ func initAccountingService(ctx context.Context, c *cfg) {
|
||||||
|
|
||||||
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
||||||
accountingGRPC.RegisterAccountingServiceServer(s, server)
|
accountingGRPC.RegisterAccountingServiceServer(s, server)
|
||||||
|
|
||||||
|
// TODO(@aarifullin): #1487 remove the dual service support.
|
||||||
|
s.RegisterService(frostFSServiceDesc(accountingGRPC.AccountingService_ServiceDesc), server)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// frostFSServiceDesc creates a service descriptor with the new namespace for dual service support.
|
||||||
|
func frostFSServiceDesc(sd grpc.ServiceDesc) *grpc.ServiceDesc {
|
||||||
|
sdLegacy := new(grpc.ServiceDesc)
|
||||||
|
*sdLegacy = sd
|
||||||
|
|
||||||
|
const (
|
||||||
|
legacyNamespace = "neo.fs.v2"
|
||||||
|
apemanagerLegacyNamespace = "frostfs.v2"
|
||||||
|
newNamespace = "frost.fs"
|
||||||
|
)
|
||||||
|
|
||||||
|
if strings.HasPrefix(sd.ServiceName, legacyNamespace) {
|
||||||
|
sdLegacy.ServiceName = strings.ReplaceAll(sd.ServiceName, legacyNamespace, newNamespace)
|
||||||
|
} else if strings.HasPrefix(sd.ServiceName, apemanagerLegacyNamespace) {
|
||||||
|
sdLegacy.ServiceName = strings.ReplaceAll(sd.ServiceName, apemanagerLegacyNamespace, newNamespace)
|
||||||
|
}
|
||||||
|
return sdLegacy
|
||||||
|
}
|
||||||
|
|
|
@ -26,5 +26,8 @@ func initAPEManagerService(c *cfg) {
|
||||||
|
|
||||||
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
||||||
apemanager_grpc.RegisterAPEManagerServiceServer(s, server)
|
apemanager_grpc.RegisterAPEManagerServiceServer(s, server)
|
||||||
|
|
||||||
|
// TODO(@aarifullin): #1487 remove the dual service support.
|
||||||
|
s.RegisterService(frostFSServiceDesc(apemanager_grpc.APEManagerService_ServiceDesc), server)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,9 @@ func initContainerService(_ context.Context, c *cfg) {
|
||||||
|
|
||||||
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
||||||
containerGRPC.RegisterContainerServiceServer(s, server)
|
containerGRPC.RegisterContainerServiceServer(s, server)
|
||||||
|
|
||||||
|
// TODO(@aarifullin): #1487 remove the dual service support.
|
||||||
|
s.RegisterService(frostFSServiceDesc(containerGRPC.ContainerService_ServiceDesc), server)
|
||||||
})
|
})
|
||||||
|
|
||||||
c.cfgObject.cfgLocalStorage.localStorage.SetContainerSource(cnrRdr)
|
c.cfgObject.cfgLocalStorage.localStorage.SetContainerSource(cnrRdr)
|
||||||
|
|
|
@ -166,6 +166,9 @@ func initNetmapService(ctx context.Context, c *cfg) {
|
||||||
|
|
||||||
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
||||||
netmapGRPC.RegisterNetmapServiceServer(s, server)
|
netmapGRPC.RegisterNetmapServiceServer(s, server)
|
||||||
|
|
||||||
|
// TODO(@aarifullin): #1487 remove the dual service support.
|
||||||
|
s.RegisterService(frostFSServiceDesc(netmapGRPC.NetmapService_ServiceDesc), server)
|
||||||
})
|
})
|
||||||
|
|
||||||
addNewEpochNotificationHandlers(c)
|
addNewEpochNotificationHandlers(c)
|
||||||
|
|
|
@ -218,6 +218,9 @@ func initObjectService(c *cfg) {
|
||||||
|
|
||||||
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
||||||
objectGRPC.RegisterObjectServiceServer(s, server)
|
objectGRPC.RegisterObjectServiceServer(s, server)
|
||||||
|
|
||||||
|
// TODO(@aarifullin): #1487 remove the dual service support.
|
||||||
|
s.RegisterService(frostFSServiceDesc(objectGRPC.ObjectService_ServiceDesc), server)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,5 +61,8 @@ func initSessionService(c *cfg) {
|
||||||
|
|
||||||
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
|
||||||
sessionGRPC.RegisterSessionServiceServer(s, server)
|
sessionGRPC.RegisterSessionServiceServer(s, server)
|
||||||
|
|
||||||
|
// TODO(@aarifullin): #1487 remove the dual service support.
|
||||||
|
s.RegisterService(frostFSServiceDesc(sessionGRPC.SessionService_ServiceDesc), server)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue