You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2023/01/12 07:55:13 UTC

[GitHub] [apisix] lakewatcher opened a new issue, #8666: bug:

lakewatcher opened a new issue, #8666:
URL: https://github.com/apache/apisix/issues/8666

   ### Current Behavior
   
   
   apisix 2.15.1
   apisix dashbord 2.15 
   
   1.在upstream/list 页面,点击创建 上游:demo2,主要返回如下:
   
           "name": "demo2",
           "nodes": {
               "10.202.68.6:1111": 1,
               "127.0.0.1:1234": 1
           },
           
    2.在upstream/list 页面,点击查看,点击提交,存储对象变为。
    
            "name": "demo2",
           "nodes": [
               {
                   "port": 1111,
                   "weight": 1,
                   "host": "10.202.68.6"
               },
               {
                   "port": 1234,
                   "weight": 1,
                   "host": "127.0.0.1"
               }
           ],
           
    上面两种情况和可变返回数据结构导致,在下一步操作的时候,无法确定nodes的数据结构。
    
    例如:在数组情况下:我无法使用以下接口,进行新增。它只会清除数组结构,重新填充入Map,也就是进行覆盖。
   
   curl --location --request PATCH 'http://10.202.17.71:9180/apisix/admin/upstreams/demo' \
   --header 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' \
   --header 'Content-Type: application/json' \
   --data-raw '{
       "nodes": {
           "10.202.68.5:8888": 1
       }
   }'
   ![image](https://user-images.githubusercontent.com/27823963/212002776-348dcf51-f7af-48a9-95fb-bb36611a6771.png)
   
     
   数据不可预期情况下,文档所写示例失效
   https://apisix.apache.org/zh/docs/apisix/2.15/admin-api/#upstream
   
   `# 给 Upstream 增加一个 node
   $ curl http://127.0.0.1:9080/apisix/admin/upstreams/100 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PATCH -i -d '
   {
       "nodes": {
           "127.0.0.1:1981": 1
       }
   }'
   HTTP/1.1 200 OK
   ...
   
   执行成功后,nodes 将更新为:
   {
       "127.0.0.1:1980": 1,
       "127.0.0.1:1981": 1
   }
   `
     
   
   ### Expected Behavior
   
   1.apisix dashbord 统一对Nodes操作的数据结构,管理页面使用一种操作接口。
   2.apisix 最好使用一种返回。去除可变数据。
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   
   1.在upstream/list 页面,点击创建 上游:demo2,主要返回如下:
   
           "name": "demo2",
           "nodes": {
               "10.202.68.6:1111": 1,
               "127.0.0.1:1234": 1
           },
           
    2.在upstream/list 页面,点击查看,点击提交,存储对象变为。
    
            "name": "demo2",
           "nodes": [
               {
                   "port": 1111,
                   "weight": 1,
                   "host": "10.202.68.6"
               },
               {
                   "port": 1234,
                   "weight": 1,
                   "host": "127.0.0.1"
               }
           ],
           
   3.API调用
   curl --location --request PATCH 'http://10.202.17.71:9180/apisix/admin/upstreams/demo' \
   --header 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' \
   --header 'Content-Type: application/json' \
   --data-raw '{
       "nodes": {
           "10.202.68.5:8888": 1
       }
   }'
   
   ### Environment
   
   - APISIX version (run `apisix version`):
   - Operating system (run `uname -a`):
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   
   apisix 3.0.0
   apisix dashbord 2.15 
   
   nginx version: openresty/1.21.4.1
   built by gcc 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC) 
   built with OpenSSL 1.1.1n  15 Mar 2022 (running with OpenSSL 1.1.1s  1 Nov 2022)
   TLS SNI support enabled
   configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DAPISIX_BASE_VER=1.21.4.1.3 -DNGX_GRPC_CLI_ENGINE_PATH=/usr/local/openresty/libgrpc_engine.so -DNGX_HTTP_GRPC_CLI_ENGINE_PATH=/usr/local/openresty/libgrpc_engine.so -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.33 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.09 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.21 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.9 --ad
 d-module=../ngx_stream_lua-0.0.11 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -Wl,-rpath,/usr/local/openresty/wasmtime-c-api/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' --add-module=/tmp/tmp.Xhr2NIouwg/openresty-1.21.4.1/../mod_dubbo-1.0.2 --add-module=/tmp/tmp.Xhr2NIouwg/openresty-1.21.4.1/../ngx_multi_upstream_module-1.1.1 --add-module=/tmp/tmp.Xhr2NIouwg/openresty-1.21.4.1/../apisix-nginx-module-1.11.0 --add-module=/tmp/tmp.Xhr2NIouwg/openresty-1.21.4.1/../apisix-nginx-module-1.11.0/src/stream --add-module=/tmp/tmp.Xhr2NIouwg/openresty-1.21.4.1/../apisix-nginx-module-1.11.0/src/meta --add-module=/tmp/tmp.Xhr2NIouwg/openresty-1.21.4.1/../wasm-nginx-module-0.6.4 --add-module=/tmp/tmp.Xhr2NIouwg/openresty-1.21.4.1/../lua-var-nginx-module-v0.5.3 --add-module=/tmp/tmp.Xhr2NIouwg/openresty-1.21.4.1/../grp
 c-client-nginx-module-v0.3.1 --with-poll_module --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat --with-stream --with-http_ssl_module


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] lakewatcher commented on issue #8666: bug: apisix dashbord and admin api 数组结构可变,导致PATCH接口不可用

