diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/AddStatefulSetResourceDecorator.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/AddStatefulSetResourceDecorator.java index 39440562adcd7..e59581efcd0a4 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/AddStatefulSetResourceDecorator.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/AddStatefulSetResourceDecorator.java @@ -51,6 +51,8 @@ private void initStatefulSetResourceWithDefaults(StatefulSetBuilder builder) { .editOrNewTemplate() .editOrNewSpec() .endSpec() + .editOrNewMetadata() + .endMetadata() .endTemplate(); // defaults for: diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithStatefulSetResourceTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithStatefulSetResourceTest.java index 4784dc854d3ef..2e6f41bdb3f53 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithStatefulSetResourceTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithStatefulSetResourceTest.java @@ -57,6 +57,9 @@ public void assertGeneratedResources() throws IOException { assertThat(podSpec.getTerminationGracePeriodSeconds()).isEqualTo(10); assertThat(podSpec.getContainers()).allMatch(c -> APP_NAME.equals(c.getName())); }); + assertThat(t.getMetadata()).satisfies(metadata -> { + assertThat(metadata.getLabels()).containsEntry("app.kubernetes.io/name", APP_NAME); + }); }); assertThat(statefulSetSpec.getSelector()).satisfies(ls -> { assertThat(ls.getMatchLabels()).containsEntry("app.kubernetes.io/name", APP_NAME);