Add Kubernetes Java Client Starters (#687)
* Deprecate KubernetesAutoServiceRegistration * Document service registry in kubernetes. Fixes #348 * Renaming leader module to be specific to fabric8 * Istio module rename * Renaming loadbalancer module * Rename loadbalancer starter * Rename config starter * Rename all starter * Rename kubernetes starter * Add new starters for Kubernetes Java Client implementations
This commit is contained in:
17
README.adoc
17
README.adoc
@@ -33,7 +33,10 @@ Spring Cloud Kubernetes provides implementations of well known Spring Cloud inte
|
||||
|
||||
Starters are convenient dependency descriptors you can include in your
|
||||
application. Include a starter to get the dependencies and Spring Boot
|
||||
auto-configuration for a feature set.
|
||||
auto-configuration for a feature set. Starters that begin with `spring-cloud-starter-kubernetes-fabric8`
|
||||
provide implementations using the https://github.com/fabric8io/kubernetes-client[Fabric8 Kubernetes Java Client].
|
||||
Starters that begin with
|
||||
`spring-cloud-starter-kubernetes-client` provide implementations using the https://github.com/kubernetes-client/java[Kubernetes Java Client].
|
||||
|
||||
[cols="a,d"]
|
||||
|===
|
||||
@@ -45,6 +48,10 @@ auto-configuration for a feature set.
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-fabric8</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client</artifactId>
|
||||
</dependency>
|
||||
----
|
||||
| <<DiscoveryClient for Kubernetes,Discovery Client>> implementation that
|
||||
resolves service names to Kubernetes Services.
|
||||
@@ -55,6 +62,10 @@ resolves service names to Kubernetes Services.
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-fabric8-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client-config</artifactId>
|
||||
</dependency>
|
||||
----
|
||||
| Load application properties from Kubernetes
|
||||
<<configmap-propertysource,ConfigMaps>> and <<Secrets PropertySource,Secrets>>.
|
||||
@@ -67,6 +78,10 @@ Secret changes.
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-fabric8-all</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client-all</artifactId>
|
||||
</dependency>
|
||||
----
|
||||
| All Spring Cloud Kubernetes features.
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ access from a Spring Boot application running as a pod.
|
||||
This is something that you get for free by adding the following dependency inside your project:
|
||||
|
||||
====
|
||||
Fabric8 Kubernetes Client
|
||||
[source,xml]
|
||||
----
|
||||
<dependency>
|
||||
@@ -18,6 +19,17 @@ This is something that you get for free by adding the following dependency insid
|
||||
----
|
||||
====
|
||||
|
||||
====
|
||||
Kubernetes Java Client
|
||||
[source,xml]
|
||||
----
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client</artifactId>
|
||||
</dependency>
|
||||
----
|
||||
====
|
||||
|
||||
To enable loading of the `DiscoveryClient`, add `@EnableDiscoveryClient` to the according configuration or application class, as the following example shows:
|
||||
|
||||
====
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
Starters are convenient dependency descriptors you can include in your
|
||||
application. Include a starter to get the dependencies and Spring Boot
|
||||
auto-configuration for a feature set.
|
||||
auto-configuration for a feature set. Starters that begin with `spring-cloud-starter-kubernetes-fabric8`
|
||||
provide implementations using the https://github.com/fabric8io/kubernetes-client[Fabric8 Kubernetes Java Client].
|
||||
Starters that begin with
|
||||
`spring-cloud-starter-kubernetes-client` provide implementations using the https://github.com/kubernetes-client/java[Kubernetes Java Client].
|
||||
|
||||
[cols="a,d"]
|
||||
|===
|
||||
@@ -14,6 +17,10 @@ auto-configuration for a feature set.
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-fabric8</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client</artifactId>
|
||||
</dependency>
|
||||
----
|
||||
| <<DiscoveryClient for Kubernetes,Discovery Client>> implementation that
|
||||
resolves service names to Kubernetes Services.
|
||||
@@ -24,6 +31,10 @@ resolves service names to Kubernetes Services.
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-fabric8-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client-config</artifactId>
|
||||
</dependency>
|
||||
----
|
||||
| Load application properties from Kubernetes
|
||||
<<configmap-propertysource,ConfigMaps>> and <<Secrets PropertySource,Secrets>>.
|
||||
@@ -36,7 +47,8 @@ Secret changes.
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-fabric8-all</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client-all</artifactId>
|
||||
</dependency>
|
||||
----
|
||||
| All Spring Cloud Kubernetes features.
|
||||
|
||||
|===
|
||||
|
||||
@@ -9,4 +9,4 @@ The main objective of the projects provided in this repository is to facilitate
|
||||
* `PropertySource` objects configured via ConfigMaps
|
||||
|
||||
## Getting Started
|
||||
The easiest way to get started is by including the Spring Cloud BOM and then adding `spring-cloud-starter-kubernetes-fabric8-all` to your application's classpath. If you don't want to include all of the Spring Cloud Kubernetes features you can add individual starters for the features you would like. By default Spring Cloud Kubernetes will enable the `kubernetes` profile when it detects it is running inside a Kubernetes cluster. You can take advantage of this by creating a `kubernetes-application` configuration properties for anything specific to Kubernetes you might want to configure. Once the starter is on the classpath the application should behave as any other Spring Cloud application.
|
||||
The easiest way to get started is by including the Spring Cloud BOM and then adding `spring-cloud-starter-kubernetes-client-all` to your application's classpath. If you don't want to include all of the Spring Cloud Kubernetes features you can add individual starters for the features you would like. By default Spring Cloud Kubernetes will enable the `kubernetes` profile when it detects it is running inside a Kubernetes cluster. You can take advantage of this by creating a `kubernetes-application` configuration properties for anything specific to Kubernetes you might want to configure. Once the starter is on the classpath the application should behave as any other Spring Cloud application.
|
||||
|
||||
@@ -34,6 +34,12 @@ Depending on the requirements, you'll need `get`, `list` and `watch` permission
|
||||
|
||||
|spring-cloud-starter-kubernetes-fabric8-config
|
||||
|configmaps, secrets
|
||||
|
||||
|spring-cloud-starter-kubernetes-client
|
||||
|pods, services, endpoints
|
||||
|
||||
|spring-cloud-starter-kubernetes-client-config
|
||||
|configmaps, secrets
|
||||
|===
|
||||
|
||||
For development purposes, you can add `cluster-reader` permissions to your `default` service account. On a production system you'll likely want to provide more granular permissions.
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -98,6 +98,8 @@
|
||||
<module>spring-cloud-starter-kubernetes-fabric8</module>
|
||||
<module>spring-cloud-starter-kubernetes-fabric8-config</module>
|
||||
<module>spring-cloud-starter-kubernetes-fabric8-all</module>
|
||||
<module>spring-cloud-starter-kubernetes-client</module>
|
||||
<module>spring-cloud-starter-kubernetes-client-config</module>
|
||||
<module>spring-cloud-starter-kubernetes-client-all</module>
|
||||
<module>spring-cloud-kubernetes-examples</module>
|
||||
<module>spring-cloud-kubernetes-fabric8-leader</module>
|
||||
|
||||
@@ -146,12 +146,24 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-fabric8-config</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client-config</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-fabric8-loadbalancer</artifactId>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client-all</artifactId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client-all</artifactId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
|
||||
30
spring-cloud-starter-kubernetes-client-config/pom.xml
Normal file
30
spring-cloud-starter-kubernetes-client-config/pom.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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-client-config</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-kubernetes-commons</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-kubernetes-client-autoconfig</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-kubernetes-client-config</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
46
spring-cloud-starter-kubernetes-client/pom.xml
Normal file
46
spring-cloud-starter-kubernetes-client/pom.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright 2013-2020 the original author or authors.
|
||||
~
|
||||
~ 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
|
||||
~
|
||||
~ https://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>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-client</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-kubernetes-commons</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-kubernetes-client-autoconfig</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-kubernetes-client-discovery</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
Reference in New Issue
Block a user