diff --git a/annotations/kubernetes-annotations/src/main/java/io/dekorate/kubernetes/annotation/Ingress.java b/annotations/kubernetes-annotations/src/main/java/io/dekorate/kubernetes/annotation/Ingress.java
index 82fb5a43c..49f1ef535 100644
--- a/annotations/kubernetes-annotations/src/main/java/io/dekorate/kubernetes/annotation/Ingress.java
+++ b/annotations/kubernetes-annotations/src/main/java/io/dekorate/kubernetes/annotation/Ingress.java
@@ -29,6 +29,13 @@
*/
String host() default "";
+ /**
+ * The class of the Ingress. If the ingressClassName is omitted, a default Ingress class is used.
+ *
+ * @return The class of the Ingress.
+ */
+ String ingressClassName() default "";
+
/**
* Controls whether the application should be exposed via Ingress
*/
diff --git a/annotations/kubernetes-annotations/src/main/java/io/dekorate/kubernetes/decorator/AddIngressDecorator.java b/annotations/kubernetes-annotations/src/main/java/io/dekorate/kubernetes/decorator/AddIngressDecorator.java
index 9f30a9075..d0e9aae61 100644
--- a/annotations/kubernetes-annotations/src/main/java/io/dekorate/kubernetes/decorator/AddIngressDecorator.java
+++ b/annotations/kubernetes-annotations/src/main/java/io/dekorate/kubernetes/decorator/AddIngressDecorator.java
@@ -60,6 +60,7 @@ public void visit(KubernetesListBuilder list) {
.withLabels(allLabels)
.endMetadata()
.withNewSpec()
+ .withIngressClassName(config.getIngress().getIngressClassName())
.addNewRule()
.withHost(config.getIngress().getHost())
.withNewHttp()
diff --git a/assets/config.md b/assets/config.md
index 81c8717f0..267157165 100644
--- a/assets/config.md
+++ b/assets/config.md
@@ -71,11 +71,6 @@ The document is structured as follows.
| dekorate.kubernetes.deployment-strategy | DeploymentStrategy | Specifies the deployment strategy. | None |
| dekorate.kubernetes.rolling-update | RollingUpdate | Specifies rolling update configuration. The configuration is applied when DeploymentStrategy == Rolling update, or when explicit configuration has been provided. In the later case RollingUpdate is assumed. | ( see RollingUpdate ) |
| dekorate.kubernetes.service-account | String | The service account. | |
-| dekorate.kubernetes.ingress.expose | boolean | Controls whether the application should be exposed via Ingress | false |
-| dekorate.kubernetes.ingress.host | String | The host under which the application is going to be exposed. | |
-| dekorate.kubernetes.ingress.tls-secret-name | String | The name of the secret used to configure TLS. | |
-| dekorate.kubernetes.ingress.tls-hosts | String[] | The list of hosts to be included in the TLS certificate. By default, it will use the application host. | |
-| dekorate.kubernetes.ingress.rules | IngressRule[] | Controls the generated ingress rules to be exposed as part of the Ingress resource. | |
| dekorate.kubernetes.ports | Port[] | The application ports. | |
| dekorate.kubernetes.service-type | ServiceType | The type of service that will be generated for the application. | ClusterIP |
| dekorate.kubernetes.pvc-volumes | PersistentVolumeClaimVolume[] | PersistentVolumeClaim volumes to add to all containers. | |
@@ -94,6 +89,7 @@ The document is structured as follows.
| dekorate.kubernetes.request-resources | ResourceRequirements | The resources that the application container requires. | ( see ResourceRequirements ) |
| dekorate.kubernetes.limit-resources | ResourceRequirements | The resource limit for the application container. | ( see ResourceRequirements ) |
| dekorate.kubernetes.sidecars | Container[] | The sidecars. | |
+| dekorate.kubernetes.ingress | Ingress | Configure the ingress resource. Only if the `expose` property is enabled. | (See Ingress) |
| dekorate.kubernetes.headless | boolean | Controls whether the generated {@link Service} will be headless. | false |
| dekorate.kubernetes.auto-deploy-enabled | boolean | Flag to trigger the registration of the deploy hook. It's generally preferable to use `-Ddekorate.deploy=true` instead of hardcoding this here. | false |
| dekorate.kubernetes.jobs | Job[] | The kubernetes jobs. | ( see Job ) |
@@ -124,6 +120,17 @@ The section below describes all the available subtypes.
| configmap | String | | |
| field | String | | |
+#### Ingress
+
+| Property | Type | Description | Default Value |
+|--------------------|---------------|--------------------------------------------------------------------------------------|-----------------------|
+| expose | boolean | Controls whether the application should be exposed via Ingress. | false |
+| host | String | The host under which the application is going to be exposed. | |
+| ingressClassName | String | The class of the Ingress. | |
+| tlsSecretName | String | The name of the secret used to configure TLS | |
+| tlsHosts | String[] | The list of hosts to be included in the TLS certificate | The application host |
+| rules | IngressRule[] | Controls the generated ingress rules to be exposed as part of the Ingress resource. | |
+
#### IngressRule
| Property | Type | Description | Default Value |
|----------------------|----------|--------------------------------------------------------------------------------------------------------------------|---------------|
diff --git a/docs/configuration-guide.md b/docs/configuration-guide.md
index 86be4dafa..ed46d5c46 100644
--- a/docs/configuration-guide.md
+++ b/docs/configuration-guide.md
@@ -93,11 +93,6 @@ The document is structured as follows.
| dekorate.kubernetes.deployment-strategy | DeploymentStrategy | Specifies the deployment strategy. | None |
| dekorate.kubernetes.rolling-update | RollingUpdate | Specifies rolling update configuration. The configuration is applied when DeploymentStrategy == Rolling update, or when explicit configuration has been provided. In the later case RollingUpdate is assumed. | ( see RollingUpdate ) |
| dekorate.kubernetes.service-account | String | The service account. | |
-| dekorate.kubernetes.ingress.expose | boolean | Controls whether the application should be exposed via Ingress | false |
-| dekorate.kubernetes.ingress.host | String | The host under which the application is going to be exposed. | |
-| dekorate.kubernetes.ingress.tls-secret-name | String | The name of the secret used to configure TLS. | |
-| dekorate.kubernetes.ingress.tls-hosts | String[] | The list of hosts to be included in the TLS certificate. By default, it will use the application host. | |
-| dekorate.kubernetes.ingress.rules | IngressRule[] | Controls the generated ingress rules to be exposed as part of the Ingress resource. | |
| dekorate.kubernetes.ports | Port[] | The application ports. | |
| dekorate.kubernetes.service-type | ServiceType | The type of service that will be generated for the application. | ClusterIP |
| dekorate.kubernetes.pvc-volumes | PersistentVolumeClaimVolume[] | PersistentVolumeClaim volumes to add to all containers. | |
@@ -164,6 +159,16 @@ The section below describes all the available subtypes.
| secret | String | | |
| configmap | String | | |
| field | String | | |
+#### Ingress
+
+| Property | Type | Description | Default Value |
+|--------------------|---------------|--------------------------------------------------------------------------------------|-----------------------|
+| expose | boolean | Controls whether the application should be exposed via Ingress. | false |
+| host | String | The host under which the application is going to be exposed. | |
+| ingressClassName | String | The class of the Ingress. | |
+| tlsSecretName | String | The name of the secret used to configure TLS | |
+| tlsHosts | String[] | The list of hosts to be included in the TLS certificate | The application host |
+| rules | IngressRule[] | Controls the generated ingress rules to be exposed as part of the Ingress resource. | |
#### IngressRule
| Property | Type | Description | Default Value |
@@ -215,13 +220,6 @@ The section below describes all the available subtypes.
| success-threshold | int | The success threshold to use. | 1 |
| failure-threshold | int | The failure threshold to use. | 3 |
-#### Ingress
-
-| Property | Type | Description | Default Value |
-|--------------------|----------|---------------------------------------------------------|---------------|
-| tlsSecretName | String | The name of the secret used to configure TLS | |
-| tlsHosts | String[] | The list of hosts to be included in the TLS certificate | The application host |
-
#### Jobs
| Property | Type | Description | Default Value |
diff --git a/tests/feat-ingress-class-name/pom.xml b/tests/feat-ingress-class-name/pom.xml
new file mode 100644
index 000000000..f6cfcc402
--- /dev/null
+++ b/tests/feat-ingress-class-name/pom.xml
@@ -0,0 +1,73 @@
+
+
+ 4.0.0
+
+
+ dekorate-tests
+ io.dekorate
+ 3.1-SNAPSHOT
+ ../
+
+
+ io.dekorate
+ feat-ingress-class-name
+ Dekorate :: Tests :: Annotations :: Kubernetes :: Ingress with class name
+
+
+
+ io.dekorate
+ kubernetes-annotations
+ ${project.version}
+
+
+ io.dekorate
+ dekorate-spring-boot
+ ${project.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+ ${version.spring-boot}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ ${version.spring-boot}
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ ${version.junit-jupiter}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${version.junit-jupiter}
+ test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ true
+
+ false
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${version.spring-boot}
+
+
+
+
diff --git a/tests/feat-ingress-class-name/src/main/java/io/dekorate/annotationless/DemoApplication.java b/tests/feat-ingress-class-name/src/main/java/io/dekorate/annotationless/DemoApplication.java
new file mode 100644
index 000000000..b1f732aad
--- /dev/null
+++ b/tests/feat-ingress-class-name/src/main/java/io/dekorate/annotationless/DemoApplication.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2018 The original 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
+ *
+ * http://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.
+ */
+package io.dekorate.annotationless;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class DemoApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(DemoApplication.class, args);
+ }
+}
diff --git a/tests/feat-ingress-class-name/src/main/resources/application.properties b/tests/feat-ingress-class-name/src/main/resources/application.properties
new file mode 100644
index 000000000..761ea820a
--- /dev/null
+++ b/tests/feat-ingress-class-name/src/main/resources/application.properties
@@ -0,0 +1,3 @@
+dekorate.kubernetes.ingress.expose=true
+dekorate.kubernetes.ports[0].container-port=8080
+dekorate.kubernetes.ingress.ingressClassName=nginx
diff --git a/tests/feat-ingress-class-name/src/test/java/io/dekorate/annotationless/FeatIngressClassNameTest.java b/tests/feat-ingress-class-name/src/test/java/io/dekorate/annotationless/FeatIngressClassNameTest.java
new file mode 100644
index 000000000..98d7ac2f6
--- /dev/null
+++ b/tests/feat-ingress-class-name/src/test/java/io/dekorate/annotationless/FeatIngressClassNameTest.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2018 The original 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
+ *
+ * http://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.
+ */
+
+package io.dekorate.annotationless;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import java.util.Optional;
+
+import org.junit.jupiter.api.Test;
+
+import io.dekorate.utils.Serialization;
+import io.fabric8.kubernetes.api.model.HasMetadata;
+import io.fabric8.kubernetes.api.model.KubernetesList;
+import io.fabric8.kubernetes.api.model.networking.v1.Ingress;
+
+public class FeatIngressClassNameTest {
+
+ @Test
+ public void shouldIngressHaveTlsConfiguration() {
+ KubernetesList list = Serialization
+ .unmarshalAsList(getClass().getClassLoader().getResourceAsStream("META-INF/dekorate/kubernetes.yml"));
+ assertNotNull(list);
+ Ingress i = findFirst(list, Ingress.class).orElseThrow(() -> new IllegalStateException());
+ assertNotNull(i);
+ assertEquals("nginx", i.getSpec().getIngressClassName());
+ }
+
+ Optional findFirst(KubernetesList list, Class t) {
+ return (Optional) list.getItems().stream()
+ .filter(i -> t.isInstance(i))
+ .findFirst();
+ }
+}
diff --git a/tests/pom.xml b/tests/pom.xml
index 2e7e29505..542bb39d1 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -87,6 +87,7 @@
issue-fetch-helm-dependencies
feat-1083-ingress-rules
issue-existing-route-resource
+ feat-ingress-class-name