feat:support ipv6. (#1598)

Co-authored-by: Haotian Zhang <skyebefreeman@qq.com>
pull/1604/head
Fishtail 3 months ago committed by GitHub
parent 587b5f7708
commit 36dab946da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5,3 +5,4 @@
- [feat:support config empty protection.](https://github.com/Tencent/spring-cloud-tencent/pull/1585)
- [feat:upgrade springframework version.](https://github.com/Tencent/spring-cloud-tencent/pull/1590)
- [feat:support dynamic multi-discovery.](https://github.com/Tencent/spring-cloud-tencent/pull/1595)
- [feat:support ipv6.](https://github.com/Tencent/spring-cloud-tencent/pull/1598)

@ -112,6 +112,11 @@ public class PolarisDiscoveryProperties {
@Value("${spring.cloud.polaris.discovery.zero-protection.is-need-test-connectivity:false}")
private boolean zeroProtectionNeedTestConnectivity = false;
/**
* if prefer ipv6.
*/
private Boolean preferIpv6 = false;
public String getInstanceId() {
return instanceId;
}
@ -219,6 +224,14 @@ public class PolarisDiscoveryProperties {
this.zeroProtectionNeedTestConnectivity = zeroProtectionNeedTestConnectivity;
}
public Boolean getPreferIpv6() {
return preferIpv6;
}
public void setPreferIpv6(Boolean preferIpv6) {
this.preferIpv6 = preferIpv6;
}
public Boolean getEnabled() {
return enabled;
}
@ -256,6 +269,7 @@ public class PolarisDiscoveryProperties {
", serviceListRefreshInterval=" + serviceListRefreshInterval +
", zeroProtectionEnabled=" + zeroProtectionEnabled +
", zeroProtectionNeedTestConnectivity=" + zeroProtectionNeedTestConnectivity +
", preferIpv6=" + preferIpv6 +
'}';
}
}

@ -59,6 +59,7 @@ public class PolarisDiscoveryHandler {
getHealthyInstancesRequest.setNamespace(namespace);
getHealthyInstancesRequest.setService(service);
getHealthyInstancesRequest.setIncludeCircuitBreakInstances(false);
getHealthyInstancesRequest.setPreferIpv6(polarisDiscoveryProperties.getPreferIpv6());
return polarisConsumer.getHealthyInstances(getHealthyInstancesRequest);
}

@ -78,6 +78,12 @@
"defaultValue": false,
"description": "Zero protection test connectivity switch. Default: false."
},
{
"name": "spring.cloud.polaris.discovery.prefer-ipv6",
"type": "java.lang.Boolean",
"defaultValue": false,
"description": "if prefer ipv6. Default: false."
},
{
"name": "spring.cloud.polaris.discovery.eager-load.enabled",
"type": "java.lang.Boolean",

@ -102,6 +102,7 @@ public class PolarisDiscoveryPropertiesTest {
+ ", healthCheckUrl='/health'"
+ ", serviceListRefreshInterval=1000"
+ ", zeroProtectionEnabled=false"
+ ", zeroProtectionNeedTestConnectivity=false}");
+ ", zeroProtectionNeedTestConnectivity=false"
+ ", preferIpv6=false}");
}
}

@ -8,7 +8,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-starter-tencent-multi-discovery-plugin</artifactId>
<name>Spring Cloud Tencent Trace Plugin</name>
<name>Spring Cloud Tencent Multi Discovery Plugin</name>
<dependencies>

@ -1,2 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.plugin.discovery.multi.config.MultiDiscoveryAutoConfiguration

@ -74,6 +74,11 @@ public final class TsfCoreEnvironmentPostProcessor implements EnvironmentPostPro
defaultProperties.put("spring.cloud.polaris.lossless.enabled", environment.getProperty("spring.cloud.polaris.lossless.enabled", "true"));
}
String tsfPreferIpv6 = environment.getProperty("tsf_prefer_ipv6");
if (StringUtils.isNotBlank(tsfPreferIpv6)) {
defaultProperties.put("spring.cloud.polaris.discovery.prefer-ipv6", tsfPreferIpv6);
}
if (TsfContextUtils.isTsfConsulEnabled(environment)) {
// tsf_consul_ip
String tsfConsulIp = environment.getProperty("tsf_consul_ip");

Loading…
Cancel
Save