Spring Boot
With spring boot, we suggest you start with one of the provided starters:
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>kubernetes-spring-starter</artifactId>
<version>4.1.4</version>
</dependency>
Or if you are on OpenShift:
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>openshfit-spring-starter</artifactId>
<version>4.1.4</version>
</dependency>
Automatic configuration
For Spring Boot application, dekorate will automatically detect known annotation and will align generated manifests accordingly.
Exposing services
Dekorate tunes the generated manifest based on the presence of web annotations in the project:
- Automatic service expose
- Application path detection
When known web annotations are available in the project, dekorate will automatically detect and expose the http port as a Service.
That service will also be expose as an Ingress
or Route
(in case of Openshift) if the expose
option is set to true.
Kubernetes
@KubernetesApplication(expose=true)
An alternative way of configuration is via application properties
:
dekorate.kubernetes.ingress.expose=true
Openshift
@OpenshiftApplication(route=@Route(expose=true))
An alternative way of configuration is via application properties
:
dekorate.openshift.route.expose=true
There are cases where the Ingress
or Route
host needs to be customized. This is done using the host
parametes either via annotation or property configuration.
Kubernetes
@KubernetesApplication(expose=true, host="foo.bar.com")
An alternative way of configuration is via application properties
:
dekorate.kubernetes.ingress.expose=true
dekorate.kubernetes.ingress.host=foo.bar.com
Openshift
@OpenshiftApplication(expose=true, host="foo.bar.com")
An alternative way of configuration is via application properties
:
dekorate.openshift.route.expose=true
dekorate.openshift.route.host=foo.bar.com
RequestMapping
When one RequestMapping
annotation is added on a Controller
or multiple RequestMapping
that share a common path are added on multiple Controller
classes,
dekorate will detect the shortest common path and configure it so that its available on the expose Ingress
or Route
.