#562 Refactoring
This commit is contained in:
1
pom.xml
1
pom.xml
@@ -97,6 +97,7 @@
|
||||
<module>spring-cloud-kubernetes-integration-tests</module>
|
||||
<module>docs</module>
|
||||
<module>spring-cloud-kubernetes-loadbalancer</module>
|
||||
<module>spring-cloud-starter-kubernetes-loadbalancer</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.kubernetes.loadbalancer;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.kubernetes.discovery.KubernetesDiscoveryProperties;
|
||||
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
|
||||
@@ -25,9 +26,10 @@ import org.springframework.context.annotation.Configuration;
|
||||
/**
|
||||
* @author Piotr Minkowski
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
@LoadBalancerClients(defaultConfiguration = KubernetesClientConfiguration.class)
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties(KubernetesLoadBalancerProperties.class)
|
||||
@ConditionalOnProperty("spring.cloud.kubernetes.loadbalancer.enabled")
|
||||
@LoadBalancerClients(defaultConfiguration = KubernetesLoadBalancerClientConfiguration.class)
|
||||
public class KubernetesLoadBalancerAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.core.env.Environment;
|
||||
*
|
||||
* @author Piotr Minkowski
|
||||
*/
|
||||
public class KubernetesClientConfiguration {
|
||||
public class KubernetesLoadBalancerClientConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "spring.cloud.kubernetes.loadbalancer.mode",
|
||||
@@ -35,10 +35,6 @@ import org.springframework.cloud.kubernetes.discovery.KubernetesServiceInstance;
|
||||
*/
|
||||
public class KubernetesServiceInstanceMapper {
|
||||
|
||||
private static final String DSL = "//";
|
||||
|
||||
private static final String COLON = ":";
|
||||
|
||||
private final KubernetesLoadBalancerProperties properties;
|
||||
|
||||
private final KubernetesDiscoveryProperties discoveryProperties;
|
||||
|
||||
@@ -76,7 +76,7 @@ public class KubernetesServicesListSupplier implements ServiceInstanceListSuppli
|
||||
result.add(mapper.map(service));
|
||||
}
|
||||
}
|
||||
return Flux.just(result);
|
||||
return Flux.defer(() -> Flux.just(result));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class KubernetesServiceListSupplierTests {
|
||||
|
||||
private Service buildService(String name, int port) {
|
||||
return new ServiceBuilder().withNewMetadata().withName(name).endMetadata()
|
||||
.withNewSpec().addNewPort().withPort(8080).endPort().endSpec().build();
|
||||
.withNewSpec().addNewPort().withPort(port).endPort().endSpec().build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
<artifactId>spring-cloud-kubernetes-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
26
spring-cloud-starter-kubernetes-loadbalancer/pom.xml
Normal file
26
spring-cloud-starter-kubernetes-loadbalancer/pom.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<artifactId>spring-cloud-kubernetes</artifactId>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>spring-cloud-starter-kubernetes-loadbalancer</artifactId>
|
||||
<name>Spring Cloud Kubernetes :: Starter :: LoadBalancer</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-kubernetes-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
Reference in New Issue
Block a user