Skip to content

Commit

Permalink
Antora migration
Browse files Browse the repository at this point in the history
  • Loading branch information
spencergibb committed Sep 19, 2023
1 parent 2e4d529 commit 3725c02
Show file tree
Hide file tree
Showing 31 changed files with 93 additions and 2,679 deletions.
File renamed without changes.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,9 @@ crashlytics-build.properties
.vscode/
.java-version
*Dockerfile

node
node_modules
build
package.json
package-lock.json
2 changes: 1 addition & 1 deletion .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/libs-snapshot-local -P spring
-P spring
3 changes: 2 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
2,477 changes: 0 additions & 2,477 deletions README.adoc

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions docs/antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ antora:
- '@antora/collector-extension'
- '@antora/atlas-extension'
- require: '@springio/antora-extensions/root-component-extension'
root_component_name: 'PROJECT_WITHOUT_SPRING'
# FIXME: Run antora once using this extension to migrate to the Asciidoc Tabs syntax
# and then remove this extension
- require: '@springio/antora-extensions/tabs-migration-extension'
unwrap_example_block: always
save_result: true
root_component_name: 'cloud-kubernetes'
site:
title: PROJECT_FULL_NAME
url: https://docs.spring.io/PROJECT_NAME/reference/
title: Spring Cloud Kubernetes
url: https://docs.spring.io/spring-cloud-kubernetes/reference/
content:
sources:
- url: ./..
Expand Down
4 changes: 2 additions & 2 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: PROJECT_WITHOUT_SPRING
name: cloud-kubernetes
version: true
title: PROJECT_NAME
title: Spring Cloud Kubernetes
nav:
- modules/ROOT/nav.adoc
ext:
Expand Down
8 changes: 1 addition & 7 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
* xref:index.adoc[]
* xref:spring-cloud-kubernetes.adoc[]
* xref:_attributes.adoc[]
* xref:index.adoc[Introduction]
* xref:getting-started.adoc[]
* xref:discovery-client.adoc[]
* xref:discovery-kubernetes-native.adoc[]
Expand All @@ -23,8 +21,4 @@
* xref:spring-cloud-kubernetes-discoveryserver.adoc[]
* xref:examples.adoc[]
* xref:other-resources.adoc[]
* xref:README.adoc[]
* xref:_configprops.adoc[]
* xref:appendix.adoc[]
* xref:sagan-boot.adoc[]
* xref:sagan-index.adoc[]
2 changes: 2 additions & 0 deletions docs/modules/ROOT/pages/appendix.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
= Common application properties
:page-section-summary-toc: 1

include::_attributes.adoc[]

Various properties can be specified inside your `application.properties` file, inside your `application.yml` file, or as command line switches.
This appendix provides a list of common {project-full-name} properties and references to the underlying classes that consume them.

NOTE: Property contributions can come from additional jar files on your classpath, so you should not consider this an exhaustive list.
Also, you can define your own properties.

include::partial$_configprops.adoc[]
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/configprops.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[[configuration-properties]]
= Configuration Properties

Below you can find a list of configuration properties.

include::partial$_configprops.adoc[]
18 changes: 0 additions & 18 deletions docs/modules/ROOT/pages/discovery-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ DiscoveryClient can also find services of type `ExternalName` (see https://kuber

This is something that you get for free by adding the following dependency inside your project:

====
HTTP Based `DiscoveryClient`
[source,xml]
----
Expand All @@ -20,12 +19,10 @@ HTTP Based `DiscoveryClient`
<artifactId>spring-cloud-starter-kubernetes-discoveryclient</artifactId>
</dependency>
----
====

NOTE: `spring-cloud-starter-kubernetes-discoveryclient` is designed to be used with the
xref:spring-cloud-kubernetes-discoveryserver.adoc#spring-cloud-kubernetes-discoveryserver[Spring Cloud Kubernetes DiscoveryServer].

====
Fabric8 Kubernetes Client
[source,xml]
----
Expand All @@ -34,9 +31,7 @@ Fabric8 Kubernetes Client
<artifactId>spring-cloud-starter-kubernetes-fabric8</artifactId>
</dependency>
----
====

====
Kubernetes Java Client
[source,xml]
----
Expand All @@ -45,11 +40,9 @@ Kubernetes Java Client
<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:

====
[source,java]
----
@SpringBootApplication
Expand All @@ -60,46 +53,37 @@ public class Application {
}
}
----
====

Then you can inject the client in your code simply by autowiring it, as the following example shows:

====
[source,java]
----
@Autowired
private DiscoveryClient discoveryClient;
----
====

You can choose to enable `DiscoveryClient` from all namespaces by setting the following property in `application.properties`:

====
[source]
----
spring.cloud.kubernetes.discovery.all-namespaces=true
----
====

To discover services and endpoints only from specified namespaces you should set property `all-namespaces` to `false` and set the following property in `application.properties` (in this example namespaces are: `ns1` and `ns2`).

====
[source]
----
spring.cloud.kubernetes.discovery.namespaces[0]=ns1
spring.cloud.kubernetes.discovery.namespaces[1]=ns2
----
====

To discover service endpoint addresses that are not marked as "ready" by the kubernetes api server, you can set the following property in `application.properties` (default: false):

====
[source]
----
spring.cloud.kubernetes.discovery.include-not-ready-addresses=true
----
NOTE: This might be useful when discovering services for monitoring purposes, and would enable inspecting the `/health` endpoint of not-ready service instances.
====

If your service exposes multiple ports, you will need to specify which port the `DiscoveryClient` should use.
The `DiscoveryClient` will choose the port using the following logic.
Expand All @@ -123,12 +107,10 @@ As said before, if you want to get the list of `ServiceInstance` to also include

If, for any reason, you need to disable the `DiscoveryClient`, you can set the following property in `application.properties`:

====
[source]
----
spring.cloud.kubernetes.discovery.enabled=false
----
====

Some Spring Cloud components use the `DiscoveryClient` in order to obtain information about the local service instance. For
this to work, you need to align the Kubernetes service name with the `spring.application.name` property.
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/discovery-kubernetes-native.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Kubernetes itself is capable of (server side) service discovery (see: https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services).
Using native kubernetes service discovery ensures compatibility with additional tooling, such as Istio (https://istio.io), a service mesh that is capable of load balancing, circuit breaker, failover, and much more.

The caller service then need only refer to names resolvable in a particular Kubernetes cluster. A simple implementation might use a spring `RestTemplate` that refers to a fully qualified domain name (FQDN), such as `https://{service-name}.{namespace}.svc.{cluster}.local:{service-port}`.
The caller service then need only refer to names resolvable in a particular Kubernetes cluster. A simple implementation might use a spring `RestTemplate` that refers to a fully qualified domain name (FQDN), such as `https://\{service-name}.\{namespace}.svc.\{cluster}.local:\{service-port}`.

Additionally, you can use Hystrix for:

Expand Down
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include::spring-cloud-kubernetes.adoc[Introduction]
4 changes: 0 additions & 4 deletions docs/modules/ROOT/pages/leader-election.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ When leadership removal occurs, the previous leader receives `OnRevokedEvent` ap
After removal, any instances in the cluster may become the new leader, including the old leader.

To include it in your project, add the following dependency.
====
Fabric8 Leader Implementation
[source,xml]
----
Expand All @@ -20,12 +19,9 @@ Fabric8 Leader Implementation
<artifactId>spring-cloud-kubernetes-fabric8-leader</artifactId>
</dependency>
----
====

To specify the name of the configmap used for leader election use the following property.
====
[source,properties]
----
spring.cloud.kubernetes.leader.config-map-name=leader
----
====
8 changes: 0 additions & 8 deletions docs/modules/ROOT/pages/load-balancer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

This project includes Spring Cloud Load Balancer for load balancing based on Kubernetes Endpoints and provides implementation of load balancer based on Kubernetes Service.
To include it to your project add the following dependency.
====
Fabric8 Implementation
[source,xml]
----
Expand All @@ -12,9 +11,7 @@ Fabric8 Implementation
<artifactId>spring-cloud-starter-kubernetes-fabric8-loadbalancer</artifactId>
</dependency>
----
====

====
Kubernetes Java Client Implementation
[source,xml]
----
Expand All @@ -23,22 +20,17 @@ Kubernetes Java Client Implementation
<artifactId>spring-cloud-starter-kubernetes-client-loadbalancer</artifactId>
</dependency>
----
====

To enable load balancing based on Kubernetes Service name use the following property. Then load balancer would try to call application using address, for example `service-a.default.svc.cluster.local`
====
[source]
----
spring.cloud.kubernetes.loadbalancer.mode=SERVICE
----
====

To enabled load balancing across all namespaces use the following property. Property from `spring-cloud-kubernetes-discovery` module is respected.
====
[source]
----
spring.cloud.kubernetes.discovery.all-namespaces=true
----
====

If a service needs to be accessed over HTTPS you need to add a label or annotation to your service definition with the name `secured` and the value `true` and the load balancer will then use HTTPS to make requests to the service.
Loading

0 comments on commit 3725c02

Please sign in to comment.