-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [ISSUE#8309] Nacos supports synchronizing service metadata from k8s service discovery. (#7211) * Synchronize k8s services. * Synchronize k8s endpoints. * ApiClient uses the default configuration instead * Start registered Informers after registering handlers * Compare oldServicePorts and newServicePorts to determine portChange * Delete the logic of service renaming judgment * Fix error in the process of registering instances * Use independent log * add k8s sync switch and start informer optimization * start informer optimization
- Loading branch information
Showing
10 changed files
with
642 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright 1999-2022 Alibaba Group Holding Ltd. | ||
~ | ||
~ Licensed 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. | ||
--> | ||
|
||
<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"> | ||
<parent> | ||
<artifactId>nacos-all</artifactId> | ||
<groupId>com.alibaba.nacos</groupId> | ||
<version>${revision}</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>nacos-k8s-sync</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>nacos-k8s-sync ${project.version}</name> | ||
<url>http://nacos.io</url> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>nacos-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>nacos-naming</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.kubernetes</groupId> | ||
<artifactId>client-java-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.kubernetes</groupId> | ||
<artifactId>client-java</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-beans</artifactId> | ||
<version>5.3.20</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
49 changes: 49 additions & 0 deletions
49
k8s-sync/src/main/java/com/alibaba/nacos/k8s/sync/K8sSyncConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 1999-2018 Alibaba Group Holding Ltd. | ||
* | ||
* Licensed 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 com.alibaba.nacos.k8s.sync; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* Configurations for k8s integration. | ||
* | ||
* @author EmanuelGi | ||
*/ | ||
@Component | ||
public class K8sSyncConfig { | ||
@Value("${nacos.k8s.sync.enabled:false}") | ||
private boolean enabled = false; | ||
|
||
@Value("${nacos.k8s.sync.outsideCluster:false}") | ||
private boolean outsideCluster = false; | ||
|
||
@Value("${nacos.k8s.sync.kubeConfig:}") | ||
private String kubeConfig; | ||
|
||
public boolean isEnabled() { | ||
return enabled; | ||
} | ||
|
||
public boolean isOutsideCluster() { | ||
return outsideCluster; | ||
} | ||
|
||
public String getKubeConfig() { | ||
return kubeConfig; | ||
} | ||
} |
Oops, something went wrong.