You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/08/18 09:51:49 UTC

[apisix] branch master updated: change: drop support for port_admin (#7716)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 024ed5a74 change: drop support for port_admin (#7716)
024ed5a74 is described below

commit 024ed5a74b52a84bb6ba31ea8a364593530285cc
Author: tzssangglass <tz...@gmail.com>
AuthorDate: Thu Aug 18 17:51:43 2022 +0800

    change: drop support for port_admin (#7716)
---
 apisix/cli/ops.lua            |  3 ---
 apisix/cli/schema.lua         |  3 ---
 conf/config-default.yaml      |  7 +++----
 docs/en/latest/FAQ.md         |  4 +++-
 docs/en/latest/admin-api.md   |  2 +-
 docs/en/latest/certificate.md |  4 +++-
 docs/en/latest/mtls.md        |  4 +++-
 docs/zh/latest/FAQ.md         |  4 +++-
 docs/zh/latest/admin-api.md   |  2 +-
 docs/zh/latest/certificate.md |  4 +++-
 docs/zh/latest/mtls.md        |  4 +++-
 t/cli/test_access_log.sh      |  3 ++-
 t/cli/test_admin.sh           | 10 ++++++----
 t/cli/test_admin_mtls.sh      |  3 ++-
 t/cli/test_main.sh            |  3 ++-
 t/cli/test_snippet.sh         |  3 ++-
 t/cli/test_validate_config.sh |  3 ++-
 17 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index 72a58d8e5..0fb2d083b 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -319,9 +319,6 @@ Please modify "admin_key" in conf/config.yaml .
             admin_server_addr = validate_and_get_listen_addr("admin port", "0.0.0.0",
                                         yaml_conf.apisix.admin_listen.ip,
                                         9180, yaml_conf.apisix.admin_listen.port)
-        elseif yaml_conf.apisix.port_admin then
-            admin_server_addr = validate_and_get_listen_addr("admin port", "0.0.0.0", nil,
-                                        9180, yaml_conf.apisix.port_admin)
         end
     end
 
diff --git a/apisix/cli/schema.lua b/apisix/cli/schema.lua
index 8c38a305f..54b2a402e 100644
--- a/apisix/cli/schema.lua
+++ b/apisix/cli/schema.lua
@@ -133,9 +133,6 @@ local config_schema = {
                         }
                     }
                 },
-                port_admin = {
-                    type = "integer",
-                },
                 https_admin = {
                     type = "boolean",
                 },
diff --git a/conf/config-default.yaml b/conf/config-default.yaml
index cbada9d5e..b93e5a81c 100755
--- a/conf/config-default.yaml
+++ b/conf/config-default.yaml
@@ -38,8 +38,8 @@ apisix:
                                     # yaml: fetch the config value from local yaml file `/your_path/conf/apisix.yaml`
 
   #proxy_protocol:                  # Proxy Protocol configuration
-  #listen_http_port: 9181           # The port with proxy protocol for http, it differs from node_listen and port_admin.
-                                    # This port can only receive http request with proxy protocol, but node_listen & port_admin
+  #listen_http_port: 9181           # The port with proxy protocol for http, it differs from node_listen and admin_listen.
+                                    # This port can only receive http request with proxy protocol, but node_listen & admin_listen
                                     # can only receive http request. If you enable proxy protocol, you must use this port to
                                     # receive http request with proxy protocol
   #listen_https_port: 9182          # The port with proxy protocol for https
@@ -77,10 +77,9 @@ apisix:
   #admin_listen:                # use a separate port
   #  ip: 127.0.0.1              # Specific IP, if not set, the default value is `0.0.0.0`.
   #  port: 9180
-  #port_admin: 9180             # Not recommend: This parameter should be set via the `admin_listen`.
   #https_admin: true            # enable HTTPS when use a separate port for Admin API.
                                 # Admin API will use conf/apisix_admin_api.crt and conf/apisix_admin_api.key as certificate.
-  admin_api_mtls:               # Depends on `port_admin` and `https_admin`.
+  admin_api_mtls:               # Depends on `admin_listen` and `https_admin`.
     admin_ssl_cert: ""          # Path of your self-signed server side cert.
     admin_ssl_cert_key: ""      # Path of your self-signed server side key.
     admin_ssl_ca_cert: ""       # Path of your self-signed ca cert.The CA is used to sign all admin api callers' certificates.
