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 2021/02/07 07:19:45 UTC

[GitHub] [apisix] hnlq715 opened a new pull request #3547: feat: support grpc proxy with insecure mode

hnlq715 opened a new pull request #3547:
URL: https://github.com/apache/apisix/pull/3547


   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   Details can be found in #3496.
   
   ### Pre-submission checklist:
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [X] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [X] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


----------------------------------------------------------------
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.

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



[GitHub] [apisix] tokers commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571822562



##########
File path: apisix/cli/ops.lua
##########
@@ -238,9 +238,19 @@ Please modify "admin_key" in conf/config.yaml .
         util.die("missing apisix.proxy_cache for plugin proxy-cache\n")
     end
 
-    --support multiple ports listen, compatible with the original style
+    -- support multiple ports listen, compatible with the original style
     if type(yaml_conf.apisix.node_listen) == "number" then
-        local node_listen = {yaml_conf.apisix.node_listen}
+        local node_listen = {{port = yaml_conf.apisix.node_listen}}
+        yaml_conf.apisix.node_listen = node_listen
+    elseif type(yaml_conf.apisix.node_listen) == "table" then
+        local node_listen = {}
+        for index, value in ipairs(yaml_conf.apisix.node_listen) do
+            if type(value) == "number" then

Review comment:
       Is the number type really needed? I think the following way is enough.
   
   ```yaml
   node_listen:
     - port: 9080
     - port: 9180
       enable_http2: true
   ```

##########
File path: doc/grpc-proxy.md
##########
@@ -37,6 +37,7 @@ Here's an example, to proxying gRPC service by specified route:
 
 * attention: the `scheme` of the route's upstream must be `grpc` or `grpcs`.
 * attention: APISIX use TLS‑encrypted HTTP/2 to expose gRPC service, so need to [config SSL certificate](https.md)
+* attention: APISIX also support to expose gRPC service with plaintext HTTP/2, which do not need to config SSL certificate, usually used to proxy gRPC service in intranet environment

Review comment:
       which do not need to config SSL certificate => which doesn't rely on ALPN/NPN extensions in TLS/SSL protocol.




----------------------------------------------------------------
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.

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



[GitHub] [apisix] tokers commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571605034



##########
File path: apisix/cli/ops.lua
##########
@@ -238,10 +238,18 @@ Please modify "admin_key" in conf/config.yaml .
         util.die("missing apisix.proxy_cache for plugin proxy-cache\n")
     end
 
-    --support multiple ports listen, compatible with the original style
+    -- support multiple ports listen, compatible with the original style
     if type(yaml_conf.apisix.node_listen) == "number" then
-        local node_listen = {yaml_conf.apisix.node_listen}
+        local node_listen = {{port = yaml_conf.apisix.node_listen}}
         yaml_conf.apisix.node_listen = node_listen
+    elseif type(yaml_conf.apisix.node_listen) == "table" then
+        if type(yaml_conf.apisix.node_listen[1]) == "number" then

Review comment:
       Cannot capture your mean for this if.




----------------------------------------------------------------
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.

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



[GitHub] [apisix] tokers commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571904411



##########
File path: apisix/cli/ops.lua
##########
@@ -238,9 +238,19 @@ Please modify "admin_key" in conf/config.yaml .
         util.die("missing apisix.proxy_cache for plugin proxy-cache\n")
     end
 
-    --support multiple ports listen, compatible with the original style
+    -- support multiple ports listen, compatible with the original style
     if type(yaml_conf.apisix.node_listen) == "number" then
-        local node_listen = {yaml_conf.apisix.node_listen}
+        local node_listen = {{port = yaml_conf.apisix.node_listen}}
+        yaml_conf.apisix.node_listen = node_listen
+    elseif type(yaml_conf.apisix.node_listen) == "table" then
+        local node_listen = {}
+        for index, value in ipairs(yaml_conf.apisix.node_listen) do
+            if type(value) == "number" then

Review comment:
       I mean the element type inside `node_listen`, not the `node_listen` itself.




----------------------------------------------------------------
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.

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



[GitHub] [apisix] hnlq715 commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
hnlq715 commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571906637



##########
File path: doc/grpc-proxy.md
##########
@@ -37,6 +37,7 @@ Here's an example, to proxying gRPC service by specified route:
 
 * attention: the `scheme` of the route's upstream must be `grpc` or `grpcs`.
 * attention: APISIX use TLS‑encrypted HTTP/2 to expose gRPC service, so need to [config SSL certificate](https.md)
+* attention: APISIX also support to expose gRPC service with plaintext HTTP/2, which do not need to config SSL certificate, usually used to proxy gRPC service in intranet environment

Review comment:
       Alright




----------------------------------------------------------------
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.

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



[GitHub] [apisix] hnlq715 commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
hnlq715 commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571900041



##########
File path: doc/grpc-proxy.md
##########
@@ -37,6 +37,7 @@ Here's an example, to proxying gRPC service by specified route:
 
 * attention: the `scheme` of the route's upstream must be `grpc` or `grpcs`.
 * attention: APISIX use TLS‑encrypted HTTP/2 to expose gRPC service, so need to [config SSL certificate](https.md)
+* attention: APISIX also support to expose gRPC service with plaintext HTTP/2, which do not need to config SSL certificate, usually used to proxy gRPC service in intranet environment

Review comment:
       Maybe this is a little hard to understand for user...? Maybe it's enough to mention in doc that this feature is supported, and show how to configure it?




----------------------------------------------------------------
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.

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



[GitHub] [apisix] hnlq715 commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
hnlq715 commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571905936



##########
File path: apisix/cli/ops.lua
##########
@@ -238,9 +238,19 @@ Please modify "admin_key" in conf/config.yaml .
         util.die("missing apisix.proxy_cache for plugin proxy-cache\n")
     end
 
-    --support multiple ports listen, compatible with the original style
+    -- support multiple ports listen, compatible with the original style
     if type(yaml_conf.apisix.node_listen) == "number" then
-        local node_listen = {yaml_conf.apisix.node_listen}
+        local node_listen = {{port = yaml_conf.apisix.node_listen}}
+        yaml_conf.apisix.node_listen = node_listen
+    elseif type(yaml_conf.apisix.node_listen) == "table" then
+        local node_listen = {}
+        for index, value in ipairs(yaml_conf.apisix.node_listen) do
+            if type(value) == "number" then

Review comment:
       We can also be compatible with this format:
   
   ```yaml
   node_listen:
       - 9080
       - 9081
   ```




----------------------------------------------------------------
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.

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



[GitHub] [apisix] tokers commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571905925



##########
File path: doc/grpc-proxy.md
##########
@@ -37,6 +37,7 @@ Here's an example, to proxying gRPC service by specified route:
 
 * attention: the `scheme` of the route's upstream must be `grpc` or `grpcs`.
 * attention: APISIX use TLS‑encrypted HTTP/2 to expose gRPC service, so need to [config SSL certificate](https.md)
+* attention: APISIX also support to expose gRPC service with plaintext HTTP/2, which do not need to config SSL certificate, usually used to proxy gRPC service in intranet environment

Review comment:
       What about "which doesn't rely on TLS/SSL"?




----------------------------------------------------------------
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.

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



[GitHub] [apisix] hnlq715 commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
hnlq715 commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571811074



##########
File path: conf/config.yaml
##########
@@ -31,6 +31,12 @@
 #
 # If the configured environment variable can't be found, an error will be thrown.
 apisix:
+  node_listen:
+    - port: 9080                     # APISIX listening port
+      enable_http2: false            # Disable to support HTTP proxy, nginx currently do not support HTTP and HTTP/2 with plaintext on the same port
+                                     # Details can be found in https://trac.nginx.org/nginx/ticket/816
+    - port: 9081                     # APISIX listening port for HTTP/2 with plaintext

Review comment:
       done

##########
File path: doc/grpc-proxy.md
##########
@@ -36,7 +36,8 @@ gRPC client -> APISIX -> gRPC/gRPCS server
 Here's an example, to proxying gRPC service by specified route:
 
 * attention: the `scheme` of the route's upstream must be `grpc` or `grpcs`.
-* attention: APISIX use TLS‑encrypted HTTP/2 to expose gRPC service, so need to [config SSL certificate](https.md)
+* attention: APISIX use TLS‑encrypted HTTP/2 to expose gRPC service (default port 9443), so need to [config SSL certificate](https.md)
+* attention: APISIX also support to expose gRPC service with plaintext HTTP/2 (default port 9081), which do not need to config SSL certificate, usually used to proxy gRPC service in intranet environment

Review comment:
       done

##########
File path: conf/config.yaml
##########
@@ -31,6 +31,12 @@
 #
 # If the configured environment variable can't be found, an error will be thrown.
 apisix:
+  node_listen:
+    - port: 9080                     # APISIX listening port

Review comment:
       done




----------------------------------------------------------------
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.

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



[GitHub] [apisix] spacewander commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571605941



##########
File path: t/core/config-default.t
##########
@@ -91,3 +91,53 @@ apisix:
 GET /t
 --- response_body
 admin_key: null
+
+
+
+=== TEST 5: support listen multiple ports with array

Review comment:
       Need to add tests in t/grpc-proxy-test.sh.
   And need to update the doc/grpc-proxy.md




----------------------------------------------------------------
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.

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



[GitHub] [apisix] hnlq715 commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
hnlq715 commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571757891



##########
File path: apisix/cli/ops.lua
##########
@@ -238,10 +238,18 @@ Please modify "admin_key" in conf/config.yaml .
         util.die("missing apisix.proxy_cache for plugin proxy-cache\n")
     end
 
-    --support multiple ports listen, compatible with the original style
+    -- support multiple ports listen, compatible with the original style
     if type(yaml_conf.apisix.node_listen) == "number" then
-        local node_listen = {yaml_conf.apisix.node_listen}
+        local node_listen = {{port = yaml_conf.apisix.node_listen}}
         yaml_conf.apisix.node_listen = node_listen
+    elseif type(yaml_conf.apisix.node_listen) == "table" then
+        if type(yaml_conf.apisix.node_listen[1]) == "number" then

Review comment:
       Only support port with number parameter?




----------------------------------------------------------------
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.

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



[GitHub] [apisix] spacewander commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571760883



##########
File path: doc/grpc-proxy.md
##########
@@ -36,7 +36,8 @@ gRPC client -> APISIX -> gRPC/gRPCS server
 Here's an example, to proxying gRPC service by specified route:
 
 * attention: the `scheme` of the route's upstream must be `grpc` or `grpcs`.
-* attention: APISIX use TLS‑encrypted HTTP/2 to expose gRPC service, so need to [config SSL certificate](https.md)
+* attention: APISIX use TLS‑encrypted HTTP/2 to expose gRPC service (default port 9443), so need to [config SSL certificate](https.md)
+* attention: APISIX also support to expose gRPC service with plaintext HTTP/2 (default port 9081), which do not need to config SSL certificate, usually used to proxy gRPC service in intranet environment

Review comment:
       Need a configuration to show how we can do it.

##########
File path: conf/config.yaml
##########
@@ -31,6 +31,12 @@
 #
 # If the configured environment variable can't be found, an error will be thrown.
 apisix:
+  node_listen:
+    - port: 9080                     # APISIX listening port

Review comment:
       We should provide the configuration separately in:
   https://github.com/apache/apisix/blob/26a4ed4ad491f140fe441df281365c44723cae20/.travis/linux_openresty_common_runner.sh#L125

##########
File path: conf/config.yaml
##########
@@ -31,6 +31,12 @@
 #
 # If the configured environment variable can't be found, an error will be thrown.
 apisix:
+  node_listen:
+    - port: 9080                     # APISIX listening port
+      enable_http2: false            # Disable to support HTTP proxy, nginx currently do not support HTTP and HTTP/2 with plaintext on the same port
+                                     # Details can be found in https://trac.nginx.org/nginx/ticket/816
+    - port: 9081                     # APISIX listening port for HTTP/2 with plaintext

Review comment:
       Don't open a port for HTTP/2 by default.

##########
File path: apisix/cli/ops.lua
##########
@@ -238,10 +238,18 @@ Please modify "admin_key" in conf/config.yaml .
         util.die("missing apisix.proxy_cache for plugin proxy-cache\n")
     end
 
