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

dashboard: support token #1188

Merged
merged 52 commits into from
Dec 4, 2020
Merged

dashboard: support token #1188

merged 52 commits into from
Dec 4, 2020

Conversation

WangXiangUSTC
Copy link
Contributor

@WangXiangUSTC WangXiangUSTC commented Nov 19, 2020

What problem does this PR solve?

RFC: https://github.com/chaos-mesh/rfcs/blob/main/text/2020-10-22-authn-and-authz-on-chaos-dashboard.md

Resolve #1092

Chaos can be created and deleted by anyone who has access to the dashboard, and the authority of the dashboard is very high, which means the Dashboard is a big security hazard.

The dashboard should use the k8s client with a token to visit the k8s cluster, and the token is provided by the user in the dashboard frontend. Users can only do chaos which is allowed by the token generated by the service account.

What is changed and how does it work?

  • Add a k8s client pool implement by LRU, and it will save several clients in the cache.
  • HTTP API will extract the token and get k8s client from the client pool.
  • The dashboard will be prompt you to add a token when first open.
  • Support token switching in the dashboard.
  • Support namespace switching in the dashboard.

Checklist

Tests

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

Side effects

  • Breaking backward compatibility

Related changes

  • Need to update the documentation

Does this PR introduce a user-facing change?

image

image

WangXiangUSTC and others added 30 commits October 27, 2020 18:25
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: wanyoulc <15694528183@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
This reverts commit d54de84.
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: wanyoulc <15694528183@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: wanyoulc <15694528183@163.com>
Signed-off-by: wanyoulc <15694528183@163.com>
Signed-off-by: wanyoulc <15694528183@163.com>
Signed-off-by: wanyoulc <15694528183@163.com>
* fix: experiment status

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>

* chore: use in.Status directly

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>

* chore: address comments

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>

Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>
Copy link
Member

@STRRL STRRL left a comment

Choose a reason for hiding this comment

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

rest LGTM

pkg/clientpool/client.go Outdated Show resolved Hide resolved
pkg/collector/server.go Outdated Show resolved Hide resolved
Signed-off-by: xiang <xiang13225080@163.com>
@WangXiangUSTC
Copy link
Contributor Author

@STRRL all comment addressed, PTAL again

STRRL
STRRL previously approved these changes Dec 1, 2020
Copy link
Member

@STRRL STRRL left a comment

Choose a reason for hiding this comment

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

LGTM

@fewdan
Copy link
Member

fewdan commented Dec 2, 2020

It looks like you need to deal with the conflict.

Signed-off-by: xiang <xiang13225080@163.com>
@WangXiangUSTC
Copy link
Contributor Author

It looks like you need to deal with the conflict.

conflict resolved, PTAL again @fewdan

fewdan
fewdan previously approved these changes Dec 3, 2020
Copy link
Member

@fewdan fewdan left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
pkg/collector/collector.go Outdated Show resolved Hide resolved
Copy link
Member

@STRRL STRRL left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@fewdan fewdan left a comment

Choose a reason for hiding this comment

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

LGTM

@WangXiangUSTC
Copy link
Contributor Author

/merge

@ti-srebot
Copy link
Contributor

Your auto merge job has been accepted, waiting for:

  • 1236
  • 1236

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@WangXiangUSTC merge failed.

@WangXiangUSTC WangXiangUSTC merged commit 379631f into master Dec 4, 2020
@WangXiangUSTC WangXiangUSTC deleted the dashboard_token_test branch December 4, 2020 03:50
STRRL pushed a commit to STRRL/chaos-mesh that referenced this pull request Dec 15, 2020
Signed-off-by: xiang <xiang13225080@163.com>

Signed-off-by: wanyoulc <15694528183@163.com>

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>
Signed-off-by: STRRL <str_ruiling@outlook.com>
@dcalvin dcalvin mentioned this pull request Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dashboard support authority management
6 participants