change: enable HTTP when stream proxy is set and enable_admin is true (#5867)

Co-authored-by: leslie <59061168+leslie-tsang@users.noreply.github.com>
This commit is contained in:
罗泽轩 2021-12-23 14:57:16 +08:00 committed by GitHub
parent 3c0b374808
commit ce5bb7b912
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 7 deletions

View File

@ -155,7 +155,7 @@ stream {
}
{% end %}
{% if not (stream_proxy and stream_proxy.only ~= false) then %}
{% if enable_admin or not (stream_proxy and stream_proxy.only ~= false) then %}
http {
# put extra_lua_path in front of the builtin path
# so user can override the source code

View File

@ -41,10 +41,13 @@ apisix:
- "127.0.0.1:9211"
```
If you need to enable both HTTP and stream proxy, set the `only` to false:
If `apisix.enable_admin` is true, both HTTP and stream proxy are enabled with the configuration above.
If you have set the `enable_admin` to false, and need to enable both HTTP and stream proxy, set the `only` to false:
```yaml
apisix:
enable_admin: false
stream_proxy: # TCP/UDP proxy
only: false
tcp: # TCP proxy address list

View File

@ -40,10 +40,13 @@ apisix:
- "127.0.0.1:9211"
```
如果你需要同时启用 HTTP 和 stream 代理,设置 `only` 为 false
如果 `apisix.enable_admin` 为 true上面的配置会同时启用 HTTP 和 stream 代理。
如果你设置 `enable_admin` 为 false且需要同时启用 HTTP 和 stream 代理,设置 `only` 为 false
```yaml
apisix:
enable_admin: false
stream_proxy: # TCP/UDP proxy
only: false
tcp: # TCP proxy address list

View File

@ -56,7 +56,7 @@ nginx_config:
make init
count=$(grep -c "lua_max_pending_timers 10240;" conf/nginx.conf)
if [ "$count" -ne 1 ]; then
if [ "$count" -ne 2 ]; then
echo "failed: failed to set lua_max_pending_timers in stream proxy"
exit 1
fi
@ -64,7 +64,7 @@ fi
echo "passed: set lua_max_pending_timers successfully in stream proxy"
count=$(grep -c "lua_max_running_timers 2561;" conf/nginx.conf)
if [ "$count" -ne 1 ]; then
if [ "$count" -ne 2 ]; then
echo "failed: failed to set lua_max_running_timers in stream proxy"
exit 1
fi

View File

@ -53,7 +53,7 @@ apisix:
make init
count=$(grep -c "resolver 127.0.0.1 \[::1\]:5353 valid=30;" conf/nginx.conf)
if [ "$count" -ne 1 ]; then
if [ "$count" -ne 2 ]; then
echo "failed: dns_resolver_valid doesn't take effect"
exit 1
fi
@ -74,7 +74,7 @@ apisix:
make init
count=$(grep -c "resolver 127.0.0.1 \[::1\] \[::2\];" conf/nginx.conf)
if [ "$count" -ne 1 ]; then
if [ "$count" -ne 2 ]; then
echo "failed: can't handle IPv6 resolver w/o bracket"
exit 1
fi

View File

@ -21,6 +21,7 @@
echo "
apisix:
enable_admin: false
stream_proxy:
tcp:
- addr: 9100
@ -38,6 +39,7 @@ echo "passed: enable stream proxy only by default"
echo "
apisix:
enable_admin: false
stream_proxy:
only: false
tcp:
@ -52,6 +54,22 @@ if [ "$count" -ne 2 ]; then
exit 1
fi
echo "
apisix:
enable_admin: true
stream_proxy:
tcp:
- addr: 9100
" > conf/config.yaml
make init
count=$(grep -c "lua_package_path" conf/nginx.conf)
if [ "$count" -ne 2 ]; then
echo "failed: failed to enable stream proxy and http proxy when admin is enabled"
exit 1
fi
echo "passed: enable stream proxy and http proxy"
echo "