-    --support multiple ports listen, compatible with the original style
+    -- support multiple ports listen, compatible with the original style
     if type(yaml_conf.apisix.node_listen) == "number" then
-        local node_listen = {yaml_conf.apisix.node_listen}
+        local node_listen = {{port = yaml_conf.apisix.node_listen}}
         yaml_conf.apisix.node_listen = node_listen
+    elseif type(yaml_conf.apisix.node_listen) == "table" then
+        if type(yaml_conf.apisix.node_listen[1]) == "number" then

Review comment:
       I think we should check every item, what if the user mixes the integer and the table?




----------------------------------------------------------------
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.

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



[GitHub] [apisix] spacewander merged pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #3547:
URL: https://github.com/apache/apisix/pull/3547


   


----------------------------------------------------------------
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.

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



[GitHub] [apisix] spacewander commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571882122



##########
File path: apisix/cli/ops.lua
##########
@@ -238,9 +238,19 @@ Please modify "admin_key" in conf/config.yaml .
         util.die("missing apisix.proxy_cache for plugin proxy-cache\n")
     end
 
-    --support multiple ports listen, compatible with the original style
+    -- support multiple ports listen, compatible with the original style
     if type(yaml_conf.apisix.node_listen) == "number" then
-        local node_listen = {yaml_conf.apisix.node_listen}
+        local node_listen = {{port = yaml_conf.apisix.node_listen}}
+        yaml_conf.apisix.node_listen = node_listen
+    elseif type(yaml_conf.apisix.node_listen) == "table" then
+        local node_listen = {}
+        for index, value in ipairs(yaml_conf.apisix.node_listen) do
+            if type(value) == "number" then

Review comment:
       We need to be backward compatibility.




----------------------------------------------------------------
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.

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



[GitHub] [apisix] hnlq715 commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
hnlq715 commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571906637



##########
File path: doc/grpc-proxy.md
##########
@@ -37,6 +37,7 @@ Here's an example, to proxying gRPC service by specified route:
 
 * attention: the `scheme` of the route's upstream must be `grpc` or `grpcs`.
 * attention: APISIX use TLS‑encrypted HTTP/2 to expose gRPC service, so need to [config SSL certificate](https.md)
+* attention: APISIX also support to expose gRPC service with plaintext HTTP/2, which do not need to config SSL certificate, usually used to proxy gRPC service in intranet environment

Review comment:
       Alright, done :-)




----------------------------------------------------------------
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.

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



[GitHub] [apisix] spacewander commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571882122



##########
File path: apisix/cli/ops.lua
##########
@@ -238,9 +238,19 @@ Please modify "admin_key" in conf/config.yaml .
         util.die("missing apisix.proxy_cache for plugin proxy-cache\n")
     end
 
-    --support multiple ports listen, compatible with the original style
+    -- support multiple ports listen, compatible with the original style
     if type(yaml_conf.apisix.node_listen) == "number" then
-        local node_listen = {yaml_conf.apisix.node_listen}
+        local node_listen = {{port = yaml_conf.apisix.node_listen}}
+        yaml_conf.apisix.node_listen = node_listen
+    elseif type(yaml_conf.apisix.node_listen) == "table" then
+        local node_listen = {}
+        for index, value in ipairs(yaml_conf.apisix.node_listen) do
+            if type(value) == "number" then

Review comment:
       We need to be backward compatibility unless it is a bugfix.




----------------------------------------------------------------
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.

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



[GitHub] [apisix] spacewander commented on pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#issuecomment-774912924


   Need to resolve the conflict, so that CI can start.


----------------------------------------------------------------
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.

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



[GitHub] [apisix] hnlq715 commented on a change in pull request #3547: feat: support listen http2 with plaintext

Posted by GitBox <gi...@apache.org>.
hnlq715 commented on a change in pull request #3547:
URL: https://github.com/apache/apisix/pull/3547#discussion_r571758279



##########
File path: t/core/config-default.t
##########
@@ -91,3 +91,53 @@ apisix:
 GET /t
 --- response_body
 admin_key: null
+
+
+
+=== TEST 5: support listen multiple ports with array

Review comment:
       done




----------------------------------------------------------------
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.

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