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

feat: add multi tenant #553

Merged
merged 3 commits into from
Mar 25, 2023
Merged

feat: add multi tenant #553

merged 3 commits into from
Mar 25, 2023

Conversation

xdlbdy
Copy link
Contributor

@xdlbdy xdlbdy commented Mar 17, 2023

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary

What is changed and how does it work?

for multi-tenant: add the namespace, user, token, role, and eventbus, subscription add optional param namespace which default is default namespace

for authentication: vsctl add param token

  1. create a user (the default existing token is admin which belongs to user admin who is a clusterAdmin role)
vsctl user create --user vanus --description test
  1. create a token for a user
vsctl user token create --user vanus 
  1. grant a resource and a role to a user
vsctl namespace grant --user vanus --role admin --name 0000001238000010 
  1. use the token for the user vanus
export VANUS_TOKEN=xxxxxx

or

vsctl --token=xxxxxx

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

@xdlbdy xdlbdy marked this pull request as draft March 17, 2023 03:31
@xdlbdy xdlbdy force-pushed the user_role branch 2 times, most recently from 996ee05 to d59f66c Compare March 21, 2023 03:17
@xdlbdy xdlbdy marked this pull request as ready for review March 21, 2023 03:17
@xdlbdy xdlbdy requested a review from ifplusor as a code owner March 21, 2023 03:17
@codecov
Copy link

codecov bot commented Mar 21, 2023

Codecov Report

Merging #553 (f30076a) into main (ee76217) will decrease coverage by 2.73%.
The diff coverage is 39.68%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #553      +/-   ##
==========================================
- Coverage   57.07%   54.35%   -2.73%     
==========================================
  Files         190      211      +21     
  Lines       15191    17155    +1964     
==========================================
+ Hits         8670     9324     +654     
- Misses       5884     7129    +1245     
- Partials      637      702      +65     
Impacted Files Coverage Δ
internal/controller/eventbus/block/block.go 35.93% <0.00%> (-16.70%) ⬇️
internal/controller/eventbus/block/selector.go 91.66% <ø> (-8.34%) ⬇️
internal/controller/trigger/storage/storage.go 0.00% <ø> (ø)
internal/controller/trigger/worker/policy.go 100.00% <ø> (ø)
internal/gateway/proxy/auth.go 0.00% <0.00%> (ø)
internal/gateway/proxy/deadletter.go 0.00% <0.00%> (ø)
internal/gateway/proxy/util.go 0.00% <0.00%> (ø)
internal/primitive/authentication/client.go 0.00% <0.00%> (ø)
internal/primitive/authorization/action.go 0.00% <0.00%> (ø)
internal/primitive/authorization/client.go 0.00% <0.00%> (ø)
... and 74 more

... and 48 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19445de...f30076a. Read the comment docs.

Signed-off-by: xdlbdy <xdlbdy@gmail.com>
Signed-off-by: xdlbdy <xdlbdy@gmail.com>
@xdlbdy xdlbdy requested a review from hwjiangkai March 24, 2023 08:19
internal/controller/eventbus/controller.go Show resolved Hide resolved
internal/controller/tenant/manager/role.go Outdated Show resolved Hide resolved
internal/controller/tenant/manager/role.go Outdated Show resolved Hide resolved
internal/controller/tenant/manager/token.go Outdated Show resolved Hide resolved
internal/gateway/proxy/direct.go Outdated Show resolved Hide resolved
internal/gateway/proxy/direct.go Show resolved Hide resolved
pkg/cluster/controller.go Outdated Show resolved Hide resolved
pkg/errors/errors.go Show resolved Hide resolved
vsctl/command/eventbus.go Outdated Show resolved Hide resolved
vsctl/command/global.go Outdated Show resolved Hide resolved
Signed-off-by: xdlbdy <xdlbdy@gmail.com>
@xdlbdy xdlbdy merged commit 4ec5540 into vanus-labs:main Mar 25, 2023
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.

None yet

2 participants