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

request help: control API for go plugin #98

Open
1696228062 opened this issue Aug 2, 2022 · 8 comments
Open

request help: control API for go plugin #98

1696228062 opened this issue Aug 2, 2022 · 8 comments
Labels

Comments

@1696228062
Copy link

Issue description

image
What should I do if I want to use the control API in the go plugin? Or is there any other solution to achieve similar functions

Environment

  • APISIX Go Plugin Runner's version:0.3.0
  • APISIX version: 2.14
  • Go version: 1.15
  • OS (cmd: uname -a): linux
@1696228062 1696228062 changed the title request help: request help: control API for go plugin Aug 2, 2022
@soulbird
Copy link
Contributor

soulbird commented Aug 2, 2022

I can't get your point, do you want to register control api in go runner? Can you describe your use case in detail?

@1696228062
Copy link
Author

我在apisix新增了一个自定义的go插件, 我希望这个插件能提供一个对内的api,从而让我的内部脚本可以通过http请求的方式调用,来触发插件内的一些缓存更新的逻辑。
比如, 我的go plugin内有一个全局变量 a int 缓存了一个值为 1
我期望,我能在go plugin内开一个接口, 当此接口被调用,go plugin内的全局变量a 的值变为2

@soulbird
Copy link
Contributor

soulbird commented Aug 4, 2022

You can start an http service in your own go-runner, expose your API, and then create a route in APISIX to protect your API interface.

@oyiadin
Copy link

oyiadin commented Nov 7, 2022

I need this feature too ;-)

IMO, though exposing a new http service in the go-runner is a feasible solution, I do think that the APISIX control API is somewhere more suitable.

@soulbird
Copy link
Contributor

Do you mean that the control api in APISIX can also take effect in go runner, or use golang alone to support control api in go runner?

@oyiadin
Copy link

oyiadin commented Nov 10, 2022

I mean, to register control api like what we can did in lua: https://apisix.apache.org/docs/apisix/plugin-develop/#register-control-api Maybe we should add another RPC event for this purpose.

@oyiadin
Copy link

oyiadin commented Nov 10, 2022

If we decide to implement this feature, IMO, we should support it in every language that APISIX supports: go, python and java. Not only golang

@soulbird
Copy link
Contributor

soulbird commented Nov 11, 2022

I mean, to register control api like what we can did in lua: https://apisix.apache.org/docs/apisix/plugin-develop/#register-control-api Maybe we should add another RPC event for this purpose.

If it is to implement the same feature as in Lua, it seems that it can only be supported in go-plugin-runner, and it is not necessary to add an RPC event to interact with APISIX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants