Apisix-dashboard: Requirements for refactoring the Dashboard with Manager API

Created on 1 Sep 2020  ·  29Comments  ·  Source: apache/apisix-dashboard

Please answer these questions before submitting your issue.

  • Why do you submit this issue?
  • [ ] Question or discussion
  • [ ] Bug
  • [x] Requirements
  • [ ] Feature or performance improvement
  • [ ] Other

Requirements

  • What do you want to know?

As title said

proposal

Most helpful comment

@bzp2010 @gxthrj @moonming @membphis @ShiningRush @tiannian @LiteSun
GenericStore has already completed.I write a demo about how to use it in internal/handler/route/route.go
I found some project problems, listed below:

  • The project structure is not standardized, please refer to golang-standards/project-layout
  • We need a middleware mechanism to solve the following problems

    • error handling

    • result wrapping

    • input validating

  • Logger relies on concrete component(logrus), it needs to be decoupled

We can hold a meeting to discuss how to carry out the next task

All 29 comments

APIs

Route

Create

POST /routes

Delete

DELETE /routes/:id

Update

PUT /routes/:id

Fetch List

GET /routes

Fetch Detail

GET /routes/:id

Check if there has routes with same name

GET /notexist/routes

Fetch Upstream List

GET /names/upstreams

Upstream

Create

POST /upstreams

Delete

DELETE /upstreams/:id

Update

PUT /upstreams/:id

Fetch List

GET /upstreams

Fetch Detail

GET /upstreams/:id

SSL

Create

POST /ssls

Delete

DELETE /ssls/:id

Update

PUT /ssls/:id

Fetch List

GET /ssls

Check if there has SSL Cert with targeting Host

POST /check_ssl_exists

Switch enable status

PATCH /ssls/:id

Consumer

Create

POST /consumers

Delete

DELETE /consumers/:id

Update

PUT /consumers/:id

Fetch List

GET /consumers

Fetch Detail

GET /consumers/:id

User

Login

POST /user/login

@nic-chen Please take a look at above APIs which are related with MySQL? Then you can remove others directly by editing the second comment.

if routeGroup merged, there are some routeGroup apis here: @juzhiyuan @nic-chen

Create
POST /routegroups

Delete
DELETE /routegroups/:gid

Update
PUT /routegroups/:gid

Fetch List
GET /routegroups

Fetch Detail
GET /routegroups/:gid

Fetch name List
GET /names/routegroups

Check route group exit
GET /notexist/routegroups

cc @gxthrj @nic-chen

I have updated https://github.com/apache/apisix-dashboard/issues/434#issuecomment-686153897

Note that we need to implement the features using by relational database currently:

  1. unique constraint
  2. paging
  3. foreign key constraint

cc @bzp2010 @gxthrj @moonming @membphis @ShiningRush @tiannian @LiteSun

Fine, I will make a simple design image about watching ETCD in this week.
BTW: I have read the code of manager API, but I do not see any code about RBAC, is the feature still not implement?

@ShiningRush

We could refactor the current code first, and then implement other features step by step.

I drew a picture to show how the underlying components work together
image

This is a bit like the design of k8s apiserver, but it simplifies a lot of details.
Here are the responsibilities of each component:

  • Handler: handle the requests,each handler will have a their own store which is created from GenericStore
  • GenericStore: this component is responsible for common logic, such as maintaining memory-based etcd copies, queries, etc.
  • Etcd3Storage: responsible for the operation of etcd, used to decouple GenericStore and persistent components, to facilitate unit testing and expansion

@nic-chen @juzhiyuan @membphis @moonming
If there is no doubt about the design details, I will implement it for ManagerAPI recently.
If there is something unclear, we can hold a meeting to discuss it.

Just waiting for other teammates' response :D

LGTM.
GenericStore, do we implement it, or there are some ready-made component recommended ?

We implement it,I do not find any libs can helps us.
But our case it not complex, so it will not take many works.

I drew a picture to show how the underlying components work together
image

This is a bit like the design of k8s apiserver, but it simplifies a lot of details.
Here are the responsibilities of each component:

* `Handler`: handle the requests,each handler will have a their own store which is created from `GenericStore`

* `GenericStore`: this component is responsible for common logic, such as maintaining memory-based etcd copies, queries, etc.

* `Etcd3Storage`: responsible for the operation of etcd, used to decouple GenericStore and persistent components, to facilitate unit testing and expansion

@nic-chen @juzhiyuan @membphis @moonming
If there is no doubt about the design details, I will implement it for ManagerAPI recently.
If there is something unclear, we can hold a meeting to discuss it.

We can discuss in an online meeting, and then synchronize the results here

BTW: I have read the code of manager API, but I do not see any code about RBAC, is the feature still not implement?

@ShiningRush Yeap, RBAC has not been implemented yet.

@moonming @ShiningRush Could you please set a milestone here?

cc @bzp2010

@ShiningRush @juzhiyuan Just as a reminder, APISIX itself is using API v2 to interactive with etcd, meanwhile this new design seems that API v3 would be adopted in Manager. This will lead to no data could be shared between APISIX and Manager. I did not see any discussions about this(maybe I missed something 😄 ), so I was wondering if we have already deliberated on that? Thank you all.

need @membphis @moonming 's help to address your question 😂

APISIX will change to etcd v3 at the same time, there is already a pr in
apisix repo.

琚致远 notifications@github.com 于 2020年9月8日周二 下午7:38写道:

need @membphis https://github.com/membphis @moonming
https://github.com/moonming 's help to address your question 😂


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/apache/apisix-dashboard/issues/434#issuecomment-688810818,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AGJZBK4WZUYV5IMAZVUAE4DSEYJSVANCNFSM4QRVIHQQ
.

@imjoey GenericStore just depend on a storage interface, so we can also implement etcdv2storage if we need

@imjoey GenericStore just depend on a storage interface, so we can also implement etcdv2storage if we need

@ShiningRush OK, thanks for your point.

APISIX will change to etcd v3 at the same time, there is already a pr in apisix repo. 琚致远 notifications@github.com

@moonming yeah, that would be really great! Thanks.

@bzp2010 @gxthrj @moonming @membphis @ShiningRush @tiannian @LiteSun
GenericStore has already completed.I write a demo about how to use it in internal/handler/route/route.go
I found some project problems, listed below:

  • The project structure is not standardized, please refer to golang-standards/project-layout
  • We need a middleware mechanism to solve the following problems

    • error handling

    • result wrapping

    • input validating

  • Logger relies on concrete component(logrus), it needs to be decoupled

We can hold a meeting to discuss how to carry out the next task

@ShiningRush Could you please leave the result about the last meeting here?

The key points of the meeting are as follows:

  • I will write an api demo first, and then x will cooperate to migrate the existing API
  • The front end needs to migrate the data format conversion work to the front end, because the ManagerAPI needs to keep the data structure consistent with the AdminAPI

got it ping @moonming

LGTM

Thanks,
Ming Wen
Twitter: _WenMing

琚致远 notifications@github.com 于2020年9月11日周五 下午3:24写道:

got it ping @moonming https://github.com/moonming


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/apache/apisix-dashboard/issues/434#issuecomment-690924953,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AGJZBK6YLNTSXIHA36TYOQTSFHGB3ANCNFSM4QRVIHQQ
.

Any update?

TODO according to today's meeting.

  • [ ] Refactor APIs about Route, Upstream, etc. Both backend and frontend.
  • [ ] Update the Error Codes both on the backend and frontend.
Was this page helpful?
0 / 5 - 0 ratings