Skip to content

Commit d6704a9

Browse files
呈铭liujianjun.ljj
呈铭
authored and
liujianjun.ljj
committed
support sofa registry kubernetes
1 parent ac2a73e commit d6704a9

File tree

20 files changed

+1215
-0
lines changed

20 files changed

+1215
-0
lines changed

all/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@
244244
<artifactId>sofa-rpc-registry-polaris</artifactId>
245245
<version>${project.version}</version>
246246
</dependency>
247+
<dependency>
248+
<groupId>com.alipay.sofa</groupId>
249+
<artifactId>sofa-rpc-registry-kubernetes</artifactId>
250+
<version>${project.version}</version>
251+
</dependency>
247252
<dependency>
248253
<groupId>com.alipay.sofa</groupId>
249254
<artifactId>sofa-rpc-remoting-bolt</artifactId>
@@ -545,6 +550,7 @@
545550
<include>com.alipay.sofa:sofa-rpc-registry-multicast</include>
546551
<include>com.alipay.sofa:sofa-rpc-registry-sofa</include>
547552
<include>com.alipay.sofa:sofa-rpc-registry-polaris</include>
553+
<include>com.alipay.sofa:sofa-rpc-registry-kubernetes</include>
548554
<include>com.alipay.sofa:sofa-rpc-remoting-bolt</include>
549555
<include>com.alipay.sofa:sofa-rpc-remoting-http</include>
550556
<include>com.alipay.sofa:sofa-rpc-remoting-resteasy</include>

bom/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
<!-- Build args -->
6161
<module.install.skip>true</module.install.skip>
6262
<module.deploy.skip>true</module.deploy.skip>
63+
<!-- Fabric8 for Kubernetes -->
64+
<fabric8_kubernetes_version>6.9.2</fabric8_kubernetes_version>
6365
</properties>
6466

6567
<dependencyManagement>
@@ -514,6 +516,19 @@
514516
<version>${grpc.version}</version>
515517
</dependency>
516518

519+
<!-- Fabric8 for Kubernetes -->
520+
<dependency>
521+
<groupId>io.fabric8</groupId>
522+
<artifactId>kubernetes-client</artifactId>
523+
<version>${fabric8_kubernetes_version}</version>
524+
</dependency>
525+
<dependency>
526+
<groupId>io.fabric8</groupId>
527+
<artifactId>kubernetes-server-mock</artifactId>
528+
<scope>test</scope>
529+
<version>${fabric8_kubernetes_version}</version>
530+
</dependency>
531+
517532
<!-- Test libs -->
518533
<dependency>
519534
<groupId>org.apache.curator</groupId>

core/api/src/main/java/com/alipay/sofa/rpc/config/RegistryConfig.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,36 @@ public String getParameter(String key) {
398398
return parameters == null ? null : parameters.get(key);
399399
}
400400

401+
/**
402+
* Gets parameter or default.
403+
*
404+
* @param key the key
405+
* @return the value
406+
*/
407+
public String getParameter(String key, String defaultValue) {
408+
return getParameter(key) == null ? defaultValue : getParameter(key);
409+
}
410+
411+
/**
412+
* Gets parameter or default.
413+
*
414+
* @param key the key
415+
* @return the value
416+
*/
417+
public int getParameter(String key, int defaultValue) {
418+
return getParameter(key) == null ? defaultValue : Integer.parseInt(parameters.get(key));
419+
}
420+
421+
/**
422+
* Gets parameter or default.
423+
*
424+
* @param key the key
425+
* @return the value
426+
*/
427+
public boolean getParameter(String key, boolean defaultValue) {
428+
return getParameter(key) == null ? defaultValue : Boolean.parseBoolean(parameters.get(key));
429+
}
430+
401431
@Override
402432
public String toString() {
403433
return "RegistryConfig{" +

registry/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<module>registry-multicast</module>
2323
<module>registry-sofa</module>
2424
<module>registry-polaris</module>
25+
<module>registry-kubernetes</module>
2526
</modules>
2627

2728
<dependencyManagement>

registry/registry-kubernetes/pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>com.alipay.sofa</groupId>
9+
<artifactId>sofa-rpc-registry</artifactId>
10+
<version>${revision}</version>
11+
</parent>
12+
13+
<artifactId>sofa-rpc-registry-kubernetes</artifactId>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>com.alipay.sofa</groupId>
18+
<artifactId>sofa-rpc-log</artifactId>
19+
</dependency>
20+
<dependency>
21+
<groupId>com.alipay.sofa</groupId>
22+
<artifactId>sofa-rpc-api</artifactId>
23+
</dependency>
24+
<dependency>
25+
<groupId>com.alipay.sofa</groupId>
26+
<artifactId>sofa-rpc-codec-api</artifactId>
27+
</dependency>
28+
<dependency>
29+
<groupId>io.fabric8</groupId>
30+
<artifactId>kubernetes-client</artifactId>
31+
</dependency>
32+
<dependency>
33+
<groupId>io.fabric8</groupId>
34+
<artifactId>kubernetes-server-mock</artifactId>
35+
<scope>test</scope>
36+
</dependency>
37+
</dependencies>
38+
39+
</project>

0 commit comments

Comments
 (0)