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

Proposal: support Plugin Metadata API #2148

Open
bzp2010 opened this issue Sep 25, 2021 · 9 comments
Open

Proposal: support Plugin Metadata API #2148

bzp2010 opened this issue Sep 25, 2021 · 9 comments
Labels
backend enhancement New feature or request good first issue Good for newcomers proposal

Comments

@bzp2010
Copy link
Contributor

bzp2010 commented Sep 25, 2021

Feature request

Background

At present, some plugins in Apache APISIX have metadata configuration items. The current dashboard project cannot support setting these contents. We need to support it. This requires adding APIs at the backend and pages at the frontend.

About metadata

Metadata is a mechanism provided by Apache APISIX to store some global configuration content for plugins. It is different from plugin configuration on route or other entities. It is globally effective for plugins and takes plugins as dimensions. (for example, after configuring the metadata of authz-caspin plugin, the plugin on any route or service can obtain the content stored in the metadata)

A plugin can support metadata?

We can easily distinguish whether a plugin needs metadata configuration. Plugins with the following structure in the plugin list of the built-in schema.json file in dashboard can support metadata configuration.

Proposal

Backend

  1. Plugin List API
    Read the metadata in the plugin information by traversing schema.json‘s schema property to generate a list of plugins that need metadata configuration and the property rules of plugins.

    • URI: /apisix/admin/plugin_metadata
    • Method: GET
  2. Plugin Metadata Update API
    According to the characteristics of plugin metadata, I think we only need to obtain and update APIs, rather than create API. When users want to create metadata, they can directly update the data JSON and store it in etcd

    • URI: /apisix/admin/plugin_metadata/{plugin_name}
    • Method: PUT
  3. Plugin Metadata Delete API
    Provides the function of clearing metadata data of plugin

    • URI: /apisix/admin/plugin_metadata/{plugin_name}
    • Method: DELETE

Frontend

  1. Plugin List page
    Obtain plugins and their data from the plugin list API (the effect is shown below, but only the plugins that need to configure metadata are displayed)
    image

  2. Plugin Metadata Setting page
    Provide an input box that supports JSON and YAML, run users to input metadata data, and support input prompts.

Subtask decomposition

  1. Add Plugin Metadata data entity and storage layer code
  2. Add backend APIs and related test code
  3. Add frontend page and E2E test code
@bzp2010
Copy link
Contributor Author

bzp2010 commented Sep 25, 2021

Hi, everyone.
If you have any suggestion, you can send comments here.

@tzssangglass
Copy link
Member

Where is the entry point for configuring plugin_metadata? If the entry to plugin_metadata is in the plugin configuration on route or service, I'm worried about ambiguity.

Because the scope of the plugin_metadata is for all routes or services on which the plugin is configured.

@bzp2010
Copy link
Contributor Author

bzp2010 commented Sep 26, 2021

Where is the entry point for configuring plugin_metadata? If the entry to plugin_metadata is in the plugin configuration on route or service, I'm worried about ambiguity.

Because the scope of the plugin_metadata is for all routes or services on which the plugin is configured.

@tzssangglass
I think it should be in the main menu at the same level as route and upstream.

@starsz
Copy link
Contributor

starsz commented Sep 26, 2021

So what's the key prefix in etcd about the plugin metadata ?
I can't get this from the proposal.

@bzp2010
Copy link
Contributor Author

bzp2010 commented Sep 26, 2021

So what's the key prefix in etcd about the plugin metadata ?
I can't get this from the proposal.

@starsz It will be exactly the same as in APISIX.

@bzp2010 bzp2010 added the good first issue Good for newcomers label Sep 27, 2021
@nic-chen
Copy link
Member

  1. Plugin Metadata Setting page

I think you could take a screenshot to illustrate, now it's completely based on imagination.

@starsz
Copy link
Contributor

starsz commented Sep 28, 2021

So what's the key prefix in etcd about the plugin metadata ?
I can't get this from the proposal.

@starsz It will be exactly the same as in APISIX.

Well. Got it.

@bzp2010
Copy link
Contributor Author

bzp2010 commented Sep 28, 2021

I think you could take a screenshot to illustrate, now it's completely based on imagination.

Hi, @nic-chen. It should generally provide Monaco Editor to support code completion and schema verification. Just like those plugins that do not support UI configuration.
image

@bzp2010 bzp2010 added backend enhancement New feature or request proposal labels Oct 28, 2021
@juzhiyuan juzhiyuan pinned this issue Nov 11, 2021
@juzhiyuan
Copy link
Member

related PR: apache/apisix#5372

@zaunist zaunist mentioned this issue Dec 27, 2021
8 tasks
@bzp2010 bzp2010 unpinned this issue Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend enhancement New feature or request good first issue Good for newcomers proposal
Projects
None yet
Development

No branches or pull requests

5 participants