Open jmcorne opened 4 months ago
Hi team,
I am trying to use Admin API filter to select routes, upstreams, ... with their labels
For example, I have a route defined like this
{ "createdIndex": 38, "key": "/apisix/routes/89da83f2", "modifiedIndex": 95, "value": { "priority": 0, "methods": ["GET", "POST", "DELETE", "PUT"], "desc": "Created by apisix-ingress-controller, DO NOT modify it manually", "update_time": 1716803625, "id": "89da83f2", "name": "services-rlio-sops10-svc_tst_auth-service", "upstream_id": "29adb2f2", "create_time": 1716803624, "labels": { "argocd.argoproj.io/instance": "shared-services", "managed-by": "apisix-ingress-controller", "app.kubernetes.io/instance": "rlio-sops10-shared-services", "app.kubernetes.io/part-of": "apisix" }, "uris": ["/auth/*"], "status": 1 } }
I tested
When adding value to filter, it returns nothing.
Does the filter work with key only? If not what is the syntax to filter routes based on label key and value, plz?
APISIX version (run apisix version): 3.8.0
apisix version
Operating system (run uname -a): Linux apisix-5ddcdb7488-bv68s 5.10.213-201.855.amzn2.x86_64 #1 SMP Mon Mar 25 18:16:11 UTC 2024 x86_64 GNU/Linux
uname -a
OpenResty / Nginx version (run openresty -V or nginx -V): nginx version: openresty/1.21.4.2 built by gcc 10.2.1 20210110 (Debian 10.2.1-6) built with OpenSSL 3.2.0 23 Nov 2023 TLS SNI support enabled configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DAPISIX_RUNTIME_VER=1.1.1 -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/openssl3/include' --add-module=../ngx_devel_kit-0.3.2 --add-module=../echo-nginx-module-0.63 --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.33 --add-module=../ngx_lua-0.10.25 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.34 --add-module=../array-var-nginx-module-0.06 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.9 --add-module=../ngx_stream_lua-0.0.13 --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/openssl3/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl3/lib' --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../mod_dubbo-1.0.2 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../ngx_multi_upstream_module-1.1.1 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../apisix-nginx-module-1.15.0 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../apisix-nginx-module-1.15.0/src/stream --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../apisix-nginx-module-1.15.0/src/meta --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../wasm-nginx-module-0.6.5 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../lua-var-nginx-module-v0.5.3 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../grpc-client-nginx-module-v0.4.4 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../lua-resty-events-0.2.0 --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
openresty -V
nginx -V
etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info): N/A
curl http://127.0.0.1:9090/v1/server_info
APISIX Dashboard version, if relevant: N/A
Plugin runner version, for issues related to plugin runners: N/A
LuaRocks version, for installation issues (run luarocks --version): NA/
luarocks --version
yes, from the source code, i think filter label only support key.
Description
Hi team,
I am trying to use Admin API filter to select routes, upstreams, ... with their labels
For example, I have a route defined like this
I tested
When adding value to filter, it returns nothing.
Does the filter work with key only? If not what is the syntax to filter routes based on label key and value, plz?
Environment
APISIX version (run
apisix version
): 3.8.0Operating system (run
uname -a
): Linux apisix-5ddcdb7488-bv68s 5.10.213-201.855.amzn2.x86_64 #1 SMP Mon Mar 25 18:16:11 UTC 2024 x86_64 GNU/LinuxOpenResty / Nginx version (run
openresty -V
ornginx -V
): nginx version: openresty/1.21.4.2 built by gcc 10.2.1 20210110 (Debian 10.2.1-6) built with OpenSSL 3.2.0 23 Nov 2023 TLS SNI support enabled configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DAPISIX_RUNTIME_VER=1.1.1 -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/openssl3/include' --add-module=../ngx_devel_kit-0.3.2 --add-module=../echo-nginx-module-0.63 --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.33 --add-module=../ngx_lua-0.10.25 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.34 --add-module=../array-var-nginx-module-0.06 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.9 --add-module=../ngx_stream_lua-0.0.13 --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/openssl3/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl3/lib' --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../mod_dubbo-1.0.2 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../ngx_multi_upstream_module-1.1.1 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../apisix-nginx-module-1.15.0 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../apisix-nginx-module-1.15.0/src/stream --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../apisix-nginx-module-1.15.0/src/meta --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../wasm-nginx-module-0.6.5 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../lua-var-nginx-module-v0.5.3 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../grpc-client-nginx-module-v0.4.4 --add-module=/tmp/tmp.DD8aot3fRm/openresty-1.21.4.2/../lua-resty-events-0.2.0 --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_moduleetcd version, if relevant (run
curl http://127.0.0.1:9090/v1/server_info
): N/AAPISIX Dashboard version, if relevant: N/A
Plugin runner version, for issues related to plugin runners: N/A
LuaRocks version, for installation issues (run
luarocks --version
): NA/