feat:support ipv6. (#1601)

Co-authored-by: Haotian Zhang <skyebefreeman@qq.com>
pull/1605/head
Fishtail 3 months ago committed by GitHub
parent 1bc55ae7ad
commit b55c8958a6
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/1586)
- [feat:upgrade to 2023.0.5.](https://github.com/Tencent/spring-cloud-tencent/pull/1588)
- [feat:support dynamic multi-discovery.](https://github.com/Tencent/spring-cloud-tencent/pull/1596)
- [feat:support ipv6.](https://github.com/Tencent/spring-cloud-tencent/pull/1601)

@ -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}");
}
}

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