Posted by "lakewatcher (via GitHub)" <gi...@apache.org>.
lakewatcher commented on issue #8666:
URL: https://github.com/apache/apisix/issues/8666#issuecomment-1411407189

   It is better to use one of the data structures of the Nodes operation for apisix dashboard. Some pages will be objects after being created, and will be changed into arrays after being saved on another page. In this way, you can know the data structure when want using API operations. Otherwise, I can't use PATCH because I don't know whether the storage attribute is an array or 
   a object. It must be modified in full every time.
   
   > apisix dashbord 最好对Nodes操作的数据结构用一种。不要有的页面新建后是对象,在另一个页面保存变为数组,这样使用API操作就知道数据结构。不然没法用PATCH,因为我不知道存储属性是否为数组。只能每次全量修改。
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] lakewatcher commented on issue #8666: bug: apisix dashbord and admin api 数组结构可变,导致PATCH接口不可用

Posted by "lakewatcher (via GitHub)" <gi...@apache.org>.
lakewatcher commented on issue #8666:
URL: https://github.com/apache/apisix/issues/8666#issuecomment-1411557680

   Yes, node type's just a performance. Basically, the requirement is the ability to update and delete that object (upstream.nodes)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] An-DJ commented on issue #8666: bug: apisix dashbord and admin api 数组结构可变,导致PATCH接口不可用

