Skip to content

Commit

Permalink
support sofa registry kubernetes
Browse files Browse the repository at this point in the history
  • Loading branch information
呈铭 authored and liujianjun.ljj committed Mar 14, 2024
1 parent ac2a73e commit af2a8c4
Show file tree
Hide file tree
Showing 20 changed files with 1,269 additions and 0 deletions.
6 changes: 6 additions & 0 deletions all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@
<artifactId>sofa-rpc-registry-polaris</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-rpc-registry-kubernetes</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-rpc-remoting-bolt</artifactId>
Expand Down Expand Up @@ -545,6 +550,7 @@
<include>com.alipay.sofa:sofa-rpc-registry-multicast</include>
<include>com.alipay.sofa:sofa-rpc-registry-sofa</include>
<include>com.alipay.sofa:sofa-rpc-registry-polaris</include>
<include>com.alipay.sofa:sofa-rpc-registry-kubernetes</include>
<include>com.alipay.sofa:sofa-rpc-remoting-bolt</include>
<include>com.alipay.sofa:sofa-rpc-remoting-http</include>
<include>com.alipay.sofa:sofa-rpc-remoting-resteasy</include>
Expand Down
15 changes: 15 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
<!-- Build args -->
<module.install.skip>true</module.install.skip>
<module.deploy.skip>true</module.deploy.skip>
<!-- Fabric8 for Kubernetes -->
<fabric8_kubernetes_version>6.9.2</fabric8_kubernetes_version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -514,6 +516,19 @@
<version>${grpc.version}</version>
</dependency>

<!-- Fabric8 for Kubernetes -->
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client</artifactId>
<version>${fabric8_kubernetes_version}</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-server-mock</artifactId>
<scope>test</scope>
<version>${fabric8_kubernetes_version}</version>
</dependency>

<!-- Test libs -->
<dependency>
<groupId>org.apache.curator</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,38 @@ public String getParameter(String key) {
return parameters == null ? null : parameters.get(key);
}

/**
* Gets parameter or default.
*
* @param key the key
* @return the value
*/
public String getParameter(String key, String defaultValue) {
return getParameter(key) == null ? defaultValue : getParameter(key);
}

/**
* Gets parameter or default.
*
* @param key the key
* @return the value
*/
public int getParameter(String key, int defaultValue) {
return (parameters == null || parameters.get(key) == null) ? defaultValue : Integer.parseInt(parameters
.get(key));
}

/**
* Gets parameter or default.
*
* @param key the key
* @return the value
*/
public boolean getParameter(String key, boolean defaultValue) {
return (parameters == null || parameters.get(key) == null) ? defaultValue : Boolean.parseBoolean(parameters
.get(key));
}

@Override
public String toString() {
return "RegistryConfig{" +
Expand Down
1 change: 1 addition & 0 deletions registry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<module>registry-multicast</module>
<module>registry-sofa</module>
<module>registry-polaris</module>
<module>registry-kubernetes</module>
</modules>

<dependencyManagement>
Expand Down
39 changes: 39 additions & 0 deletions registry/registry-kubernetes/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-rpc-registry</artifactId>
<version>${revision}</version>
</parent>

<artifactId>sofa-rpc-registry-kubernetes</artifactId>

<dependencies>
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-rpc-log</artifactId>
</dependency>
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-rpc-api</artifactId>
</dependency>
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-rpc-codec-api</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-server-mock</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Loading

0 comments on commit af2a8c4

Please sign in to comment.