Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use storageproviderid for routing #2792

Merged
merged 1 commit into from
May 12, 2022

Conversation

butonic
Copy link
Contributor

@butonic butonic commented Apr 28, 2022

We made the spaces registry aware of storageprovider ids and use them to route directly to the correct storageprovider.

Path based requests can be optimized in a subsequent PR

based on #2790

@butonic butonic force-pushed the use-storageproviderid-for-routing branch 2 times, most recently from 0241146 to b1cbab8 Compare April 28, 2022 18:26
@butonic
Copy link
Contributor Author

butonic commented Apr 28, 2022

hmmm https://drone.cernbox.cern.ch/cs3org/reva/6832/11/4

2313 | 2022-04-28 18:31:55.751 DBG ../../../internal/grpc/interceptors/log/log.go:66 > unary code=OK end="28/Apr/2022:18:31:55 +0000" from=tcp://127.0.0.1:46622 pid=10 pkg=rgrpc start="28/Apr/2022:18:31:55 +0000" time_ns=2421099 traceid=3ed030a605c682a4e13ae9299b49a890 uri=/cs3.storage.registry.v1beta1.RegistryAPI/ListStorageProviders user-agent=grpc-go/1.45.0
2314 | 2022-04-28 18:31:55.751 DBG ../../../internal/grpc/interceptors/log/log.go:66 > unary code=OK end="28/Apr/2022:18:31:55 +0000" from=tcp://127.0.0.1:47382 pid=10 pkg=rgrpc start="28/Apr/2022:18:31:55 +0000" time_ns=3143163 traceid=d17d344849ff94158b8534bda35c5e3f uri=/cs3.gateway.v1beta1.GatewayAPI/Stat user-agent=grpc-go/1.45.0
2315 | 2022-04-28 18:31:55.752 ERR ../../../internal/grpc/interceptors/auth/scope.go:87 > error resolving reference resource_id:<storage_id:"1284d238-aa92-42ce-bdc4-0b0000009157$ddc2004c-0977-11eb-9d3f-a793888cd0f8" opaque_id:"ddc2004c-0977-11eb-9d3f-a793888cd0f8" > path:"./public-office-documents"  under scope publicshare:xODuupRnkViQwWg error="error: permission denied: request is not for a nested resource" pid=10 pkg=rgrpc traceid=49f9813d3892cf89f31b5fbac3e5e301
2316 | 2022-04-28 18:31:55.752 WRN ../../../internal/grpc/interceptors/auth/auth.go:122 > access token is invalid error="error: permission denied: access to resource opaque:<map:<key:\"opaque_id\" value:<decoder:\"plain\" value:\"ddc2004c-0977-11eb-9d3f-a793888cd0f8\" > > map:<key:\"path\" value:<decoder:\"plain\" value:\"./public-office-documents\" > > map:<key:\"storage_id\" value:<decoder:\"plain\" value:\"1284d238-aa92-42ce-bdc4-0b0000009157$ddc2004c-0977-11eb-9d3f-a793888cd0f8\" > > >  not allowed within the assigned scope" pid=10 pkg=rgrpc traceid=49f9813d3892cf89f31b5fbac3e5e301
2317 | 2022-04-28 18:31:55.752 ERR ../../../internal/grpc/interceptors/log/log.go:66 > unary code=PermissionDenied end="28/Apr/2022:18:31:55 +0000" from=tcp://127.0.0.1:46622 pid=10 pkg=rgrpc start="28/Apr/2022:18:31:55 +0000" time_ns=3973737 traceid=49f9813d3892cf89f31b5fbac3e5e301 uri=/cs3.storage.registry.v1beta1.RegistryAPI/ListStorageProviders user-agent=grpc-go/1.45.0

it seems the public scope cannot properly resolve the resuorce ... but why does it work with the ocis driver: https://drone.cernbox.cern.ch/cs3org/reva/6832/10/3

@butonic
Copy link
Contributor Author

butonic commented May 6, 2022

needs to be rebased when sharing jail is merged

@@ -76,7 +77,8 @@ func (sc *spaceConfig) SpacePath(currentUser *userpb.User, space *providerpb.Sto
// Provider holds information on Spaces
type Provider struct {
// Spaces is a map from space type to space config
Spaces map[string]*spaceConfig `mapstructure:"spaces"`
Spaces map[string]*spaceConfig `mapstructure:"spaces"`
ProviderID string `mapstructure:"providerid"`
Copy link
Contributor

@ishank011 ishank011 May 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generate provider IDs dynamically. Can you make these work with regexes?

"eoshome-[dlntz]" = { address = "localhost:16000" }
"eoshome-[agjkw]" = { address = "localhost:16001" }
"eoshome-[horsy]" = { address = "localhost:16002" }
"eoshome-[bemvx]" = { address = "localhost:16003" }
"eoshome-[cfipqu]" = { address = "localhost:16004" }

For example, provider IDs 1284d238-aa92-42ce-bdc4-0b000000[9157-9159] should go to localhost:11000

Copy link
Contributor

@ishank011 ishank011 May 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And doing a ListProviders without any filters should ideally return all of these:

[
  {address: localhost:11000, provider_id: 1284d238-aa92-42ce-bdc4-0b0000009157},
  {address: localhost:11000, provider_id: 1284d238-aa92-42ce-bdc4-0b0000009158},
  {address: localhost:11000, provider_id: 1284d238-aa92-42ce-bdc4-0b0000009159}
]

Copy link
Contributor Author

@butonic butonic May 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can look into this in a separate PR! tracked in #2859

@butonic butonic force-pushed the use-storageproviderid-for-routing branch 2 times, most recently from de5e5d3 to ce605fc Compare May 11, 2022 15:38
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@butonic butonic force-pushed the use-storageproviderid-for-routing branch from ce605fc to 4df5ebe Compare May 11, 2022 15:44
@sonarcloud
Copy link

sonarcloud bot commented May 11, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@butonic butonic marked this pull request as ready for review May 12, 2022 06:22
@butonic butonic requested review from labkode, glpatcern and a team as code owners May 12, 2022 06:22
@butonic
Copy link
Contributor Author

butonic commented May 12, 2022

@micbar @kobergj @aduffeck owncloud/ocis#3726 got green as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants