Skip to content

Commit bb973fb

Browse files
author
Ryan Baxter
committed
Merge branch 'informer-based-discovery-client' of https://github.com/yue9944882/spring-cloud-kubernetes into yue9944882-informer-based-discovery-client
2 parents d71eaff + 3794e0e commit bb973fb

File tree

25 files changed

+1468
-2
lines changed

25 files changed

+1468
-2
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<module>docs</module>
107107
<module>spring-cloud-kubernetes-loadbalancer</module>
108108
<module>spring-cloud-starter-kubernetes-loadbalancer</module>
109+
<module>spring-cloud-kubernetes-client-discovery</module>
109110
</modules>
110111

111112
<dependencyManagement>

spring-cloud-kubernetes-client-autoconfig/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
<groupId>io.kubernetes</groupId>
2525
<artifactId>client-java-extended</artifactId>
2626
</dependency>
27+
<dependency>
28+
<groupId>io.kubernetes</groupId>
29+
<artifactId>client-java-spring-integration</artifactId>
30+
</dependency>
2731
<dependency>
2832
<groupId>org.springframework.boot</groupId>
2933
<artifactId>spring-boot-actuator-autoconfigure</artifactId>

spring-cloud-kubernetes-client-autoconfig/src/main/java/org/springframework/cloud/kubernetes/client/KubernetesClientAutoConfiguration.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,16 @@ public class KubernetesClientAutoConfiguration {
4646

4747
@Bean
4848
@ConditionalOnMissingBean
49-
public CoreV1Api coreApi() throws IOException {
49+
public ApiClient apiClient() throws IOException {
5050
ApiClient apiClient = kubernetesApiClient();
5151
io.kubernetes.client.openapi.Configuration.setDefaultApiClient(apiClient);
52-
return new CoreV1Api();
52+
return apiClient;
53+
}
54+
55+
@Bean
56+
@ConditionalOnMissingBean
57+
public CoreV1Api coreApi(ApiClient apiClient) throws IOException {
58+
return new CoreV1Api(apiClient);
5359
}
5460

5561
@Bean
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
<parent>
6+
<artifactId>spring-cloud-kubernetes</artifactId>
7+
<groupId>org.springframework.cloud</groupId>
8+
<version>2.0.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>spring-cloud-kubernetes-client-discovery</artifactId>
13+
<name>Spring Cloud Kubernetes :: Kubernetes Client Discovery</name>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>org.springframework.cloud</groupId>
18+
<artifactId>spring-cloud-kubernetes-client-autoconfig</artifactId>
19+
<version>${project.version}</version>
20+
</dependency>
21+
<dependency>
22+
<groupId>org.springframework.cloud</groupId>
23+
<artifactId>spring-cloud-commons</artifactId>
24+
<version>${spring-cloud-commons.version}</version>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.springframework.boot</groupId>
28+
<artifactId>spring-boot-actuator</artifactId>
29+
<optional>true</optional>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-autoconfigure</artifactId>
34+
<optional>true</optional>
35+
</dependency>
36+
37+
<!-- Testing Dependencies -->
38+
<dependency>
39+
<groupId>org.springframework.boot</groupId>
40+
<artifactId>spring-boot-starter-test</artifactId>
41+
<scope>test</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.junit.vintage</groupId>
45+
<artifactId>junit-vintage-engine</artifactId>
46+
<scope>test</scope>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.springframework.boot</groupId>
50+
<artifactId>spring-boot-starter-web</artifactId>
51+
<scope>test</scope>
52+
</dependency>
53+
<dependency>
54+
<groupId>org.springframework.cloud</groupId>
55+
<artifactId>spring-cloud-config-client</artifactId>
56+
<scope>test</scope>
57+
</dependency>
58+
59+
</dependencies>
60+
61+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2019-2019 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.cloud.kubernetes.client.discovery;
18+
19+
import java.lang.annotation.Documented;
20+
import java.lang.annotation.ElementType;
21+
import java.lang.annotation.Inherited;
22+
import java.lang.annotation.Retention;
23+
import java.lang.annotation.RetentionPolicy;
24+
import java.lang.annotation.Target;
25+
26+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
27+
28+
@Target(ElementType.TYPE)
29+
@Retention(RetentionPolicy.RUNTIME)
30+
@Documented
31+
@Inherited
32+
@ConditionalOnProperty(value = "spring.cloud.kubernetes.discovery.enabled", matchIfMissing = true)
33+
public @interface ConditionalOnKubernetesDiscoveryEnabled {
34+
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2013-2019 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.cloud.kubernetes.client.discovery;
18+
19+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
20+
import org.springframework.cloud.kubernetes.client.KubernetesClientAutoConfiguration;
21+
import org.springframework.context.annotation.Configuration;
22+
import org.springframework.context.annotation.Import;
23+
24+
@Configuration(proxyBeanMethods = false)
25+
@ConditionalOnProperty("spring.cloud.config.discovery.enabled")
26+
@Import({ KubernetesClientAutoConfiguration.class, KubernetesReactiveDiscoveryClientAutoConfiguration.class })
27+
public class KubernetesDiscoveryClientConfigClientBootstrapConfiguration {
28+
29+
}

0 commit comments

Comments
 (0)