Skip to content

add/support enabled_tenants and disabled_tenants feature in storegateway #5186

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

Conversation

moki1202
Copy link
Contributor

@moki1202 moki1202 commented Feb 28, 2023

Signed-off-by: Shashank [email protected]

What this PR does: Now adds/supports enabled_tenants and disabled_tenants in package storegateway

Fixes #5133

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

PR still in progress.

@moki1202
Copy link
Contributor Author

moki1202 commented Mar 2, 2023

@friedrichg Do I need to create a new function to filter out users that are not allowed?

@friedrichg
Copy link
Member

@moki1202 Store-gateways download the bucket index for the tenant and all the blocks. I would expect that this PR to ignore users discovered in S3 that are not allowed. a new function is not required, use allowedTenants.IsAllowed
See this PR for an example

@moki1202
Copy link
Contributor Author

moki1202 commented Mar 2, 2023

@friedrichg Is there a function/map that stores all the incoming users in the bucket? I tried finding it in the stores field but had no luck.

@friedrichg
Copy link
Member

@moki1202 filterUsers function is already in the right places

if len(f.strategy.FilterUsers(ctx, []string{f.userID})) != 1 {

for _, userID := range u.shardingStrategy.FilterUsers(ctx, userIDs) {

Concentrate making changes on https://github.com/cortexproject/cortex/blob/master/pkg/storegateway/sharding_strategy.go
to implement this feature on both normal sharding and shuffle sharding
and don't forget to update/include tests in sharding_strategy_test.go

@moki1202
Copy link
Contributor Author

moki1202 commented Mar 6, 2023

@moki1202 filterUsers function is already in the right places

if len(f.strategy.FilterUsers(ctx, []string{f.userID})) != 1 {

for _, userID := range u.shardingStrategy.FilterUsers(ctx, userIDs) {

Concentrate making changes on https://github.com/cortexproject/cortex/blob/master/pkg/storegateway/sharding_strategy.go to implement this feature on both normal sharding and shuffle sharding and don't forget to update/include tests in sharding_strategy_test.go

understood! I'll try this.

@moki1202 moki1202 force-pushed the enable_disable_tenants_storegateway branch from b38ba42 to 6054659 Compare March 14, 2023 15:36
@pull-request-size pull-request-size bot added size/M and removed size/S labels Mar 14, 2023
@moki1202 moki1202 force-pushed the enable_disable_tenants_storegateway branch from 6054659 to a8bd542 Compare March 16, 2023 13:26
@moki1202 moki1202 force-pushed the enable_disable_tenants_storegateway branch from a8bd542 to 1e179ec Compare May 22, 2023 14:03
@moki1202 moki1202 force-pushed the enable_disable_tenants_storegateway branch from 1e179ec to a18fcd9 Compare July 24, 2023 15:14
Signed-off-by: Shashank <[email protected]>
@moki1202 moki1202 force-pushed the enable_disable_tenants_storegateway branch from a18fcd9 to 204f95c Compare July 24, 2023 15:15
@moki1202 moki1202 marked this pull request as ready for review July 25, 2023 11:09
@moki1202
Copy link
Contributor Author

@friedrichg I've tried a lot but I am struggling while updating the tests. Can you please help me out here? I would just ask for your help in updating the defaultShardingStrategy tests. I'll try doing the other ones after.

@@ -107,6 +119,12 @@ func (s *ShuffleShardingStrategy) FilterUsers(_ context.Context, userIDs []strin
for _, userID := range userIDs {
subRing := GetShuffleShardingSubring(s.r, userID, s.limits)

//filter out users not owned by this shard.
if !s.allowedTenants.IsAllowed(userID) {
Copy link
Member

Choose a reason for hiding this comment

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

No, we need the GetShuffleShardingSubring on the filtered users, otherwise we might end up with store-gateways running without users

@@ -64,6 +67,21 @@ func TestDefaultShardingStrategy(t *testing.T) {
"127.0.0.2": {block2, block4},
},
},
"two ACTIVE instances in the ring with replication factor = 1 and one tenant disabled": {
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately, this function does not test FilterUsers, it tests FilterBlocks. So this is not the right place

@friedrichg
Copy link
Member

Thanks, partially included in #5638

@friedrichg friedrichg closed this Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support enabled_tenants and disabled_tenants in store-gateway
2 participants