Posted by "An-DJ (via GitHub)" <gi...@apache.org>.
An-DJ commented on issue #8666:
URL: https://github.com/apache/apisix/issues/8666#issuecomment-1411343925

   Also there is inconsistent descriptions of the admin api with upstream.nodes in chinese and english documents.
   
   zh-CN:
   ![image](https://user-images.githubusercontent.com/24536972/215927365-b9eb55b6-0f82-45c9-a6d7-4156c18f3f4c.png)
   
   en:
   ![image](https://user-images.githubusercontent.com/24536972/215927461-815eb203-5bb3-4a51-8289-07d05f146f75.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] An-DJ commented on issue #8666: bug: apisix dashbord and admin api 数组结构可变,导致PATCH接口不可用

Posted by "An-DJ (via GitHub)" <gi...@apache.org>.
An-DJ commented on issue #8666:
URL: https://github.com/apache/apisix/issues/8666#issuecomment-1411439927

   @lakewatcher Perhaps representing nodes with only map type can meet the requirement of incrementally adding nodes, but it can only be fully updated when nodes are removed.
   
   I think the `add/remove` operation with upstream.nodes are both reasonable based on HTTP.PATCH.
   
   CC @spacewander What do you think of this issue?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] An-DJ commented on issue #8666: bug: apisix dashbord and admin api 数组结构可变,导致PATCH接口不可用

Posted by "An-DJ (via GitHub)" <gi...@apache.org>.
An-DJ commented on issue #8666:
URL: https://github.com/apache/apisix/issues/8666#issuecomment-1411337265

   @lakewatcher It seems that you want a better approach to add the upstream nodes.
   
   So far the APISIX supports updating the `nodes` attribute of upstream atomically by `PATCH`.
   That is, we can only update this property atomically, but cannot add a new record to the data it stores.
   
   So that it requires users to manually save the configured nodes' array/map before updating upstream.nodes.
   
   Maybe supporting the `PATCH/DELETE` methods to upstream.nodes can bring a better experience.
   
   @spacewander What do you think of this issue?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: apisix dashbord and admin api 数组结构可变,导致PATCH接口不可用 [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #8666:
URL: https://github.com/apache/apisix/issues/8666#issuecomment-1920955568

   This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] An-DJ commented on issue #8666: bug: apisix dashbord and admin api 数组结构可变,导致PATCH接口不可用

Posted by "An-DJ (via GitHub)" <gi...@apache.org>.
An-DJ commented on issue #8666:
URL: https://github.com/apache/apisix/issues/8666#issuecomment-1411417321

   Maybe I can be a little clearer.
   
   Even if we specify the representation type of upstream.nodes, we can only **update it fully but not incrementally**.
   
   @lakewatcher Do you agree with me?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] An-DJ commented on issue #8666: bug: apisix dashbord and admin api 数组结构可变,导致PATCH接口不可用

Posted by "An-DJ (via GitHub)" <gi...@apache.org>.
An-DJ commented on issue #8666:
URL: https://github.com/apache/apisix/issues/8666#issuecomment-1411415486

   > It is better to use one of the data structures of the Nodes operation for apisix dashboard. Some pages will be objects after being created, and will be changed into arrays after being saved on another page. In this way, you can know the data structure when want using API operations. so, I can't use PATCH because I don't know whether the storage attribute is an array or a object. It must be modified in full every time.
   > 
   > > apisix dashbord 最好对Nodes操作的数据结构用一种。不要有的页面新建后是对象,在另一个页面保存变为数组,这样使用API操作就知道数据结构。不然没法用PATCH,因为我不知道存储属性是否为数组。只能每次全量修改。
   
   IMHO, uniform the data structure of nodes will not solve the problem.
   
   That is, Even though node only uses array to represent and store data, we can **still only** update the data **atomically** with PATCH.
   
   For example, we configure the upstream:
   
   ```
       "name": "demo2",
       "nodes": {
           "10.202.68.6:1111": 1,
           "127.0.0.1:1234": 1
       },
   ```
   
   Then we want to add a node to that upstream, we have to get the list first (the type of nodes is known at the same time), and then update it atomically.
   
   ```
   curl --location --request PATCH 'http://10.202.17.71:9180/apisix/admin/upstreams/demo'
   --header 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1'
   --header 'Content-Type: application/json'
   --data-raw '{
   "nodes": {
           "10.202.68.6:1111": 1,
           "127.0.0.1:1234": 1,
           "10.202.68.5:8888": 1,
   }
   }'
   ```
   
   So IMHO, If a user wants to update nodes **incrementally**, maybe supporting the `PATCH/DELETE` methods to upstream.nodes can bring a better experience.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: apisix dashbord and admin api 数组结构可变,导致PATCH接口不可用 [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #8666:
URL: https://github.com/apache/apisix/issues/8666#issuecomment-1895479753

   This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: apisix dashbord and admin api 数组结构可变,导致PATCH接口不可用 [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #8666: bug: apisix dashbord and  admin api 数组结构可变,导致PATCH接口不可用
URL: https://github.com/apache/apisix/issues/8666


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org