diff --git a/docs/en/latest/FAQ.md b/docs/en/latest/FAQ.md
index ebf7f0253..1d12787d2 100644
--- a/docs/en/latest/FAQ.md
+++ b/docs/en/latest/FAQ.md
@@ -365,7 +365,9 @@ You can follow the steps below to configure this:
 
 ```yaml
 apisix:
-  port_admin: 9180 # use a separate port
+  admin_listen: # use a separate port
+    ip: 127.0.0.1
+    port: 9180
 ```
 
 2. Add a proxy Route for the Apache APISIX dashboard:
diff --git a/docs/en/latest/admin-api.md b/docs/en/latest/admin-api.md
index 9650bfcb3..5be784ce7 100644
--- a/docs/en/latest/admin-api.md
+++ b/docs/en/latest/admin-api.md
@@ -119,7 +119,7 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes?name=test&uri=foo&label= \
 
 [Routes](./terminology/route.md) match the client's request based on defined rules, loads and executes the corresponding [plugins](#plugin), and forwards the request to the specified [Upstream](#upstream).
 
-**Note**: When the Admin API is enabled, to avoid conflicts with your design API, use a different port for the Admin API. This can be set in your configuration file by changing the `port_admin` key.
+**Note**: When the Admin API is enabled, to avoid conflicts with your design API, use a different port for the Admin API. This can be set in your configuration file by changing the `admin_listen` key.
 
 ### Request Methods
 
diff --git a/docs/en/latest/certificate.md b/docs/en/latest/certificate.md
index 156e2f594..abbe60866 100644
--- a/docs/en/latest/certificate.md
+++ b/docs/en/latest/certificate.md
@@ -233,7 +233,9 @@ apisix:
     - name: admin
       key: edd1c9f034335f136f87ad84b625c8f1
       role: admin
-  port_admin: 9180
+  admin_listen:
+    ip: 127.0.0.1
+    port: 9180
   https_admin: true
 
   admin_api_mtls:
diff --git a/docs/en/latest/mtls.md b/docs/en/latest/mtls.md
index 33e0fb7f3..7d8aed56d 100644
--- a/docs/en/latest/mtls.md
+++ b/docs/en/latest/mtls.md
@@ -36,7 +36,9 @@ The clients will provide their certificates to the server and the server will ch
 2. Modify configuration items in `conf/config.yaml`:
 
 ```yaml
-  port_admin: 9180
+  admin_listen:
+    ip: 127.0.0.1
+    port: 9180
   https_admin: true
 
   admin_api_mtls:
diff --git a/docs/zh/latest/FAQ.md b/docs/zh/latest/FAQ.md
index d285f58d7..69f707c49 100644
--- a/docs/zh/latest/FAQ.md
+++ b/docs/zh/latest/FAQ.md
@@ -368,7 +368,9 @@ make: *** [deps] Error 1
 
 ```yaml
 apisix:
-  port_admin: 9180 # use a separate port
+  admin_listen: # use a separate port
+    ip: 127.0.0.1
+    port: 9180
 ```
 
 2、添加 APISIX Dashboard 的代理路由:
diff --git a/docs/zh/latest/admin-api.md b/docs/zh/latest/admin-api.md
index bdd9734b8..9880c87fc 100644
--- a/docs/zh/latest/admin-api.md
+++ b/docs/zh/latest/admin-api.md
@@ -120,7 +120,7 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes?name=test&uri=foo&label= \
 
 *说明*:Route 字面意思就是路由,通过定义一些规则来匹配客户端的请求,然后根据匹配结果加载并执行相应的插件,并把请求转发给到指定 Upstream。
 
-注意:在启用 `Admin API` 时,它会占用前缀为 `/apisix/admin` 的 API。因此,为了避免您设计 API 与 `/apisix/admin` 冲突,建议为 Admin API 使用其他端口,您可以在 `conf/config.yaml` 中通过 `port_admin` 进行自定义 Admin API 端口。
+注意:在启用 `Admin API` 时,它会占用前缀为 `/apisix/admin` 的 API。因此,为了避免您设计 API 与 `/apisix/admin` 冲突,建议为 Admin API 使用其他端口,您可以在 `conf/config.yaml` 中通过 `admin_listen` 进行自定义 Admin API 端口。
 
 ### 请求方法
 
diff --git a/docs/zh/latest/certificate.md b/docs/zh/latest/certificate.md
index b1c04d744..3ec063dfc 100644
--- a/docs/zh/latest/certificate.md
+++ b/docs/zh/latest/certificate.md
@@ -230,7 +230,9 @@ apisix:
     - name: admin
       key: edd1c9f034335f136f87ad84b625c8f1
       role: admin
-  port_admin: 9180
+  admin_listen:
+    ip: 127.0.0.1
+    port: 9180
   https_admin: true
 
   admin_api_mtls:
diff --git a/docs/zh/latest/mtls.md b/docs/zh/latest/mtls.md
index 1791821d8..830824c20 100644
--- a/docs/zh/latest/mtls.md
+++ b/docs/zh/latest/mtls.md
@@ -36,7 +36,9 @@ title: TLS 双向认证
 2. 修改 `conf/config.yaml` 中的配置项:
 
 ```yaml
