JooKS-me commented on code in PR #5054:
URL: https://github.com/apache/shenyu/pull/5054#discussion_r1305124217


##########
shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/DivideIngressParser.java:
##########
@@ -290,15 +292,15 @@ private List<DivideUpstream> parseUpstream(final 
V1IngressBackend backend, final
                     if (Objects.isNull(addresses) || addresses.isEmpty()) {
                         continue;
                     }
+                    int i = 0;
                     for (V1EndpointAddress address : addresses) {
                         String upstreamIp = address.getIp();
                         String defaultPort = parsePort(backend.getService());
                         if (Objects.nonNull(defaultPort)) {
                             DivideUpstream upstream = new DivideUpstream();
                             upstream.setUpstreamUrl(upstreamIp + ":" + 
defaultPort);
                             upstream.setWeight(100);
-                            // TODO support config protocol in annotation
-                            upstream.setProtocol("http://";);
+                            upstream.setProtocol(Objects.isNull(protocol) ? 
"http://"; : protocol.split(",")[i++]);

Review Comment:
   The split is used once every cycle, which is too inefficient, and the split 
should be placed outside the cycle.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to