You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/07/26 07:09:24 UTC

[GitHub] [dubbo] chenyanlann opened a new pull request, #10368: Adding support for bootstrap file

chenyanlann opened a new pull request, #10368:
URL: https://github.com/apache/dubbo/pull/10368

   ## What is the purpose of the change
   
   
   
   ## Brief changelog
   
   
   ## Verifying this change
   
   
   <!-- Follow this checklist to help us incorporate your contribution quickly and easily: -->
   
   ## Checklist
   - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
   - [ ] Each commit in the pull request should have a meaningful subject line and body.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
   - [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project.
   - [ ] Add some description to [dubbo-website](https://github.com/apache/dubbo-website) project if you are requesting to add a feature.
   - [ ] GitHub Actions works fine on your own branch.
   - [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] chenyanlann commented on a diff in pull request #10368: Adding support for bootstrap file

Posted by GitBox <gi...@apache.org>.
chenyanlann commented on code in PR #10368:
URL: https://github.com/apache/dubbo/pull/10368#discussion_r930783793


##########
dubbo-xds/pom.xml:
##########
@@ -84,6 +84,18 @@
             <groupId>org.bouncycastle</groupId>
             <artifactId>bcprov-ext-jdk15on</artifactId>
         </dependency>
+        <dependency>

Review Comment:
   Thank you, chengming, I have changed this.



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] wangchengming666 commented on a diff in pull request #10368: Adding support for bootstrap file

Posted by GitBox <gi...@apache.org>.
wangchengming666 commented on code in PR #10368:
URL: https://github.com/apache/dubbo/pull/10368#discussion_r929628668


##########
dubbo-xds/src/main/java/org/apache/dubbo/registry/xds/util/bootstrap/BootstrapperImpl.java:
##########
@@ -0,0 +1,164 @@
+package org.apache.dubbo.registry.xds.util.bootstrap;
+
+import io.envoyproxy.envoy.config.core.v3.Node;
+import io.grpc.ChannelCredentials;
+import io.grpc.internal.JsonParser;
+import io.grpc.internal.JsonUtil;
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.registry.xds.XdsInitializationException;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+class BootstrapperImpl extends Bootstrapper {
+
+    static final String BOOTSTRAP_PATH_SYS_ENV_VAR = "GRPC_XDS_BOOTSTRAP";
+    static String bootstrapPathFromEnvVar = System.getenv(BOOTSTRAP_PATH_SYS_ENV_VAR);
+
+    private static final Logger logger = LoggerFactory.getLogger(BootstrapperImpl.class);
+    private FileReader reader = LocalFileReader.INSTANCE;
+
+    private static final String SERVER_FEATURE_XDS_V3 = "xds_v3";
+    private static final String SERVER_FEATURE_IGNORE_RESOURCE_DELETION = "ignore_resource_deletion";
+
+    public BootstrapInfo bootstrap() throws XdsInitializationException {
+        String filePath = bootstrapPathFromEnvVar;
+        String fileContent = null;
+        if (filePath != null) {
+            try {
+                fileContent = reader.readFile(filePath);
+            } catch (IOException e) {
+                throw new XdsInitializationException("Fail to read bootstrap file", e);
+            }
+        }
+        if (fileContent == null) throw new XdsInitializationException("Cannot find bootstrap configuration");
+
+        Map<String, ?> rawBootstrap;
+        try {
+            rawBootstrap = (Map<String, ?>) JsonParser.parse(fileContent);
+        } catch (IOException e) {
+            throw new XdsInitializationException("Failed to parse JSON", e);
+        }
+        return bootstrap(rawBootstrap);

Review Comment:
   或许你可以在这里对接XdsServiceDiscoveryFactory,然后你看下这个createDiscovery这个方法,里面的doInitialize



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] wangchengming666 commented on a diff in pull request #10368: Adding support for bootstrap file

Posted by GitBox <gi...@apache.org>.
wangchengming666 commented on code in PR #10368:
URL: https://github.com/apache/dubbo/pull/10368#discussion_r929608686


##########
dubbo-xds/src/main/java/org/apache/dubbo/registry/xds/XdsInitializationException.java:
##########
@@ -0,0 +1,12 @@
+package org.apache.dubbo.registry.xds;

Review Comment:
   add apache license



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] wangchengming666 commented on a diff in pull request #10368: Adding support for bootstrap file

Posted by GitBox <gi...@apache.org>.
wangchengming666 commented on code in PR #10368:
URL: https://github.com/apache/dubbo/pull/10368#discussion_r930592918


##########
dubbo-xds/pom.xml:
##########
@@ -84,6 +84,18 @@
             <groupId>org.bouncycastle</groupId>
             <artifactId>bcprov-ext-jdk15on</artifactId>
         </dependency>
+        <dependency>

Review Comment:
   in dubbo-parent has org.junit.jupiter



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] wangchengming666 commented on a diff in pull request #10368: Adding support for bootstrap file

Posted by GitBox <gi...@apache.org>.
wangchengming666 commented on code in PR #10368:
URL: https://github.com/apache/dubbo/pull/10368#discussion_r929648983