-  port_admin: 9180
+  admin_listen:
+    ip: 127.0.0.1
+    port: 9180
   https_admin: true
 
   admin_api_mtls:
diff --git a/t/cli/test_access_log.sh b/t/cli/test_access_log.sh
index 252a931d2..0a8b66d2c 100755
--- a/t/cli/test_access_log.sh
+++ b/t/cli/test_access_log.sh
@@ -191,7 +191,8 @@ apisix:
     admin_api_mtls:
         admin_ssl_cert: '../t/certs/apisix_admin_ssl.crt'
         admin_ssl_cert_key: '../t/certs/apisix_admin_ssl.key'
-    port_admin: 9180
+    admin_listen:
+        port: 9180
     https_admin: true
 nginx_config:
   http:
diff --git a/t/cli/test_admin.sh b/t/cli/test_admin.sh
index 789a61fb8..969bcd911 100755
--- a/t/cli/test_admin.sh
+++ b/t/cli/test_admin.sh
@@ -28,7 +28,8 @@ apisix:
     admin_api_mtls:
         admin_ssl_cert: '../t/certs/apisix_admin_ssl.crt'
         admin_ssl_cert_key: '../t/certs/apisix_admin_ssl.key'
-    port_admin: 9180
+    admin_listen:
+        port: 9180
     https_admin: true
 " > conf/config.yaml
 
@@ -169,10 +170,11 @@ fi
 
 echo "pass: show WARNING message if the user used default token and allow any IP to access"
 
-# port_admin set
+# admin_listen set
 echo '
 apisix:
-  port_admin: 9180
+  admin_listen:
+    port: 9180
 ' > conf/config.yaml
 
 rm logs/error.log
@@ -192,7 +194,7 @@ if grep -E 'using uninitialized ".+" variable while logging request' logs/error.
     exit 1
 fi
 
-echo "pass: uninitialized variable not found during writing access log (port_admin set)"
+echo "pass: uninitialized variable not found during writing access log (admin_listen set)"
 
 # Admin API can only be used with etcd config_center
 echo '
diff --git a/t/cli/test_admin_mtls.sh b/t/cli/test_admin_mtls.sh
index 7bdb06e43..881530a66 100755
--- a/t/cli/test_admin_mtls.sh
+++ b/t/cli/test_admin_mtls.sh
@@ -23,7 +23,8 @@
 
 echo '
 apisix:
-    port_admin: 9180
+    admin_listen:
+        port: 9180
     https_admin: true
 
     admin_api_mtls:
diff --git a/t/cli/test_main.sh b/t/cli/test_main.sh
index ea54c53b8..54a7c52c9 100755
--- a/t/cli/test_main.sh
+++ b/t/cli/test_main.sh
@@ -514,7 +514,8 @@ apisix:
     admin_api_mtls:
         admin_ssl_cert: '../t/certs/apisix_admin_ssl.crt'
         admin_ssl_cert_key: '../t/certs/apisix_admin_ssl.key'
-    port_admin: 9180
+    admin_listen:
+        port: 9180
     https_admin: true
 " > conf/customized_config.yaml
 
diff --git a/t/cli/test_snippet.sh b/t/cli/test_snippet.sh
index 0684d6c1f..ad55151f1 100755
--- a/t/cli/test_snippet.sh
+++ b/t/cli/test_snippet.sh
@@ -25,7 +25,8 @@ echo '
 apisix:
     node_listen: 9080
     enable_admin: true
-    port_admin: 9180
+    admin_listen:
+        port: 9180
     stream_proxy:
         only: false
         tcp:
diff --git a/t/cli/test_validate_config.sh b/t/cli/test_validate_config.sh
index 1a7b0c3be..dc5730e82 100755
--- a/t/cli/test_validate_config.sh
+++ b/t/cli/test_validate_config.sh
@@ -78,7 +78,8 @@ echo '
 apisix:
     node_listen: 9080
     enable_admin: true
-    port_admin: 9180
+    admin_listen:
+        port: 9180
     stream_proxy:
         tcp:
             - "localhost:9100"