You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2025/08/11 05:06:25 UTC
(camel) branch main updated: CAMEL-22331 camel-jbang-plugin-kubernetes: wrong container probes port (#18857)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 2b3fa159fb3 CAMEL-22331 camel-jbang-plugin-kubernetes: wrong container probes port (#18857)
2b3fa159fb3 is described below
commit 2b3fa159fb3b099b65527d96376a3a01682db799
Author: Claudio Miranda <cl...@claudius.com.br>
AuthorDate: Mon Aug 11 06:06:20 2025 +0100
CAMEL-22331 camel-jbang-plugin-kubernetes: wrong container probes port (#18857)
https://issues.apache.org/jira/browse/CAMEL-22331
---
.../dsl/jbang/core/commands/kubernetes/KubernetesExport.java | 8 +++++---
.../dsl/jbang/core/commands/kubernetes/KubernetesExportTest.java | 1 +
.../dsl/jbang/core/commands/kubernetes/KubernetesRunTest.java | 5 +++++
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExport.java b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExport.java
index da5929c95ef..7310ab74668 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExport.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExport.java
@@ -504,11 +504,13 @@ public class KubernetesExport extends Export {
// the camel-observability-services artifact is set in the pom template
// it renames the container health base path to /observe, so this has to be in the container health probes http path
// only quarkus and sb runtimes, because there is no published health endpoints when using runtime=main
+ String probePort = port > 0 ? "" + port : "9876";
if (RuntimeType.quarkus == runtime) {
// jkube reads quarkus properties to set the container health probes path
+ buildProperties.add("jkube.enricher.jkube-healthcheck-quarkus.port=" + probePort);
buildProperties.add("quarkus.smallrye-health.root-path=/observe/health");
List<String> newProps = new ArrayList<>();
- newProps.add("quarkus.management.port=" + (port > 0 ? "" + port : "9876"));
+ newProps.add("quarkus.management.port=" + probePort);
if (applicationProperties == null) {
applicationProperties = newProps.toArray(new String[newProps.size()]);
} else {
@@ -520,7 +522,7 @@ public class KubernetesExport extends Export {
// jkube reads spring-boot properties to set the kubernetes container health probes path
// in this case, jkube reads from the application.properties and not from the build properties in pom.xml
newProps.add("management.endpoints.web.base-path=/observe");
- newProps.add("management.server.port=" + (port > 0 ? "" + port : "9876"));
+ newProps.add("management.server.port=" + probePort);
// jkube uses the old property to enable the readiness/liveness probes
// TODO: rename this property once https://github.com/eclipse-jkube/jkube/issues/3690 is fixed
newProps.add("management.health.probes.enabled=true");
@@ -532,7 +534,7 @@ public class KubernetesExport extends Export {
}
} else if (RuntimeType.main == runtime) {
List<String> newProps = new ArrayList<>();
- newProps.add("camel.management.port=" + (port > 0 ? "" + port : "9876"));
+ newProps.add("camel.management.port=" + probePort);
if (applicationProperties == null) {
applicationProperties = newProps.toArray(new String[newProps.size()]);
} else {
diff --git a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExportTest.java b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExportTest.java
index 3fef58e3da3..7730a93b0d2 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExportTest.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExportTest.java
@@ -75,6 +75,7 @@ class KubernetesExportTest extends KubernetesExportBaseTest {
if (RuntimeType.quarkus == RuntimeType.fromValue(rt.runtime())) {
Assertions.assertEquals("9876", props.get("quarkus.management.port"));
Assertions.assertEquals("9876", applicationProperties.get("quarkus.management.port"));
+ Assertions.assertEquals("9876", props.get("jkube.enricher.jkube-healthcheck-quarkus.port"));
Assertions.assertEquals("/observe/health", props.get("quarkus.smallrye-health.root-path"));
} else if (RuntimeType.springBoot == RuntimeType.fromValue(rt.runtime())) {
Assertions.assertEquals("9876", applicationProperties.get("management.server.port"));
diff --git a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRunTest.java b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRunTest.java
index 2b31948e106..97b8d1904e0 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRunTest.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRunTest.java
@@ -111,10 +111,15 @@ class KubernetesRunTest extends KubernetesBaseTest {
Assertions.assertEquals("/observe/health/live", containers.get(0).getLivenessProbe().getHttpGet().getPath());
Assertions.assertEquals("/observe/health/ready", containers.get(0).getReadinessProbe().getHttpGet().getPath());
Assertions.assertEquals("/observe/health/started", containers.get(0).getStartupProbe().getHttpGet().getPath());
+ Assertions.assertEquals(9876, containers.get(0).getReadinessProbe().getHttpGet().getPort().getIntVal());
+ Assertions.assertEquals(9876, containers.get(0).getLivenessProbe().getHttpGet().getPort().getIntVal());
+ Assertions.assertEquals(9876, containers.get(0).getStartupProbe().getHttpGet().getPort().getIntVal());
} else if (RuntimeType.springBoot == RuntimeType.fromValue(rt.runtime())) {
// spring-boot doesn't set the startup probe
Assertions.assertEquals("/observe/health/liveness", containers.get(0).getLivenessProbe().getHttpGet().getPath());
Assertions.assertEquals("/observe/health/readiness", containers.get(0).getReadinessProbe().getHttpGet().getPath());
+ Assertions.assertEquals(9876, containers.get(0).getReadinessProbe().getHttpGet().getPort().getIntVal());
+ Assertions.assertEquals(9876, containers.get(0).getLivenessProbe().getHttpGet().getPort().getIntVal());
}
}