##########
dubbo-xds/src/main/java/org/apache/dubbo/registry/xds/util/bootstrap/BootstrapperImpl.java:
##########
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.registry.xds.util.bootstrap;
+
+import io.envoyproxy.envoy.config.core.v3.Node;
+import io.grpc.ChannelCredentials;
+import io.grpc.internal.JsonParser;
+import io.grpc.internal.JsonUtil;
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.registry.xds.XdsInitializationException;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+class BootstrapperImpl extends Bootstrapper {
+
+    static final String BOOTSTRAP_PATH_SYS_ENV_VAR = "GRPC_XDS_BOOTSTRAP";
+    static String bootstrapPathFromEnvVar = System.getenv(BOOTSTRAP_PATH_SYS_ENV_VAR);
+
+    private static final Logger logger = LoggerFactory.getLogger(BootstrapperImpl.class);
+    private FileReader reader = LocalFileReader.INSTANCE;
+
+    private static final String SERVER_FEATURE_XDS_V3 = "xds_v3";
+    private static final String SERVER_FEATURE_IGNORE_RESOURCE_DELETION = "ignore_resource_deletion";
+
+    public BootstrapInfo bootstrap() throws XdsInitializationException {
+        String filePath = bootstrapPathFromEnvVar;
+        String fileContent = null;
+        if (filePath != null) {
+            try {
+                fileContent = reader.readFile(filePath);
+            } catch (IOException e) {
+                throw new XdsInitializationException("Fail to read bootstrap file", e);
+            }
+        }
+        if (fileContent == null) throw new XdsInitializationException("Cannot find bootstrap configuration");
+
+        Map<String, ?> rawBootstrap;
+        try {
+            rawBootstrap = (Map<String, ?>) JsonParser.parse(fileContent);
+        } catch (IOException e) {
+            throw new XdsInitializationException("Failed to parse JSON", e);
+        }
+        return bootstrap(rawBootstrap);
+    }
+
+    @Override
+    BootstrapInfo bootstrap(Map<String, ?> rawData) throws XdsInitializationException {
+        BootstrapInfo.Builder builder = new BootstrapInfoImpl.Builder();
+
+        List<?> rawServerConfigs = JsonUtil.getList(rawData, "xds_servers");

Review Comment:
   这里用了很多的`?`,是因为类型都是未知的吗



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] codecov-commenter commented on pull request #10368: Adding support for bootstrap file

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #10368:
URL: https://github.com/apache/dubbo/pull/10368#issuecomment-1197639796

   # [Codecov](https://codecov.io/gh/apache/dubbo/pull/10368?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#10368](https://codecov.io/gh/apache/dubbo/pull/10368?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7da82f2) into [3.1](https://codecov.io/gh/apache/dubbo/commit/88f17daf064c75e72394fa46913bd5ac274f1153?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (88f17da) will **decrease** coverage by `0.27%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@             Coverage Diff              @@
   ##                3.1   #10368      +/-   ##
   ============================================
   - Coverage     65.54%   65.26%   -0.28%     
   + Complexity      316      295      -21     
   ============================================
     Files          1248     1248              
     Lines         54257    54253       -4     
     Branches       8191     8165      -26     
   ============================================
   - Hits          35563    35409     -154     
   - Misses        14824    14956     +132     
   - Partials       3870     3888      +18     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo/pull/10368?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...mmon/serialize/fastjson2/FastJson2ObjectInput.java](https://codecov.io/gh/apache/dubbo/pull/10368/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tc2VyaWFsaXphdGlvbi9kdWJiby1zZXJpYWxpemF0aW9uLWZhc3Rqc29uMi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vY29tbW9uL3NlcmlhbGl6ZS9mYXN0anNvbjIvRmFzdEpzb24yT2JqZWN0SW5wdXQuamF2YQ==) | `0.00% <0.00%> (-62.50%)` | :arrow_down: |
   | [...mon/serialize/fastjson2/FastJson2ObjectOutput.java](https://codecov.io/gh/apache/dubbo/pull/10368/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tc2VyaWFsaXphdGlvbi9kdWJiby1zZXJpYWxpemF0aW9uLWZhc3Rqc29uMi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vY29tbW9uL3NlcmlhbGl6ZS9mYXN0anNvbjIvRmFzdEpzb24yT2JqZWN0T3V0cHV0LmphdmE=) | `0.00% <0.00%> (-56.25%)` | :arrow_down: |
   | [...on/serialize/fastjson2/FastJson2Serialization.java](https://codecov.io/gh/apache/dubbo/pull/10368/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tc2VyaWFsaXphdGlvbi9kdWJiby1zZXJpYWxpemF0aW9uLWZhc3Rqc29uMi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vY29tbW9uL3NlcmlhbGl6ZS9mYXN0anNvbjIvRmFzdEpzb24yU2VyaWFsaXphdGlvbi5qYXZh) | `57.14% <0.00%> (-28.58%)` | :arrow_down: |
   | [...nt/metadata/ServiceInstanceHostPortCustomizer.java](https://codecov.io/gh/apache/dubbo/pull/10368/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVnaXN0cnkvZHViYm8tcmVnaXN0cnktYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9jbGllbnQvbWV0YWRhdGEvU2VydmljZUluc3RhbmNlSG9zdFBvcnRDdXN0b21pemVyLmphdmE=) | `65.78% <0.00%> (-21.06%)` | :arrow_down: |
   | [...n/serialize/fastjson2/Fastjson2CreatorManager.java](https://codecov.io/gh/apache/dubbo/pull/10368/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tc2VyaWFsaXphdGlvbi9kdWJiby1zZXJpYWxpemF0aW9uLWZhc3Rqc29uMi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vY29tbW9uL3NlcmlhbGl6ZS9mYXN0anNvbjIvRmFzdGpzb24yQ3JlYXRvck1hbmFnZXIuamF2YQ==) | `46.66% <0.00%> (-20.00%)` | :arrow_down: |
   | [...ache/dubbo/remoting/transport/AbstractChannel.java](https://codecov.io/gh/apache/dubbo/pull/10368/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvQWJzdHJhY3RDaGFubmVsLmphdmE=) | `75.00% <0.00%> (-12.50%)` | :arrow_down: |
   | [...che/dubbo/registry/client/NopServiceDiscovery.java](https://codecov.io/gh/apache/dubbo/pull/10368/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVnaXN0cnkvZHViYm8tcmVnaXN0cnktYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9jbGllbnQvTm9wU2VydmljZURpc2NvdmVyeS5qYXZh) | `44.44% <0.00%> (-11.12%)` | :arrow_down: |
   | [...va/org/apache/dubbo/remoting/TimeoutException.java](https://codecov.io/gh/apache/dubbo/pull/10368/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy9UaW1lb3V0RXhjZXB0aW9uLmphdmE=) | `22.22% <0.00%> (-11.12%)` | :arrow_down: |
   | [...erialize/support/DefaultSerializationSelector.java](https://codecov.io/gh/apache/dubbo/pull/10368/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tc2VyaWFsaXphdGlvbi9kdWJiby1zZXJpYWxpemF0aW9uLWFwaS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vY29tbW9uL3NlcmlhbGl6ZS9zdXBwb3J0L0RlZmF1bHRTZXJpYWxpemF0aW9uU2VsZWN0b3IuamF2YQ==) | `50.00% <0.00%> (-10.00%)` | :arrow_down: |
   | [.../remoting/transport/netty4/NettyServerHandler.java](https://codecov.io/gh/apache/dubbo/pull/10368/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHk0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvbmV0dHk0L05ldHR5U2VydmVySGFuZGxlci5qYXZh) | `58.13% <0.00%> (-9.31%)` | :arrow_down: |
   | ... and [50 more](https://codecov.io/gh/apache/dubbo/pull/10368/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] chenyanlann commented on a diff in pull request #10368: Adding support for bootstrap file

Posted by GitBox <gi...@apache.org>.
chenyanlann commented on code in PR #10368:
URL: https://github.com/apache/dubbo/pull/10368#discussion_r930786357


##########
dubbo-xds/src/main/java/org/apache/dubbo/registry/xds/XdsInitializationException.java:
##########
@@ -0,0 +1,12 @@
+package org.apache.dubbo.registry.xds;

Review Comment:
   Thank you for your remind, chengming.



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] wangchengming666 commented on a diff in pull request #10368: Adding support for bootstrap file

Posted by GitBox <gi...@apache.org>.
wangchengming666 commented on code in PR #10368:
URL: https://github.com/apache/dubbo/pull/10368#discussion_r929648983


##########
dubbo-xds/src/main/java/org/apache/dubbo/registry/xds/util/bootstrap/BootstrapperImpl.java:
##########
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.registry.xds.util.bootstrap;
+
+import io.envoyproxy.envoy.config.core.v3.Node;
+import io.grpc.ChannelCredentials;
+import io.grpc.internal.JsonParser;
+import io.grpc.internal.JsonUtil;
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.registry.xds.XdsInitializationException;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+class BootstrapperImpl extends Bootstrapper {
+
+    static final String BOOTSTRAP_PATH_SYS_ENV_VAR = "GRPC_XDS_BOOTSTRAP";
+    static String bootstrapPathFromEnvVar = System.getenv(BOOTSTRAP_PATH_SYS_ENV_VAR);
+
+    private static final Logger logger = LoggerFactory.getLogger(BootstrapperImpl.class);
+    private FileReader reader = LocalFileReader.INSTANCE;
+
+    private static final String SERVER_FEATURE_XDS_V3 = "xds_v3";
+    private static final String SERVER_FEATURE_IGNORE_RESOURCE_DELETION = "ignore_resource_deletion";
+
+    public BootstrapInfo bootstrap() throws XdsInitializationException {
+        String filePath = bootstrapPathFromEnvVar;
+        String fileContent = null;
+        if (filePath != null) {
+            try {
+                fileContent = reader.readFile(filePath);
+            } catch (IOException e) {
+                throw new XdsInitializationException("Fail to read bootstrap file", e);
+            }
+        }
+        if (fileContent == null) throw new XdsInitializationException("Cannot find bootstrap configuration");
+
+        Map<String, ?> rawBootstrap;
+        try {
+            rawBootstrap = (Map<String, ?>) JsonParser.parse(fileContent);
+        } catch (IOException e) {
+            throw new XdsInitializationException("Failed to parse JSON", e);
+        }
+        return bootstrap(rawBootstrap);
+    }
+
+    @Override
+    BootstrapInfo bootstrap(Map<String, ?> rawData) throws XdsInitializationException {
+        BootstrapInfo.Builder builder = new BootstrapInfoImpl.Builder();
+
+        List<?> rawServerConfigs = JsonUtil.getList(rawData, "xds_servers");

Review Comment:
   这里用了很多的`?`,是因为类型都是未知的吗,是不是可以考虑用泛型替代呢



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] chenyanlann commented on a diff in pull request #10368: Adding support for bootstrap file

Posted by GitBox <gi...@apache.org>.
chenyanlann commented on code in PR #10368:
URL: https://github.com/apache/dubbo/pull/10368#discussion_r930784669


##########
dubbo-xds/src/test/java/org/apache/dubbo/registry/xds/util/bootstrap/BootstrapperTest.java:
##########
@@ -0,0 +1,124 @@
+package org.apache.dubbo.registry.xds.util.bootstrap;
+
+import org.apache.dubbo.registry.xds.XdsInitializationException;
+import org.hamcrest.MatcherAssert;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.apache.dubbo.registry.xds.util.bootstrap.BootstrapperImpl.BOOTSTRAP_PATH_SYS_ENV_VAR;
+import static org.hamcrest.Matchers.equalTo;
+
+public class BootstrapperTest {
+    public static void main(String[] args) throws XdsInitializationException {
+        String rawData = "{\n" +
+            "  \"xds_servers\": [\n" +
+            "    {\n" +
+            "      \"server_uri\": \"unix:///etc/istio/proxy/XDS\",\n" +
+            "      \"channel_creds\": [\n" +
+            "        {\n" +
+            "          \"type\": \"insecure\"\n" +
+            "        }\n" +
+            "      ],\n" +
+            "      \"server_features\": [\n" +
+            "        \"xds_v3\"\n" +
+            "      ]\n" +
+            "    }\n" +
+            "  ],\n" +
+            "  \"node\": {\n" +
+            "    \"id\": \"sidecar~172.17.0.4~dubbo-demo-consumer-deployment-grpc-agent-58585cb9cd-gp79p.dubbo-demo~dubbo-demo.svc.cluster.local\",\n" +
+            "    \"metadata\": {\n" +
+            "      \"ANNOTATIONS\": {\n" +
+            "        \"inject.istio.io/templates\": \"grpc-agent\",\n" +
+            "        \"kubernetes.io/config.seen\": \"2022-07-19T12:53:29.742565722Z\",\n" +
+            "        \"kubernetes.io/config.source\": \"api\",\n" +
+            "        \"prometheus.io/path\": \"/stats/prometheus\",\n" +
+            "        \"prometheus.io/port\": \"15020\",\n" +
+            "        \"prometheus.io/scrape\": \"true\",\n" +
+            "        \"proxy.istio.io/config\": \"{\\\"holdApplicationUntilProxyStarts\\\": true}\",\n" +
+            "        \"proxy.istio.io/overrides\": \"{\\\"containers\\\":[{\\\"name\\\":\\\"app\\\",\\\"image\\\":\\\"gcr.io/istio-testing/app:latest\\\",\\\"args\\\":[\\\"--metrics=15014\\\",\\\"--port\\\",\\\"18080\\\",\\\"--tcp\\\",\\\"19090\\\",\\\"--xds-grpc-server=17070\\\",\\\"--grpc\\\",\\\"17070\\\",\\\"--grpc\\\",\\\"17171\\\",\\\"--port\\\",\\\"3333\\\",\\\"--port\\\",\\\"8080\\\",\\\"--version\\\",\\\"v1\\\",\\\"--crt=/cert.crt\\\",\\\"--key=/cert.key\\\"],\\\"ports\\\":[{\\\"containerPort\\\":17070,\\\"protocol\\\":\\\"TCP\\\"},{\\\"containerPort\\\":17171,\\\"protocol\\\":\\\"TCP\\\"},{\\\"containerPort\\\":8080,\\\"protocol\\\":\\\"TCP\\\"},{\\\"name\\\":\\\"tcp-health-port\\\",\\\"containerPort\\\":3333,\\\"protocol\\\":\\\"TCP\\\"}],\\\"env\\\":[{\\\"name\\\":\\\"INSTANCE_IP\\\",\\\"valueFrom\\\":{\\\"fieldRef\\\":{\\\"apiVersion\\\":\\\"v1\\\",\\\"fieldPath\\\":\\\"status.podIP\\\"}}}],\\\"resources\\\":{},\\\"volumeMounts\\\":[{\\\"name\\\":\\\"kube-api-access-2tk
 nx\\\",\\\"readOnly\\\":true,\\\"mountPath\\\":\\\"/var/run/secrets/kubernetes.io/serviceaccount\\\"}],\\\"livenessProbe\\\":{\\\"tcpSocket\\\":{\\\"port\\\":\\\"tcp-health-port\\\"},\\\"initialDelaySeconds\\\":10,\\\"timeoutSeconds\\\":1,\\\"periodSeconds\\\":10,\\\"successThreshold\\\":1,\\\"failureThreshold\\\":10},\\\"readinessProbe\\\":{\\\"httpGet\\\":{\\\"path\\\":\\\"/\\\",\\\"port\\\":8080,\\\"scheme\\\":\\\"HTTP\\\"},\\\"initialDelaySeconds\\\":1,\\\"timeoutSeconds\\\":1,\\\"periodSeconds\\\":2,\\\"successThreshold\\\":1,\\\"failureThreshold\\\":10},\\\"startupProbe\\\":{\\\"tcpSocket\\\":{\\\"port\\\":\\\"tcp-health-port\\\"},\\\"timeoutSeconds\\\":1,\\\"periodSeconds\\\":10,\\\"successThreshold\\\":1,\\\"failureThreshold\\\":10},\\\"terminationMessagePath\\\":\\\"/dev/termination-log\\\",\\\"terminationMessagePolicy\\\":\\\"File\\\",\\\"imagePullPolicy\\\":\\\"Always\\\",\\\"securityContext\\\":{\\\"runAsUser\\\":1338,\\\"runAsGroup\\\":1338}},{\\\"name\\\":\\\"dubbo-dem
 o-consumer\\\",\\\"image\\\":\\\"dockeddocking/dubbo:consumer.v1.0\\\",\\\"command\\\":[\\\"sh\\\",\\\"-c\\\",\\\"java $JAVA_OPTS -jar dubbo-demo-consumer.jar \\\"],\\\"resources\\\":{},\\\"volumeMounts\\\":[{\\\"name\\\":\\\"kube-api-access-2tknx\\\",\\\"readOnly\\\":true,\\\"mountPath\\\":\\\"/var/run/secrets/kubernetes.io/serviceaccount\\\"}],\\\"terminationMessagePath\\\":\\\"/dev/termination-log\\\",\\\"terminationMessagePolicy\\\":\\\"File\\\",\\\"imagePullPolicy\\\":\\\"Always\\\"}]}\",\n" +
+            "        \"sidecar.istio.io/rewriteAppHTTPProbers\": \"false\",\n" +
+            "        \"sidecar.istio.io/status\": \"{\\\"initContainers\\\":null,\\\"containers\\\":[\\\"app\\\",\\\"dubbo-demo-consumer\\\",\\\"istio-proxy\\\"],\\\"volumes\\\":[\\\"workload-socket\\\",\\\"workload-certs\\\",\\\"istio-xds\\\",\\\"istio-data\\\",\\\"istio-podinfo\\\",\\\"istio-token\\\",\\\"istiod-ca-cert\\\"],\\\"imagePullSecrets\\\":null,\\\"revision\\\":\\\"default\\\"}\"\n" +
+            "      },\n" +
+            "      \"APP_CONTAINERS\": \"app,dubbo-demo-consumer\",\n" +
+            "      \"CLUSTER_ID\": \"Kubernetes\",\n" +
+            "      \"ENVOY_PROMETHEUS_PORT\": 15090,\n" +
+            "      \"ENVOY_STATUS_PORT\": 15021,\n" +
+            "      \"GENERATOR\": \"grpc\",\n" +
+            "      \"INSTANCE_IPS\": \"172.17.0.4\",\n" +
+            "      \"INTERCEPTION_MODE\": \"REDIRECT\",\n" +
+            "      \"ISTIO_PROXY_SHA\": \"2b6009118109b480e1d5abf3188fd7d9c0c0acf0\",\n" +
+            "      \"ISTIO_VERSION\": \"1.14.1\",\n" +
+            "      \"LABELS\": {\n" +
+            "        \"app\": \"dubbo-demo-consumer-dev\",\n" +
+            "        \"pod-template-hash\": \"58585cb9cd\",\n" +
+            "        \"service.istio.io/canonical-name\": \"dubbo-demo-consumer-dev\",\n" +
+            "        \"service.istio.io/canonical-revision\": \"v1\",\n" +
+            "        \"version\": \"v1\"\n" +
+            "      },\n" +
+            "      \"MESH_ID\": \"cluster.local\",\n" +
+            "      \"NAME\": \"dubbo-demo-consumer-deployment-grpc-agent-58585cb9cd-gp79p\",\n" +
+            "      \"NAMESPACE\": \"dubbo-demo\",\n" +
+            "      \"OWNER\": \"kubernetes://apis/apps/v1/namespaces/dubbo-demo/deployments/dubbo-demo-consumer-deployment-grpc-agent\",\n" +
+            "      \"PILOT_SAN\": [\n" +
+            "        \"istiod.istio-system.svc\"\n" +
+            "      ],\n" +
+            "      \"POD_PORTS\": \"[{\\\"containerPort\\\":17070,\\\"protocol\\\":\\\"TCP\\\"},{\\\"containerPort\\\":17171,\\\"protocol\\\":\\\"TCP\\\"},{\\\"containerPort\\\":8080,\\\"protocol\\\":\\\"TCP\\\"},{\\\"name\\\":\\\"tcp-health-port\\\",\\\"containerPort\\\":3333,\\\"protocol\\\":\\\"TCP\\\"}]\",\n" +
+            "      \"PROV_CERT\": \"var/run/secrets/istio/root-cert.pem\",\n" +
+            "      \"PROXY_CONFIG\": {\n" +
+            "        \"binaryPath\": \"/usr/local/bin/envoy\",\n" +
+            "        \"concurrency\": 2,\n" +
+            "        \"configPath\": \"./etc/istio/proxy\",\n" +
+            "        \"controlPlaneAuthPolicy\": \"MUTUAL_TLS\",\n" +
+            "        \"discoveryAddress\": \"istiod.istio-system.svc:15012\",\n" +
+            "        \"drainDuration\": \"45s\",\n" +
+            "        \"holdApplicationUntilProxyStarts\": true,\n" +
+            "        \"parentShutdownDuration\": \"60s\",\n" +
+            "        \"proxyAdminPort\": 15000,\n" +
+            "        \"serviceCluster\": \"istio-proxy\",\n" +
+            "        \"statNameLength\": 189,\n" +
+            "        \"statusPort\": 15020,\n" +
+            "        \"terminationDrainDuration\": \"5s\",\n" +
+            "        \"tracing\": {\n" +
+            "          \"zipkin\": {\n" +
+            "            \"address\": \"zipkin.istio-system:9411\"\n" +
+            "          }\n" +
+            "        }\n" +
+            "      },\n" +
+            "      \"SERVICE_ACCOUNT\": \"default\",\n" +
+            "      \"WORKLOAD_NAME\": \"dubbo-demo-consumer-deployment-grpc-agent\"\n" +
+            "    },\n" +
+            "    \"locality\": {},\n" +
+            "    \"UserAgentVersionType\": null\n" +
+            "  },\n" +
+            "  \"certificate_providers\": {\n" +
+            "    \"default\": {\n" +
+            "      \"plugin_name\": \"file_watcher\",\n" +
+            "      \"config\": {\n" +
+            "        \"certificate_file\": \"/var/lib/istio/data/cert-chain.pem\",\n" +
+            "        \"private_key_file\": \"/var/lib/istio/data/key.pem\",\n" +
+            "        \"ca_certificate_file\": \"/var/lib/istio/data/root-cert.pem\",\n" +
+            "        \"refresh_interval\": \"900s\"\n" +
+            "      }\n" +
+            "    }\n" +
+            "  },\n" +
+            "  \"server_listener_resource_name_template\": \"xds.istio.io/grpc/lds/inbound/%s\"\n" +
+            "}";
+        BootstrapperImpl.bootstrapPathFromEnvVar = "";
+        BootstrapperImpl bootstrapper = new BootstrapperImpl();
+        bootstrapper.setFileReader(createFileReader(rawData));
+        Bootstrapper.BootstrapInfo info = bootstrapper.bootstrap();
+        List<Bootstrapper.ServerInfo> serverInfoList = info.servers();
+        MatcherAssert.assertThat(serverInfoList.get(0).target(), equalTo("unix:///etc/istio/proxy/XDS"));

Review Comment:
   Thank you, chengming, I have involved Junit.



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] wangchengming666 commented on a diff in pull request #10368: Adding support for bootstrap file

Posted by GitBox <gi...@apache.org>.
wangchengming666 commented on code in PR #10368:
URL: https://github.com/apache/dubbo/pull/10368#discussion_r930536359


##########
dubbo-xds/src/test/java/org/apache/dubbo/registry/xds/util/bootstrap/BootstrapperTest.java:
##########
@@ -0,0 +1,124 @@
+package org.apache.dubbo.registry.xds.util.bootstrap;
+
+import org.apache.dubbo.registry.xds.XdsInitializationException;
+import org.hamcrest.MatcherAssert;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.apache.dubbo.registry.xds.util.bootstrap.BootstrapperImpl.BOOTSTRAP_PATH_SYS_ENV_VAR;
+import static org.hamcrest.Matchers.equalTo;
+
+public class BootstrapperTest {

Review Comment:
   use junit



##########
dubbo-xds/src/test/java/org/apache/dubbo/registry/xds/util/bootstrap/BootstrapperTest.java:
##########
@@ -0,0 +1,124 @@
+package org.apache.dubbo.registry.xds.util.bootstrap;
+
+import org.apache.dubbo.registry.xds.XdsInitializationException;
+import org.hamcrest.MatcherAssert;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.apache.dubbo.registry.xds.util.bootstrap.BootstrapperImpl.BOOTSTRAP_PATH_SYS_ENV_VAR;
+import static org.hamcrest.Matchers.equalTo;
+
+public class BootstrapperTest {
+    public static void main(String[] args) throws XdsInitializationException {
+        String rawData = "{\n" +
+            "  \"xds_servers\": [\n" +
+            "    {\n" +
+            "      \"server_uri\": \"unix:///etc/istio/proxy/XDS\",\n" +
+            "      \"channel_creds\": [\n" +
+            "        {\n" +
+            "          \"type\": \"insecure\"\n" +
+            "        }\n" +
+            "      ],\n" +
+            "      \"server_features\": [\n" +
+            "        \"xds_v3\"\n" +
+            "      ]\n" +
+            "    }\n" +
+            "  ],\n" +
+            "  \"node\": {\n" +
+            "    \"id\": \"sidecar~172.17.0.4~dubbo-demo-consumer-deployment-grpc-agent-58585cb9cd-gp79p.dubbo-demo~dubbo-demo.svc.cluster.local\",\n" +
+            "    \"metadata\": {\n" +
+            "      \"ANNOTATIONS\": {\n" +
+            "        \"inject.istio.io/templates\": \"grpc-agent\",\n" +
+            "        \"kubernetes.io/config.seen\": \"2022-07-19T12:53:29.742565722Z\",\n" +
+            "        \"kubernetes.io/config.source\": \"api\",\n" +
+            "        \"prometheus.io/path\": \"/stats/prometheus\",\n" +
+            "        \"prometheus.io/port\": \"15020\",\n" +
+            "        \"prometheus.io/scrape\": \"true\",\n" +
+            "        \"proxy.istio.io/config\": \"{\\\"holdApplicationUntilProxyStarts\\\": true}\",\n" +
+            "        \"proxy.istio.io/overrides\": \"{\\\"containers\\\":[{\\\"name\\\":\\\"app\\\",\\\"image\\\":\\\"gcr.io/istio-testing/app:latest\\\",\\\"args\\\":[\\\"--metrics=15014\\\",\\\"--port\\\",\\\"18080\\\",\\\"--tcp\\\",\\\"19090\\\",\\\"--xds-grpc-server=17070\\\",\\\"--grpc\\\",\\\"17070\\\",\\\"--grpc\\\",\\\"17171\\\",\\\"--port\\\",\\\"3333\\\",\\\"--port\\\",\\\"8080\\\",\\\"--version\\\",\\\"v1\\\",\\\"--crt=/cert.crt\\\",\\\"--key=/cert.key\\\"],\\\"ports\\\":[{\\\"containerPort\\\":17070,\\\"protocol\\\":\\\"TCP\\\"},{\\\"containerPort\\\":17171,\\\"protocol\\\":\\\"TCP\\\"},{\\\"containerPort\\\":8080,\\\"protocol\\\":\\\"TCP\\\"},{\\\"name\\\":\\\"tcp-health-port\\\",\\\"containerPort\\\":3333,\\\"protocol\\\":\\\"TCP\\\"}],\\\"env\\\":[{\\\"name\\\":\\\"INSTANCE_IP\\\",\\\"valueFrom\\\":{\\\"fieldRef\\\":{\\\"apiVersion\\\":\\\"v1\\\",\\\"fieldPath\\\":\\\"status.podIP\\\"}}}],\\\"resources\\\":{},\\\"volumeMounts\\\":[{\\\"name\\\":\\\"kube-api-access-2tk
 nx\\\",\\\"readOnly\\\":true,\\\"mountPath\\\":\\\"/var/run/secrets/kubernetes.io/serviceaccount\\\"}],\\\"livenessProbe\\\":{\\\"tcpSocket\\\":{\\\"port\\\":\\\"tcp-health-port\\\"},\\\"initialDelaySeconds\\\":10,\\\"timeoutSeconds\\\":1,\\\"periodSeconds\\\":10,\\\"successThreshold\\\":1,\\\"failureThreshold\\\":10},\\\"readinessProbe\\\":{\\\"httpGet\\\":{\\\"path\\\":\\\"/\\\",\\\"port\\\":8080,\\\"scheme\\\":\\\"HTTP\\\"},\\\"initialDelaySeconds\\\":1,\\\"timeoutSeconds\\\":1,\\\"periodSeconds\\\":2,\\\"successThreshold\\\":1,\\\"failureThreshold\\\":10},\\\"startupProbe\\\":{\\\"tcpSocket\\\":{\\\"port\\\":\\\"tcp-health-port\\\"},\\\"timeoutSeconds\\\":1,\\\"periodSeconds\\\":10,\\\"successThreshold\\\":1,\\\"failureThreshold\\\":10},\\\"terminationMessagePath\\\":\\\"/dev/termination-log\\\",\\\"terminationMessagePolicy\\\":\\\"File\\\",\\\"imagePullPolicy\\\":\\\"Always\\\",\\\"securityContext\\\":{\\\"runAsUser\\\":1338,\\\"runAsGroup\\\":1338}},{\\\"name\\\":\\\"dubbo-dem
 o-consumer\\\",\\\"image\\\":\\\"dockeddocking/dubbo:consumer.v1.0\\\",\\\"command\\\":[\\\"sh\\\",\\\"-c\\\",\\\"java $JAVA_OPTS -jar dubbo-demo-consumer.jar \\\"],\\\"resources\\\":{},\\\"volumeMounts\\\":[{\\\"name\\\":\\\"kube-api-access-2tknx\\\",\\\"readOnly\\\":true,\\\"mountPath\\\":\\\"/var/run/secrets/kubernetes.io/serviceaccount\\\"}],\\\"terminationMessagePath\\\":\\\"/dev/termination-log\\\",\\\"terminationMessagePolicy\\\":\\\"File\\\",\\\"imagePullPolicy\\\":\\\"Always\\\"}]}\",\n" +
+            "        \"sidecar.istio.io/rewriteAppHTTPProbers\": \"false\",\n" +
+            "        \"sidecar.istio.io/status\": \"{\\\"initContainers\\\":null,\\\"containers\\\":[\\\"app\\\",\\\"dubbo-demo-consumer\\\",\\\"istio-proxy\\\"],\\\"volumes\\\":[\\\"workload-socket\\\",\\\"workload-certs\\\",\\\"istio-xds\\\",\\\"istio-data\\\",\\\"istio-podinfo\\\",\\\"istio-token\\\",\\\"istiod-ca-cert\\\"],\\\"imagePullSecrets\\\":null,\\\"revision\\\":\\\"default\\\"}\"\n" +
+            "      },\n" +
+            "      \"APP_CONTAINERS\": \"app,dubbo-demo-consumer\",\n" +
+            "      \"CLUSTER_ID\": \"Kubernetes\",\n" +
+            "      \"ENVOY_PROMETHEUS_PORT\": 15090,\n" +
+            "      \"ENVOY_STATUS_PORT\": 15021,\n" +
+            "      \"GENERATOR\": \"grpc\",\n" +
+            "      \"INSTANCE_IPS\": \"172.17.0.4\",\n" +
+            "      \"INTERCEPTION_MODE\": \"REDIRECT\",\n" +
+            "      \"ISTIO_PROXY_SHA\": \"2b6009118109b480e1d5abf3188fd7d9c0c0acf0\",\n" +
+            "      \"ISTIO_VERSION\": \"1.14.1\",\n" +
+            "      \"LABELS\": {\n" +
+            "        \"app\": \"dubbo-demo-consumer-dev\",\n" +
+            "        \"pod-template-hash\": \"58585cb9cd\",\n" +
+            "        \"service.istio.io/canonical-name\": \"dubbo-demo-consumer-dev\",\n" +
+            "        \"service.istio.io/canonical-revision\": \"v1\",\n" +
+            "        \"version\": \"v1\"\n" +
+            "      },\n" +
+            "      \"MESH_ID\": \"cluster.local\",\n" +
+            "      \"NAME\": \"dubbo-demo-consumer-deployment-grpc-agent-58585cb9cd-gp79p\",\n" +
+            "      \"NAMESPACE\": \"dubbo-demo\",\n" +
+            "      \"OWNER\": \"kubernetes://apis/apps/v1/namespaces/dubbo-demo/deployments/dubbo-demo-consumer-deployment-grpc-agent\",\n" +
+            "      \"PILOT_SAN\": [\n" +
+            "        \"istiod.istio-system.svc\"\n" +
+            "      ],\n" +
+            "      \"POD_PORTS\": \"[{\\\"containerPort\\\":17070,\\\"protocol\\\":\\\"TCP\\\"},{\\\"containerPort\\\":17171,\\\"protocol\\\":\\\"TCP\\\"},{\\\"containerPort\\\":8080,\\\"protocol\\\":\\\"TCP\\\"},{\\\"name\\\":\\\"tcp-health-port\\\",\\\"containerPort\\\":3333,\\\"protocol\\\":\\\"TCP\\\"}]\",\n" +
+            "      \"PROV_CERT\": \"var/run/secrets/istio/root-cert.pem\",\n" +
+            "      \"PROXY_CONFIG\": {\n" +
+            "        \"binaryPath\": \"/usr/local/bin/envoy\",\n" +
+            "        \"concurrency\": 2,\n" +
+            "        \"configPath\": \"./etc/istio/proxy\",\n" +
+            "        \"controlPlaneAuthPolicy\": \"MUTUAL_TLS\",\n" +
+            "        \"discoveryAddress\": \"istiod.istio-system.svc:15012\",\n" +
+            "        \"drainDuration\": \"45s\",\n" +
+            "        \"holdApplicationUntilProxyStarts\": true,\n" +
+            "        \"parentShutdownDuration\": \"60s\",\n" +
+            "        \"proxyAdminPort\": 15000,\n" +
+            "        \"serviceCluster\": \"istio-proxy\",\n" +
+            "        \"statNameLength\": 189,\n" +
+            "        \"statusPort\": 15020,\n" +
+            "        \"terminationDrainDuration\": \"5s\",\n" +
+            "        \"tracing\": {\n" +
+            "          \"zipkin\": {\n" +
+            "            \"address\": \"zipkin.istio-system:9411\"\n" +
+            "          }\n" +
+            "        }\n" +
+            "      },\n" +
+            "      \"SERVICE_ACCOUNT\": \"default\",\n" +
+            "      \"WORKLOAD_NAME\": \"dubbo-demo-consumer-deployment-grpc-agent\"\n" +
+            "    },\n" +
+            "    \"locality\": {},\n" +
+            "    \"UserAgentVersionType\": null\n" +
+            "  },\n" +
+            "  \"certificate_providers\": {\n" +
+            "    \"default\": {\n" +
+            "      \"plugin_name\": \"file_watcher\",\n" +
+            "      \"config\": {\n" +
+            "        \"certificate_file\": \"/var/lib/istio/data/cert-chain.pem\",\n" +
+            "        \"private_key_file\": \"/var/lib/istio/data/key.pem\",\n" +
+            "        \"ca_certificate_file\": \"/var/lib/istio/data/root-cert.pem\",\n" +
+            "        \"refresh_interval\": \"900s\"\n" +
+            "      }\n" +
+            "    }\n" +
+            "  },\n" +
+            "  \"server_listener_resource_name_template\": \"xds.istio.io/grpc/lds/inbound/%s\"\n" +
+            "}";
+        BootstrapperImpl.bootstrapPathFromEnvVar = "";
+        BootstrapperImpl bootstrapper = new BootstrapperImpl();
+        bootstrapper.setFileReader(createFileReader(rawData));
+        Bootstrapper.BootstrapInfo info = bootstrapper.bootstrap();
+        List<Bootstrapper.ServerInfo> serverInfoList = info.servers();
+        MatcherAssert.assertThat(serverInfoList.get(0).target(), equalTo("unix:///etc/istio/proxy/XDS"));

Review Comment:
   use Assertions.assertEquals



-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ merged pull request #10368: Adding support for bootstrap file

Posted by GitBox <gi...@apache.org>.
AlbumenJ merged PR #10368:
URL: https://github.com/apache/dubbo/pull/10368


-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org