diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 64067b99562da..cd1cd7d16a8ca 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -155,7 +155,7 @@ 1.8.1 0.27.0 1.7.1 - 4.1.3 + 4.1.4 3.2.0 4.2.1 3.0.6.Final diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftProcessor.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftProcessor.java index 129735aeb5e88..30585f805ab80 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftProcessor.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftProcessor.java @@ -263,6 +263,11 @@ public List createDecorators(ApplicationInfoBuildItem applic result.add(new DecoratorBuildItem(OPENSHIFT, new AddAnnotationDecorator(name, annotation.getKey(), annotation.getValue(), ROUTE))); } + + for (Map.Entry label : config.route.labels.entrySet()) { + result.add(new DecoratorBuildItem(OPENSHIFT, + new AddLabelDecorator(name, label.getKey(), label.getValue(), ROUTE))); + } } if (config.getReplicas() != 1) { diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/RouteConfig.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/RouteConfig.java index dd8b2f4de974f..1c257da7739e3 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/RouteConfig.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/RouteConfig.java @@ -36,6 +36,13 @@ public class RouteConfig { @ConfigDocMapKey("annotation-name") Map annotations; + /** + * Custom labels to add to exposition (route or ingress) resources + */ + @ConfigItem + @ConfigDocMapKey("label-name") + Map labels; + /** * The TLS configuration for the route. */ diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithCustomRouteResourceTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithCustomRouteResourceTest.java index 93e7595de9b74..a3571cebce636 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithCustomRouteResourceTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithCustomRouteResourceTest.java @@ -58,6 +58,7 @@ public void assertGeneratedResources() throws IOException { assertThat(m.getLabels()).contains(entry("foo", "bar")); assertThat(m.getAnnotations()).contains(entry("bar", "baz")); assertThat(m.getAnnotations()).contains(entry("kubernetes.io/tls-acme", "true")); + assertThat(m.getLabels()).contains(entry("test-label", "test-value")); }); assertThat(r.getSpec().getPort().getTargetPort().getStrVal()).isEqualTo("http"); assertThat(r.getSpec().getTo().getKind()).isEqualTo("Service"); diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/openshift-with-custom-route-resource.properties b/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/openshift-with-custom-route-resource.properties index 0bdb619c64a98..75d5a3a3968e7 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/openshift-with-custom-route-resource.properties +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/openshift-with-custom-route-resource.properties @@ -3,3 +3,4 @@ quarkus.openshift.labels.foo=bar quarkus.openshift.annotations.bar=baz quarkus.openshift.route.annotations."kubernetes.io/tls-acme"=true +quarkus.openshift.route.labels."test-label"=test-value