This is an automated email from the ASF dual-hosted git repository.
squakez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new a281e51cc feat(trait): health enabled by default
a281e51cc is described below
commit a281e51ccfd6504b5bb4000e54b39beb8cd20952
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Sat Jun 6 09:24:27 2026 +0200
feat(trait): health enabled by default
Closes #5024
---
docs/modules/ROOT/nav.adoc | 8 +-
.../ROOT/pages/observability/dashboard.adoc | 11 +-
.../observability/monitoring/integration.adoc | 85 --------
docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 19 +-
docs/modules/traits/pages/health.adoc | 19 +-
e2e/advanced/incremental_build_test.go | 92 +++++----
e2e/common/runtimes/runtimes_test.go | 33 ++-
e2e/common/traits/health_test.go | 19 +-
e2e/common/traits/jvm_jolokia_agent_test.go | 1 -
e2e/common/traits/prometheus_test.go | 11 +-
e2e/common/traits/service_test.go | 16 +-
e2e/telemetry/files/int-rest-consumer-addon.yaml | 39 ----
e2e/telemetry/telemetry_test.go | 7 +-
helm/camel-k/crds/camel-k-crds.yaml | 72 ++++---
pkg/apis/camel/v1/build_type_support_test.go | 2 +-
pkg/apis/camel/v1/pipe_types.go | 6 +-
pkg/apis/camel/v1/trait/health.go | 19 +-
pkg/apis/camel/v1/zz_generated.deepcopy.go | 5 +-
pkg/controller/catalog/initialize.go | 6 +
.../integration/monitor_synthetic_test.go | 42 ++++
pkg/controller/pipe/monitor.go | 8 +-
.../camel.apache.org_integrationplatforms.yaml | 18 +-
.../camel.apache.org_integrationprofiles.yaml | 18 +-
.../crd/bases/camel.apache.org_integrations.yaml | 18 +-
.../config/crd/bases/camel.apache.org_pipes.yaml | 18 +-
pkg/trait/container_probes_test.go | 12 +-
pkg/trait/health.go | 228 +++++++++++++--------
pkg/trait/health_test.go | 137 +++++++++----
pkg/trait/prometheus.go | 34 ++-
pkg/trait/prometheus_test.go | 2 +
pkg/trait/trait_test.go | 3 +-
pkg/trait/trait_types.go | 23 ---
32 files changed, 569 insertions(+), 462 deletions(-)
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index cbd7b145d..6e8a666f2 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -90,12 +90,10 @@
* Scaling
** xref:scaling/integration.adoc[Integrations]
** xref:scaling/pipe.adoc[Pipes]
-* Observability
-** xref:observability/dashboard.adoc[Camel Dashboard]
+* xref:observability/dashboard.adoc[Observability]
** xref:observability/operator-logging.adoc[Operator logging]
-** xref:observability/monitoring.adoc[Monitoring]
-*** xref:observability/monitoring/operator.adoc[Operator]
-*** xref:observability/monitoring/integration.adoc[Integration]
+** xref:observability/monitoring.adoc[Operator monitoring]
+*** xref:observability/monitoring/operator.adoc[Operator metrics]
*** xref:observability/monitoring/operator-sops.adoc[S.O.P.s]
* xref:troubleshooting/troubleshooting.adoc[Troubleshooting]
** xref:troubleshooting/debugging.adoc[Debugging]
diff --git a/docs/modules/ROOT/pages/observability/dashboard.adoc
b/docs/modules/ROOT/pages/observability/dashboard.adoc
index b5359f664..374e92527 100644
--- a/docs/modules/ROOT/pages/observability/dashboard.adoc
+++ b/docs/modules/ROOT/pages/observability/dashboard.adoc
@@ -10,7 +10,9 @@ From Camel K version 2.10.0 onward, the applications deployed
by the operator wi
On the Camel Monitor side, any application containing the label will be
watched and monitored providing a set of useful Camel metrics (for example,
health, number of exchanges succeeded, failed, ...).
-You will need to include the `camel-observability-services` component into
your application in order to get the full power of this monitoring tool. As an
example:
+NOTE: From version 2.11.0 onward the `camel-observability-services` component,
required to get the full power of this monitoring tool, is included by default.
+
+Take this example:
```yaml
apiVersion: camel.apache.org/v1
@@ -18,8 +20,6 @@ kind: Integration
metadata:
name: sample-it
spec:
- dependencies:
- - mvn:org.apache.camel.quarkus:camel-quarkus-observability-services
flows:
- route:
id: send-5-messages
@@ -29,11 +29,6 @@ spec:
- setBody:
simple: "Hello!"
- to: "log:myLogger"
- traits:
- # We need a provide any version supporting camel-observability-services
(introduced in Camel 4.9.0)
- camel:
- runtimeProvider: plain-quarkus
- runtimeVersion: 3.30.8
```
The information will be stored in a Custom Resource provided by the Camel
Monitor installation procedure: `CamelMonitor` (or abbreviated to `cmon`). Here
a basic example:
diff --git a/docs/modules/ROOT/pages/observability/monitoring/integration.adoc
b/docs/modules/ROOT/pages/observability/monitoring/integration.adoc
deleted file mode 100644
index e7c75e8ec..000000000
--- a/docs/modules/ROOT/pages/observability/monitoring/integration.adoc
+++ /dev/null
@@ -1,85 +0,0 @@
-[[integration-monitoring]]
-= Camel K Integration Monitoring
-
-WARNING: The Camel K Integration monitoring part is deprecated. Use instead
xref:observability/dashboard.adoc[Camel Dashboard] project to provide a deeper
level of monitoring to your Camel applications.
-
-[[instrumentation]]
-== Instrumentation
-
-The xref:traits:prometheus.adoc[Prometheus trait] automates the configuration
of integration pods to expose a _metrics_ endpoint, that can be discovered and
scraped by a Prometheus server.
-
-The Prometheus trait can be enabled when running an integration, e.g.:
-
-[source,console]
-----
-$ kamel run -t prometheus.enabled=true
-----
-
-Alternatively, the Prometheus trait can be enabled globally once, by updating
the IntegrationProfile.
-
-The Camel Quarkus Micrometer Metrics extension is responsible for collecting
and exposing metrics in the
https://github.com/OpenObservability/OpenMetrics[OpenMetrics] text format.
-
-The Micrometer Metrics extension registers and exposes the following metrics
out-of-the-box:
-
-* Basic JVM and operating system related metrics
-* xref:components::micrometer-component.adoc[Camel related metrics]
-
-
-It is possible to extend this set of metrics by using either, or both:
-
-* The Micrometer Metrics component
-
-* The
https://quarkus.io/guides/micrometer#does-micrometer-support-annotations[Micrometer
Quarkus Metrics annotations]
-
-== Discovery
-
-The Prometheus trait automatically configures the resources necessary for the
Prometheus Operator to reconcile, so that the managed Prometheus instance can
scrape the integration _metrics_ endpoint.
-
-By default, the Prometheus trait creates a `PodMonitor` resource, with the
`camel.apache.org/integration` label, which must match the `podMonitorSelector`
field from the `Prometheus` resource.
-Additional labels can be specified with the `pod-monitor-labels` parameter
from the Prometheus trait, e.g.:
-
-[source,console]
-----
-$ kamel run -t
prometheus.pod-monitor-labels="label_to_be_match_by=prometheus_selector" ...
-----
-
-The creation of the `PodMonitor` resource can be disabled using the
`pod-monitor` parameter, e.g.:
-
-[source,console]
-----
-$ kamel run -t prometheus.pod-monitor=false ...
-----
-
-More information can be found in the xref:traits:prometheus.adoc[Prometheus
trait] documentation.
-
-The Prometheus Operator
https://prometheus-operator.dev/docs/user-guides/getting-started/[getting
started] guide documents the discovery mechanism, as well as the relationship
between the operator resources.
-
-In case your integration metrics are not discovered, you may want to rely on
https://prometheus-operator.dev/docs/operator/troubleshooting/#troubleshooting-servicemonitor-changes[Troubleshooting
`ServiceMonitor` changes], which also applies to `PodMonitor` resources
troubleshooting.
-
-== Alerting
-
-The Prometheus Operator declares the `AlertManager` resource that can be used
to configure _AlertManager_ instances, along with `Prometheus` instances.
-
-Assuming an `AlertManager` resource already exists in your cluster, you can
register a `PrometheusRule` resource that is used by Prometheus to trigger
alerts, e.g.:
-
-[source,console]
-----
-$ cat <<EOF | kubectl apply -f -
-apiVersion: monitoring.coreos.com/v1
-kind: PrometheusRule
-metadata:
- labels:
- prometheus: example
- role: alert-rules
- name: prometheus-rules
-spec:
- groups:
- - name: camel-k.rules
- rules:
- - alert: CamelKAlert
- expr: application_camel_context_exchanges_failed_total > 0
-EOF
-----
-
-More information can be found in the Prometheus Operator
https://prometheus-operator.dev/docs/user-guides/alerting/[Alerting] user guide.
-You can also find more details in
https://docs.openshift.com/container-platform/4.12/monitoring/managing-alerts.html#creating-alerting-rules-for-user-defined-projects_managing-alerts[Creating
alerting rules] from the OpenShift documentation.
diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index 64b41593e..e37f02894 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -7524,9 +7524,16 @@ The email used to commit the GitOps changes (default
`[email protected]
* <<#_camel_apache_org_v1_Traits, Traits>>
-The health trait is responsible for configuring the health probes on the
integration container.
+The health trait is responsible for configuring the container probes on the
Integration container.
-NOTE: this trait is disabled by default.
+NOTE: this trait is enabled by default in `plain-quarkus` runtime, leveraging
the `camel-observability-services` component.
+You can disable turning it off.
+
+The trait uses Camel health component in order to provide a readiness probe.
You can also configure liveness and startup
+probes which are disabled by default. The default values (delay, timeout,
etc...),
+whereas not specified are the default ones provided by Kubernetes.
+
+You can also configure manually the trait parameters in order to provide a
customized probes configuration.
[cols="2,2a",options="header"]
@@ -7595,7 +7602,7 @@ string
|
-The liveness probe path to use (default provided by the Catalog runtime used).
+The liveness probe path to use (default provided by the dependency used).
|`livenessPort` +
int32
@@ -7658,7 +7665,7 @@ string
|
-The readiness probe path to use (default provided by the Catalog runtime used).
+The readiness probe path to use (default provided by the dependency used).
|`readinessPort` +
int32
@@ -7714,14 +7721,14 @@ int32
|
-Minimum consecutive failures for the startup probe to be considered failed
after having succeeded.
+Minimum consecutive failures for the startup probe to be considered failed
after having succeeded (default 6 if not specified).
|`startupProbe` +
string
|
-The startup probe path to use (default provided by the Catalog runtime used).
+The startup probe path to use (default provided by the dependency used).
|`startupPort` +
int32
diff --git a/docs/modules/traits/pages/health.adoc
b/docs/modules/traits/pages/health.adoc
index ff5558b09..5756baddc 100755
--- a/docs/modules/traits/pages/health.adoc
+++ b/docs/modules/traits/pages/health.adoc
@@ -3,9 +3,16 @@
// Start of autogenerated code - DO NOT EDIT! (badges)
// End of autogenerated code - DO NOT EDIT! (badges)
// Start of autogenerated code - DO NOT EDIT! (description)
-The health trait is responsible for configuring the health probes on the
integration container.
+The health trait is responsible for configuring the container probes on the
Integration container.
-NOTE: this trait is disabled by default.
+NOTE: this trait is enabled by default in `plain-quarkus` runtime, leveraging
the `camel-observability-services` component.
+You can disable turning it off.
+
+The trait uses Camel health component in order to provide a readiness probe.
You can also configure liveness and startup
+probes which are disabled by default. The default values (delay, timeout,
etc...),
+whereas not specified are the default ones provided by Kubernetes.
+
+You can also configure manually the trait parameters in order to provide a
customized probes configuration.
This trait is available in the following profiles: **Kubernetes, Knative,
OpenShift**.
@@ -59,7 +66,7 @@ The following configuration options are available:
| health.livenessProbe
| string
-| The liveness probe path to use (default provided by the Catalog runtime
used).
+| The liveness probe path to use (default provided by the dependency used).
| health.livenessPort
| int32
@@ -95,7 +102,7 @@ The following configuration options are available:
| health.readinessProbe
| string
-| The readiness probe path to use (default provided by the Catalog runtime
used).
+| The readiness probe path to use (default provided by the dependency used).
| health.readinessPort
| int32
@@ -127,11 +134,11 @@ The following configuration options are available:
| health.startupFailureThreshold
| int32
-| Minimum consecutive failures for the startup probe to be considered failed
after having succeeded.
+| Minimum consecutive failures for the startup probe to be considered failed
after having succeeded (default 6 if not specified).
| health.startupProbe
| string
-| The startup probe path to use (default provided by the Catalog runtime used).
+| The startup probe path to use (default provided by the dependency used).
| health.startupPort
| int32
diff --git a/e2e/advanced/incremental_build_test.go
b/e2e/advanced/incremental_build_test.go
index db117a029..bdb6cf089 100644
--- a/e2e/advanced/incremental_build_test.go
+++ b/e2e/advanced/incremental_build_test.go
@@ -44,9 +44,10 @@ func TestRunIncrementalBuildRoutine(t *testing.T) {
name := RandomizedSuffixName("java")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name",
name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns, name,
v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns, name),
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name,
v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
name)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
name)).Should(ContainSubstring("Magicstring!"))
integrationKitName := IntegrationKitName(t, ctx, ns, name)()
g.Eventually(Kit(t, ctx, ns,
integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
g.Eventually(Kit(t, ctx, ns,
integrationKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
@@ -54,9 +55,10 @@ func TestRunIncrementalBuildRoutine(t *testing.T) {
t.Run("Reuse previous kit", func(t *testing.T) {
nameClone := "java-clone"
g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
"--name", nameClone).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameClone), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameClone, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns, nameClone),
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameClone, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameClone)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
nameClone)).Should(ContainSubstring("Magicstring!"))
integrationCloneKitName := IntegrationKitName(t, ctx,
ns, nameClone)()
g.Eventually(integrationCloneKitName).Should(Equal(integrationKitName))
})
@@ -66,9 +68,10 @@ func TestRunIncrementalBuildRoutine(t *testing.T) {
// just add a new random dependency
nameIncremental :=
RandomizedSuffixName("java-incremental")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
"--name", nameIncremental, "-d", "camel:zipfile").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameIncremental, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns,
nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameIncremental, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameIncremental)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
nameIncremental)).Should(ContainSubstring("Magicstring!"))
integrationIncrementalKitName := IntegrationKitName(t,
ctx, ns, nameIncremental)()
// the container comes in a format like
//
10.108.177.66/test-d7cad110-bb1d-4e79-8a0e-ebd44f6fe5d4/camel-k-kit-c8357r4k5tp6fn1idm60@sha256:d49716f0429ad8b23a1b8d20a357d64b1aa42a67c1a2a534ebd4c54cd598a18d
@@ -87,9 +90,10 @@ func TestRunIncrementalBuildPod(t *testing.T) {
name := RandomizedSuffixName("java")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name",
name, "-t", "builder.strategy=pod").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns, name,
v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns, name),
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name,
v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
name)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
name)).Should(ContainSubstring("Magicstring!"))
integrationKitName := IntegrationKitName(t, ctx, ns, name)()
g.Eventually(Kit(t, ctx, ns,
integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
g.Eventually(Kit(t, ctx, ns,
integrationKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
@@ -98,9 +102,10 @@ func TestRunIncrementalBuildPod(t *testing.T) {
t.Run("Reuse previous kit", func(t *testing.T) {
nameClone := RandomizedSuffixName("java-clone")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
"--name", nameClone, "-t", "builder.strategy=pod").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameClone), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameClone, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns, nameClone),
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameClone, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameClone)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
nameClone)).Should(ContainSubstring("Magicstring!"))
integrationCloneKitName := IntegrationKitName(t, ctx,
ns, nameClone)()
g.Eventually(integrationCloneKitName).Should(Equal(integrationKitName))
g.Eventually(BuilderPodsCount(t, ctx,
ns)).Should(Equal(1))
@@ -110,10 +115,12 @@ func TestRunIncrementalBuildPod(t *testing.T) {
// Another integration that should be built on top of
the previous IntegrationKit
// just add a new random dependency
nameIncremental :=
RandomizedSuffixName("java-incremental")
- g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
"--name", nameIncremental, "-d", "camel:zipfile", "-t",
"builder.strategy=pod").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameIncremental, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns,
nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
"--name", nameIncremental,
+ "-d", "camel:zipfile", "-t",
"builder.strategy=pod").Execute()).To(Succeed())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameIncremental, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameIncremental)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
nameIncremental)).Should(ContainSubstring("Magicstring!"))
integrationIncrementalKitName := IntegrationKitName(t,
ctx, ns, nameIncremental)()
// the container comes in a format like
//
10.108.177.66/test-d7cad110-bb1d-4e79-8a0e-ebd44f6fe5d4/camel-k-kit-c8357r4k5tp6fn1idm60@sha256:d49716f0429ad8b23a1b8d20a357d64b1aa42a67c1a2a534ebd4c54cd598a18d
@@ -133,18 +140,20 @@ func TestRunIncrementalBuildOff(t *testing.T) {
name := RandomizedSuffixName("java")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name",
name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns, name,
v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns, name),
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name,
v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
name)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
name)).Should(ContainSubstring("Magicstring!"))
integrationKitName := IntegrationKitName(t, ctx, ns, name)()
g.Eventually(Kit(t, ctx, ns,
integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
t.Run("Don't reuse previous kit", func(t *testing.T) {
nameClone := RandomizedSuffixName("java-clone")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
"--name", nameClone, "-t",
"builder.incremental-image-build=false").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameClone), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameClone, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns, nameClone),
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameClone, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameClone)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
nameClone)).Should(ContainSubstring("Magicstring!"))
integrationCloneKitName := IntegrationKitName(t, ctx,
ns, nameClone)()
g.Eventually(Kit(t, ctx, ns,
integrationCloneKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
})
@@ -154,9 +163,10 @@ func TestRunIncrementalBuildOff(t *testing.T) {
// just add a new random dependency
nameIncremental :=
RandomizedSuffixName("java-incremental")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
"--name", nameIncremental, "-d", "camel:zipfile", "-t",
"builder.incremental-image-build=false").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameIncremental, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns,
nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameIncremental, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameIncremental)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
nameIncremental)).Should(ContainSubstring("Magicstring!"))
integrationIncrementalKitName := IntegrationKitName(t,
ctx, ns, nameIncremental)()
g.Eventually(Kit(t, ctx, ns,
integrationIncrementalKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
})
@@ -171,9 +181,10 @@ func TestRunIncrementalBuildWithDifferentBaseImages(t
*testing.T) {
name := RandomizedSuffixName("java")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "--name",
name).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns, name,
v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns, name),
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, name,
v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
name)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
name)).Should(ContainSubstring("Magicstring!"))
integrationKitName := IntegrationKitName(t, ctx, ns, name)()
g.Eventually(Kit(t, ctx, ns,
integrationKitName)().Status.BaseImage).Should(Equal(defaults.BaseImage()))
g.Eventually(Kit(t, ctx, ns,
integrationKitName)().Status.RootImage).Should(Equal(defaults.BaseImage()))
@@ -183,9 +194,10 @@ func TestRunIncrementalBuildWithDifferentBaseImages(t
*testing.T) {
// just add a new random dependency
nameIncremental :=
RandomizedSuffixName("java-incremental")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
"--name", nameIncremental, "-d", "camel:zipfile").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameIncremental), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameIncremental, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns,
nameIncremental), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
nameIncremental, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
nameIncremental)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
nameIncremental)).Should(ContainSubstring("Magicstring!"))
integrationIncrementalKitName := IntegrationKitName(t,
ctx, ns, nameIncremental)()
// the container comes in a format like
//
10.108.177.66/test-d7cad110-bb1d-4e79-8a0e-ebd44f6fe5d4/camel-k-kit-c8357r4k5tp6fn1idm60@sha256:d49716f0429ad8b23a1b8d20a357d64b1aa42a67c1a2a534ebd4c54cd598a18d
@@ -198,10 +210,14 @@ func TestRunIncrementalBuildWithDifferentBaseImages(t
*testing.T) {
// We should spin off a new hierarchy of builds
newBaseImage :=
"eclipse-temurin:17.0.8.1_1-jdk-ubi9-minimal"
name = RandomizedSuffixName("java-new")
- g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
"--name", name, "-d", "camel:mongodb", "-t",
fmt.Sprintf("builder.base-image=%s", newBaseImage)).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationLogs(t, ctx, ns, name),
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
+ "--name", name, "-d", "camel:zipfile",
+ "-t", fmt.Sprintf("builder.base-image=%s",
newBaseImage),
+ ).Execute()).To(Succeed())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationPodPhase(t, ctx, ns,
name)).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationLogs(t, ctx, ns,
name)).Should(ContainSubstring("Magicstring!"))
integrationKitName = IntegrationKitName(t, ctx, ns,
name)()
g.Eventually(Kit(t, ctx, ns,
integrationKitName)().Status.BaseImage).Should(Equal(newBaseImage))
g.Eventually(Kit(t, ctx, ns,
integrationKitName)().Status.RootImage).Should(Equal(newBaseImage))
diff --git a/e2e/common/runtimes/runtimes_test.go
b/e2e/common/runtimes/runtimes_test.go
index bc61d34f5..5705308fe 100644
--- a/e2e/common/runtimes/runtimes_test.go
+++ b/e2e/common/runtimes/runtimes_test.go
@@ -49,30 +49,45 @@ func TestSelfManagedBuildIntegrations(t *testing.T) {
t.Run("Camel Main", func(t *testing.T) {
itName := "my-camel-main-v1"
- g.Expect(KamelRun(t, ctx, ns, "--image",
"docker.io/squakez/my-camel-main:1.0.0", "--resource",
"configmap:my-cm-sourceless@/tmp/app/data").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns,
+ "--image",
"docker.io/squakez/my-camel-main:1.0.0",
+ "--resource",
"configmap:my-cm-sourceless@/tmp/app/data",
+ ).Execute()).To(Succeed())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
itName, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationCondition(t, ctx, ns, itName,
v1.IntegrationConditionType("JVMTraitInfo"))().Message).
+ Should(ContainSubstring("explicitly disabled by
the platform"))
g.Eventually(IntegrationPodPhase(t, ctx, ns, itName),
TestTimeoutShort).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
itName, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationCondition(t, ctx, ns, itName,
v1.IntegrationConditionType("JVMTraitInfo"))().Message).Should(ContainSubstring("explicitly
disabled by the platform"))
g.Eventually(IntegrationLogs(t, ctx, ns, itName),
TestTimeoutShort).Should(ContainSubstring(cmData["my-file.txt"]))
g.Eventually(IntegrationLogs(t, ctx, ns, itName),
TestTimeoutShort).Should(ContainSubstring("Apache Camel (Main)"))
})
t.Run("Camel Spring Boot", func(t *testing.T) {
itName := "my-camel-sb-v1"
- g.Expect(KamelRun(t, ctx, ns, "--image",
"docker.io/squakez/my-camel-sb:1.0.0", "--resource",
"configmap:my-cm-sourceless@/tmp/app/data").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns,
+ "--image",
"docker.io/squakez/my-camel-sb:1.0.0",
+ "--resource",
"configmap:my-cm-sourceless@/tmp/app/data",
+ ).Execute()).To(Succeed())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
itName, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationCondition(t, ctx, ns, itName,
v1.IntegrationConditionType("JVMTraitInfo"))().Message).
+ Should(ContainSubstring("explicitly disabled by
the platform"))
g.Eventually(IntegrationPodPhase(t, ctx, ns, itName),
TestTimeoutShort).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
itName, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationCondition(t, ctx, ns, itName,
v1.IntegrationConditionType("JVMTraitInfo"))().Message).Should(ContainSubstring("explicitly
disabled by the platform"))
g.Eventually(IntegrationLogs(t, ctx, ns, itName),
TestTimeoutShort).Should(ContainSubstring(cmData["my-file.txt"]))
g.Eventually(IntegrationLogs(t, ctx, ns, itName),
TestTimeoutShort).Should(ContainSubstring("Spring Boot"))
})
t.Run("Camel Quarkus", func(t *testing.T) {
itName := "my-camel-quarkus-v1"
- g.Expect(KamelRun(t, ctx, ns, "--image",
"docker.io/squakez/my-camel-quarkus:1.0.0", "--resource",
"configmap:my-cm-sourceless@/tmp/app/data").Execute()).To(Succeed())
+ g.Expect(KamelRun(t, ctx, ns,
+ "--image",
"docker.io/squakez/my-camel-quarkus:1.0.0",
+ "--resource",
"configmap:my-cm-sourceless@/tmp/app/data",
+ ).Execute()).To(Succeed())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
itName, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ g.Eventually(IntegrationCondition(t, ctx, ns, itName,
v1.IntegrationConditionType("JVMTraitInfo"))().Message).
+ Should(ContainSubstring("explicitly disabled by
the platform"))
g.Eventually(IntegrationPodPhase(t, ctx, ns, itName),
TestTimeoutShort).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns,
itName, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- g.Eventually(IntegrationCondition(t, ctx, ns, itName,
v1.IntegrationConditionType("JVMTraitInfo"))().Message).Should(ContainSubstring("explicitly
disabled by the platform"))
g.Eventually(IntegrationLogs(t, ctx, ns, itName),
TestTimeoutShort).Should(ContainSubstring(cmData["my-file.txt"]))
g.Eventually(IntegrationLogs(t, ctx, ns, itName),
TestTimeoutShort).Should(ContainSubstring("powered by Quarkus"))
})
diff --git a/e2e/common/traits/health_test.go b/e2e/common/traits/health_test.go
index 7dcdb3eb9..784352b33 100644
--- a/e2e/common/traits/health_test.go
+++ b/e2e/common/traits/health_test.go
@@ -47,10 +47,8 @@ func TestHealthTrait(t *testing.T) {
t.Run("Readiness condition with stopped route scaled", func(t
*testing.T) {
name := RandomizedSuffixName("java")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
- "-t", "health.enabled=true",
"-t",
"jvm.agents=jolokia;https://repo1.maven.org/maven2/org/jolokia/jolokia-agent-jvm/2.3.0/jolokia-agent-jvm-2.3.0-javaagent.jar;host=*",
"-t", "container.ports=jolokia;8778",
- "-d", "camel:management",
"--name", name).Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
@@ -145,10 +143,8 @@ func TestHealthTrait(t *testing.T) {
t.Run("Readiness condition with stopped route", func(t
*testing.T) {
name := RandomizedSuffixName("java")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
- "-t", "health.enabled=true",
"-t",
"jvm.agents=jolokia;https://repo1.maven.org/maven2/org/jolokia/jolokia-agent-jvm/2.3.0/jolokia-agent-jvm-2.3.0-javaagent.jar;host=*",
"-t", "container.ports=jolokia;8778",
- "-d", "camel:management",
"--name", name).Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
@@ -243,10 +239,8 @@ func TestHealthTrait(t *testing.T) {
g.Expect(KamelBind(t, ctx, ns, source, sink,
"-p", "source.message=Magicstring!",
"-p", "sink.loggerName=binding",
- "-t", "health.enabled=true",
"-t",
"jvm.agents=jolokia;https://repo1.maven.org/maven2/org/jolokia/jolokia-agent-jvm/2.3.0/jolokia-agent-jvm-2.3.0-javaagent.jar;host=*",
"-t", "container.ports=jolokia;8778",
- "-d", "camel:management",
"--name", name).Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
@@ -321,15 +315,15 @@ func TestHealthTrait(t *testing.T) {
if c.Status != corev1.ConditionFalse {
return false
}
- if len(c.Pods) != 1 {
+ if len(c.DeprecatedPods) != 1 {
return false
}
var r *v1.HealthCheckResponse
- for h := range c.Pods[0].Health {
- if c.Pods[0].Health[h].Name ==
"camel-routes" {
- r = &c.Pods[0].Health[h]
+ for h := range
c.DeprecatedPods[0].Health {
+ if
c.DeprecatedPods[0].Health[h].Name == "camel-routes" {
+ r =
&c.DeprecatedPods[0].Health[h]
}
}
@@ -354,7 +348,6 @@ func TestHealthTrait(t *testing.T) {
name := RandomizedSuffixName("never-ready")
g.Expect(KamelRun(t, ctx, ns, "files/NeverReady.java",
"--name", name,
- "-t", "health.enabled=true",
"-p", "camel.health.routesEnabled=false",
).Execute()).To(Succeed())
@@ -407,9 +400,7 @@ func TestHealthTrait(t *testing.T) {
name :=
RandomizedSuffixName("startup-probe-never-ready-route")
g.Expect(KamelRun(t, ctx, ns, "files/NeverReady.java",
"--name", name,
- "-t", "health.enabled=true",
"-t", "health.startup-probe-enabled=true",
- "-t", "health.startup-timeout=60",
).Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
@@ -459,9 +450,7 @@ func TestHealthTrait(t *testing.T) {
name :=
RandomizedSuffixName("startup-probe-ready-route")
g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
"--name", name,
- "-t", "health.enabled=true",
"-t", "health.startup-probe-enabled=true",
- "-t", "health.startup-timeout=60",
).Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
diff --git a/e2e/common/traits/jvm_jolokia_agent_test.go
b/e2e/common/traits/jvm_jolokia_agent_test.go
index 88faaa626..801ecc78d 100644
--- a/e2e/common/traits/jvm_jolokia_agent_test.go
+++ b/e2e/common/traits/jvm_jolokia_agent_test.go
@@ -44,7 +44,6 @@ func TestJvmAgentJolokiaTrait(t *testing.T) {
g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
"--name", name,
"-t",
"jvm.agents=jolokia;https://repo1.maven.org/maven2/org/jolokia/jolokia-agent-jvm/2.3.0/jolokia-agent-jvm-2.3.0-javaagent.jar;host=*",
"-t", "container.ports=jolokia;8778",
- "-d", "camel:management",
).Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, name),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
diff --git a/e2e/common/traits/prometheus_test.go
b/e2e/common/traits/prometheus_test.go
index 939ee136e..185ab4c4e 100644
--- a/e2e/common/traits/prometheus_test.go
+++ b/e2e/common/traits/prometheus_test.go
@@ -51,16 +51,19 @@ func TestPrometheusTrait(t *testing.T) {
require.NoError(t, err)
// Do not create PodMonitor for the time being as CI test runs
on OCP 3.11
createPodMonitor := false
- g.Expect(KamelRun(t, ctx, ns, "files/Java.java", "-t",
"prometheus.enabled=true", "-t", fmt.Sprintf("prometheus.pod-monitor=%v",
createPodMonitor)).Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns, "java"),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
- g.Eventually(IntegrationConditionStatus(t, ctx, ns, "java",
v1.IntegrationConditionReady),
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
+ "-t", "prometheus.enabled=true",
+ "-t", fmt.Sprintf("prometheus.pod-monitor=%v",
createPodMonitor),
+ ).Execute()).To(Succeed())
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns, "java",
v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
g.Eventually(IntegrationLogs(t, ctx, ns, "java"),
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
t.Run("Metrics endpoint works", func(t *testing.T) {
pod := IntegrationPod(t, ctx, ns, "java")
response, err :=
TestClient(t).CoreV1().RESTClient().Get().
Timeout(30 * time.Second).
-
AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/q/metrics", ns,
pod().Name)).DoRaw(ctx)
+
AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/observe/metrics", ns,
pod().Name)).DoRaw(ctx)
if err != nil {
assert.Fail(t, err.Error())
}
diff --git a/e2e/common/traits/service_test.go
b/e2e/common/traits/service_test.go
index 386172fcf..fd16152cd 100644
--- a/e2e/common/traits/service_test.go
+++ b/e2e/common/traits/service_test.go
@@ -39,10 +39,12 @@ import (
func TestServiceTrait(t *testing.T) {
t.Parallel()
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
+ name := "platform-http-server"
t.Run("NodePort service", func(t *testing.T) {
g.Expect(KamelRun(t, ctx, ns,
"files/PlatformHttpServer.java", "-t", "service.enabled=true",
"-t",
"service.node-port=true").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
"platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady), TestTimeoutMedium).
+ Should(Equal(corev1.ConditionTrue))
//
// Service names can vary with the ExternalName Service
@@ -54,7 +56,8 @@ func TestServiceTrait(t *testing.T) {
t.Run("Default service (ClusterIP)", func(t *testing.T) {
// Service trait is enabled by default
g.Expect(KamelRun(t, ctx, ns,
"files/PlatformHttpServer.java").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
"platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady)).
+ Should(Equal(corev1.ConditionTrue))
//
// Service names can vary with the ExternalName Service
@@ -66,7 +69,8 @@ func TestServiceTrait(t *testing.T) {
t.Run("NodePort service from Type", func(t *testing.T) {
g.Expect(KamelRun(t, ctx, ns,
"files/PlatformHttpServer.java", "-t", "service.enabled=true",
"-t",
"service.type=NodePort").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
"platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady)).
+ Should(Equal(corev1.ConditionTrue))
//
// Service names can vary with the ExternalName Service
@@ -78,7 +82,8 @@ func TestServiceTrait(t *testing.T) {
t.Run("ClusterIP service from Type", func(t *testing.T) {
g.Expect(KamelRun(t, ctx, ns,
"files/PlatformHttpServer.java",
"-t", "service.enabled=true", "-t",
"service.type=ClusterIP").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
"platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady)).
+ Should(Equal(corev1.ConditionTrue))
//
// Service names can vary with the ExternalName Service
@@ -90,7 +95,8 @@ func TestServiceTrait(t *testing.T) {
t.Run("LoadBalancer service from Type", func(t *testing.T) {
g.Expect(KamelRun(t, ctx, ns,
"files/PlatformHttpServer.java", "-t", "service.enabled=true",
"-t",
"service.type=LoadBalancer").Execute()).To(Succeed())
- g.Eventually(IntegrationPodPhase(t, ctx, ns,
"platform-http-server"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ g.Eventually(IntegrationConditionStatus(t, ctx, ns,
name, v1.IntegrationConditionReady)).
+ Should(Equal(corev1.ConditionTrue))
//
// Service names can vary with the ExternalName Service
diff --git a/e2e/telemetry/files/int-rest-consumer-addon.yaml
b/e2e/telemetry/files/int-rest-consumer-addon.yaml
deleted file mode 100644
index 6d3d07bba..000000000
--- a/e2e/telemetry/files/int-rest-consumer-addon.yaml
+++ /dev/null
@@ -1,39 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-# ---------------------------------------------------------------------------
-
-kind: Integration
-apiVersion: camel.apache.org/v1
-metadata:
- name: rest-consumer-addon
-spec:
- flows:
- - rest:
- get:
- - path: /customers/{name}
- to: direct:start
- - from:
- steps:
- - log:
- message: get ${header.name}
- - setBody:
- simple: ${header.name} Doe
- uri: direct:start
- traits:
- addons:
- telemetry:
- enabled: true
- endpoint: http://opentelemetrycollector.otlp:4317
\ No newline at end of file
diff --git a/e2e/telemetry/telemetry_test.go b/e2e/telemetry/telemetry_test.go
index 0695b304c..2ae174dac 100644
--- a/e2e/telemetry/telemetry_test.go
+++ b/e2e/telemetry/telemetry_test.go
@@ -42,8 +42,11 @@ func TestTelemetryTrait(t *testing.T) {
// Create integration and activate traces using OpenTelemetry
properties and dependency
g.Expect(KamelRun(t, ctx, ns,
"files/rest-consumer.yaml", "--name", "rest-consumer",
- "--dependency", "camel:opentelemetry",
- "-p",
"quarkus.otel.exporter.otlp.traces.endpoint=http://opentelemetrycollector.otlp:4317").Execute()).To(Succeed())
+ // we must enable the collector endpoint and enable the
collection explicitly
+ // as required by camel-observability-services quarkus
extension
+ "-p",
"quarkus.otel.exporter.otlp.traces.endpoint=http://opentelemetrycollector.otlp:4317",
+ "-p", "quarkus.otel.sdk.disabled=false",
+ ).Execute()).To(Succeed())
g.Eventually(IntegrationPodPhase(t, ctx, ns, "rest-consumer"),
TestTimeoutLong).Should(Equal(corev1.PodRunning))
name := "Bob"
diff --git a/helm/camel-k/crds/camel-k-crds.yaml
b/helm/camel-k/crds/camel-k-crds.yaml
index 82c0661ab..6b75eb24e 100644
--- a/helm/camel-k/crds/camel-k-crds.yaml
+++ b/helm/camel-k/crds/camel-k-crds.yaml
@@ -4526,7 +4526,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -4566,7 +4566,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -4588,7 +4588,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -4606,7 +4607,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
@@ -7056,7 +7057,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -7096,7 +7097,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -7118,7 +7119,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -7136,7 +7138,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
@@ -9480,7 +9482,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -9520,7 +9522,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -9542,7 +9544,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -9560,7 +9563,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
@@ -11890,7 +11893,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -11930,7 +11933,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -11952,7 +11955,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -11970,7 +11974,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
@@ -21156,7 +21160,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -21196,7 +21200,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -21218,7 +21222,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -21236,7 +21241,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
@@ -23527,7 +23532,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -23567,7 +23572,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -23589,7 +23594,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -23607,7 +23613,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
@@ -34156,7 +34162,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use
(default provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -34196,7 +34202,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use
(default
- provided by the Catalog runtime used).
+ provided by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for
the integration
@@ -34218,7 +34224,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having
succeeded.
+ probe to be considered failed after having
succeeded
+ (default 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -34236,7 +34243,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use
(default provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
@@ -36449,7 +36456,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -36489,7 +36496,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -36511,7 +36518,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -36529,7 +36537,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
diff --git a/pkg/apis/camel/v1/build_type_support_test.go
b/pkg/apis/camel/v1/build_type_support_test.go
index 01aefdb15..38369c7a1 100644
--- a/pkg/apis/camel/v1/build_type_support_test.go
+++ b/pkg/apis/camel/v1/build_type_support_test.go
@@ -107,7 +107,7 @@ func TestMatchingBuildsPending(t *testing.T) {
{
Builder: &BuilderTask{
Dependencies: []string{
- "camel:mongodb",
+ "camel:zipfile",
"camel:component-a",
"camel:component-b",
},
diff --git a/pkg/apis/camel/v1/pipe_types.go b/pkg/apis/camel/v1/pipe_types.go
index c5ee49567..9a4f4a7e4 100644
--- a/pkg/apis/camel/v1/pipe_types.go
+++ b/pkg/apis/camel/v1/pipe_types.go
@@ -126,8 +126,10 @@ type PipeCondition struct {
Reason string `json:"reason,omitempty"`
// A human readable message indicating details about the transition.
Message string `json:"message,omitempty"`
- // Pods collect health and conditions information from the owned PODs
- Pods []PodCondition `json:"pods,omitempty"`
+ // DeprecatedPods collect health and conditions information from the
owned PODs
+ //
+ // Deprecated: may be removed in future releases.
+ DeprecatedPods []PodCondition `json:"pods,omitempty"`
}
// PipeConditionType --.
diff --git a/pkg/apis/camel/v1/trait/health.go
b/pkg/apis/camel/v1/trait/health.go
index b4fe57ee5..5e95d2fdd 100644
--- a/pkg/apis/camel/v1/trait/health.go
+++ b/pkg/apis/camel/v1/trait/health.go
@@ -17,9 +17,16 @@ limitations under the License.
package trait
-// The health trait is responsible for configuring the health probes on the
integration container.
+// The health trait is responsible for configuring the container probes on the
Integration container.
//
-// NOTE: this trait is disabled by default.
+// NOTE: this trait is enabled by default in `plain-quarkus` runtime,
leveraging the `camel-observability-services` component.
+// You can disable turning it off.
+//
+// The trait uses Camel health component in order to provide a readiness
probe. You can also configure liveness and startup
+// probes which are disabled by default. The default values (delay, timeout,
etc...),
+// whereas not specified are the default ones provided by Kubernetes.
+//
+// You can also configure manually the trait parameters in order to provide a
customized probes configuration.
//
// +camel-k:trait=health.
//
@@ -41,7 +48,7 @@ type HealthTrait struct {
LivenessSuccessThreshold int32
`json:"livenessSuccessThreshold,omitempty"
property:"liveness-success-threshold"`
// Minimum consecutive failures for the liveness probe to be considered
failed after having succeeded.
LivenessFailureThreshold int32
`json:"livenessFailureThreshold,omitempty"
property:"liveness-failure-threshold"`
- // The liveness probe path to use (default provided by the Catalog
runtime used).
+ // The liveness probe path to use (default provided by the dependency
used).
LivenessProbe string `json:"livenessProbe,omitempty"
property:"liveness-probe"`
// The liveness port to use (default 8080).
LivenessPort int32 `json:"livenessPort,omitempty"
property:"liveness-port"`
@@ -60,7 +67,7 @@ type HealthTrait struct {
ReadinessSuccessThreshold int32
`json:"readinessSuccessThreshold,omitempty"
property:"readiness-success-threshold"`
// Minimum consecutive failures for the readiness probe to be
considered failed after having succeeded.
ReadinessFailureThreshold int32
`json:"readinessFailureThreshold,omitempty"
property:"readiness-failure-threshold"`
- // The readiness probe path to use (default provided by the Catalog
runtime used).
+ // The readiness probe path to use (default provided by the dependency
used).
ReadinessProbe string `json:"readinessProbe,omitempty"
property:"readiness-probe"`
// The readiness port to use (default 8080).
ReadinessPort int32 `json:"readinessPort,omitempty"
property:"readiness-port"`
@@ -77,9 +84,9 @@ type HealthTrait struct {
StartupPeriod int32 `json:"startupPeriod,omitempty"
property:"startup-period"`
// Minimum consecutive successes for the startup probe to be considered
successful after having failed.
StartupSuccessThreshold int32 `json:"startupSuccessThreshold,omitempty"
property:"startup-success-threshold"`
- // Minimum consecutive failures for the startup probe to be considered
failed after having succeeded.
+ // Minimum consecutive failures for the startup probe to be considered
failed after having succeeded (default 10 if not specified).
StartupFailureThreshold int32 `json:"startupFailureThreshold,omitempty"
property:"startup-failure-threshold"`
- // The startup probe path to use (default provided by the Catalog
runtime used).
+ // The startup probe path to use (default provided by the dependency
used).
StartupProbe string `json:"startupProbe,omitempty"
property:"startup-probe"`
// The startup port to use (default 8080).
StartupPort int32 `json:"startupPort,omitempty" property:"startup-port"`
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go
b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index 3be380fab..a4d9cdb16 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -6,6 +6,7 @@ package v1
import (
"encoding/json"
+
"github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -2500,8 +2501,8 @@ func (in *PipeCondition) DeepCopyInto(out *PipeCondition)
{
*out = *in
in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime)
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
- if in.Pods != nil {
- in, out := &in.Pods, &out.Pods
+ if in.DeprecatedPods != nil {
+ in, out := &in.DeprecatedPods, &out.DeprecatedPods
*out = make([]PodCondition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
diff --git a/pkg/controller/catalog/initialize.go
b/pkg/controller/catalog/initialize.go
index 4e8825837..b0388a6ea 100644
--- a/pkg/controller/catalog/initialize.go
+++ b/pkg/controller/catalog/initialize.go
@@ -106,6 +106,12 @@ func (action *initializeAction) addPlainQuarkusCatalog(ctx
context.Context, cata
GroupID: v1.MavenQuarkusGroupID,
ArtifactID: "camel-quarkus-core",
},
+ // We enforce the presence of this component to provide
an
+ // opinionated set of observability services
+ {
+ GroupID: v1.MavenQuarkusGroupID,
+ ArtifactID:
"camel-quarkus-observability-services",
+ },
}
if clonedCatalog.Spec.Runtime.Capabilities != nil {
clonedCatalog.Spec.Runtime.Capabilities["cron"] =
v1.Capability{
diff --git a/pkg/controller/integration/monitor_synthetic_test.go
b/pkg/controller/integration/monitor_synthetic_test.go
index 697379fc1..7eaa6d88a 100644
--- a/pkg/controller/integration/monitor_synthetic_test.go
+++ b/pkg/controller/integration/monitor_synthetic_test.go
@@ -25,6 +25,7 @@ import (
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/utils/ptr"
servingv1 "knative.dev/serving/pkg/apis/serving/v1"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
@@ -54,6 +55,15 @@ func
TestMonitorSyntheticIntegrationImportingKindUnavailable(t *testing.T) {
v1.IntegrationImportedKindLabel: "SomeKind",
},
},
+ Spec: v1.IntegrationSpec{
+ Traits: v1.Traits{
+ Health: &trait.HealthTrait{
+ Trait: trait.Trait{
+ Enabled: ptr.To(false),
+ },
+ },
+ },
+ },
Status: v1.IntegrationStatus{
Phase: v1.IntegrationPhaseRunning,
},
@@ -89,6 +99,15 @@ func TestMonitorSyntheticIntegrationCannotMonitorPods(t
*testing.T) {
v1.IntegrationImportedKindLabel: "Deployment",
},
},
+ Spec: v1.IntegrationSpec{
+ Traits: v1.Traits{
+ Health: &trait.HealthTrait{
+ Trait: trait.Trait{
+ Enabled: ptr.To(false),
+ },
+ },
+ },
+ },
Status: v1.IntegrationStatus{
Phase: v1.IntegrationPhaseRunning,
Conditions: []v1.IntegrationCondition{
@@ -152,6 +171,11 @@ func TestMonitorSyntheticIntegrationDeployment(t
*testing.T) {
Container: &trait.ContainerTrait{
Name: "my-cnt",
},
+ Health: &trait.HealthTrait{
+ Trait: trait.Trait{
+ Enabled: ptr.To(false),
+ },
+ },
},
},
Status: v1.IntegrationStatus{
@@ -270,6 +294,15 @@ func TestMonitorSyntheticIntegrationCronJob(t *testing.T) {
v1.IntegrationImportedKindLabel: "CronJob",
},
},
+ Spec: v1.IntegrationSpec{
+ Traits: v1.Traits{
+ Health: &trait.HealthTrait{
+ Trait: trait.Trait{
+ Enabled: ptr.To(false),
+ },
+ },
+ },
+ },
Status: v1.IntegrationStatus{
Phase: v1.IntegrationPhaseRunning,
Conditions: []v1.IntegrationCondition{
@@ -381,6 +414,15 @@ func TestMonitorSyntheticIntegrationKnativeService(t
*testing.T) {
v1.IntegrationImportedKindLabel:
"KnativeService",
},
},
+ Spec: v1.IntegrationSpec{
+ Traits: v1.Traits{
+ Health: &trait.HealthTrait{
+ Trait: trait.Trait{
+ Enabled: ptr.To(false),
+ },
+ },
+ },
+ },
Status: v1.IntegrationStatus{
Phase: v1.IntegrationPhaseRunning,
Conditions: []v1.IntegrationCondition{
diff --git a/pkg/controller/pipe/monitor.go b/pkg/controller/pipe/monitor.go
index 26653b0bc..f35bc1fc2 100644
--- a/pkg/controller/pipe/monitor.go
+++ b/pkg/controller/pipe/monitor.go
@@ -153,8 +153,8 @@ func (action *monitorAction) Handle(ctx context.Context,
pipe *v1.Pipe) (*v1.Pip
//nolint:staticcheck
if condition :=
it.Status.GetCondition(v1.IntegrationConditionReady); condition != nil {
if condition.DeprecatedPods != nil {
- c.Pods = make([]v1.PodCondition, 0,
len(condition.DeprecatedPods))
- c.Pods = append(c.Pods,
condition.DeprecatedPods...)
+ c.DeprecatedPods = make([]v1.PodCondition, 0,
len(condition.DeprecatedPods))
+ c.DeprecatedPods = append(c.DeprecatedPods,
condition.DeprecatedPods...)
}
}
@@ -186,8 +186,8 @@ func setPipeReadyCondition(kb *v1.Pipe, it *v1.Integration)
{
//nolint:staticcheck
if condition.DeprecatedPods != nil {
- c.Pods = make([]v1.PodCondition, 0,
len(condition.DeprecatedPods))
- c.Pods = append(c.Pods, condition.DeprecatedPods...)
+ c.DeprecatedPods = make([]v1.PodCondition, 0,
len(condition.DeprecatedPods))
+ c.DeprecatedPods = append(c.DeprecatedPods,
condition.DeprecatedPods...)
}
kb.Status.SetConditions(c)
diff --git
a/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
b/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index 516c9b10b..389e25331 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -1225,7 +1225,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -1265,7 +1265,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -1287,7 +1287,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -1305,7 +1306,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
@@ -3755,7 +3756,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -3795,7 +3796,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -3817,7 +3818,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -3835,7 +3837,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
diff --git
a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
index fb5282e45..ba8143b44 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
@@ -1083,7 +1083,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -1123,7 +1123,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -1145,7 +1145,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -1163,7 +1164,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
@@ -3493,7 +3494,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -3533,7 +3534,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -3555,7 +3556,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -3573,7 +3575,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
diff --git a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
index 8fe4faefc..d52a59c3f 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
@@ -7928,7 +7928,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -7968,7 +7968,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -7990,7 +7990,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -8008,7 +8009,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
@@ -10299,7 +10300,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -10339,7 +10340,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -10361,7 +10362,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -10379,7 +10381,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
diff --git a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
index 56c8166d3..fa191373b 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
@@ -7983,7 +7983,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use
(default provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -8023,7 +8023,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use
(default
- provided by the Catalog runtime used).
+ provided by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for
the integration
@@ -8045,7 +8045,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having
succeeded.
+ probe to be considered failed after having
succeeded
+ (default 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -8063,7 +8064,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use
(default provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
@@ -10276,7 +10277,7 @@ spec:
type: integer
livenessProbe:
description: The liveness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
livenessProbeEnabled:
description: Configures the liveness probe for the
integration
@@ -10316,7 +10317,7 @@ spec:
type: integer
readinessProbe:
description: The readiness probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
readinessProbeEnabled:
description: Configures the readiness probe for the
integration
@@ -10338,7 +10339,8 @@ spec:
type: integer
startupFailureThreshold:
description: Minimum consecutive failures for the
startup
- probe to be considered failed after having succeeded.
+ probe to be considered failed after having succeeded
(default
+ 6 if not specified).
format: int32
type: integer
startupInitialDelay:
@@ -10356,7 +10358,7 @@ spec:
type: integer
startupProbe:
description: The startup probe path to use (default
provided
- by the Catalog runtime used).
+ by the dependency used).
type: string
startupProbeEnabled:
description: Configures the startup probe for the
integration
diff --git a/pkg/trait/container_probes_test.go
b/pkg/trait/container_probes_test.go
index 1c69ce7ab..8989f313c 100644
--- a/pkg/trait/container_probes_test.go
+++ b/pkg/trait/container_probes_test.go
@@ -109,11 +109,11 @@ func TestProbesOnDeployment(t *testing.T) {
assert.Equal(t, "", container.LivenessProbe.HTTPGet.Host)
assert.Equal(t, int32(defaultContainerPort),
container.LivenessProbe.HTTPGet.Port.IntVal)
- assert.Equal(t, defaultLivenessProbePath,
container.LivenessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusLivenessProbePath,
container.LivenessProbe.HTTPGet.Path)
assert.Equal(t, corev1.URISchemeHTTP,
container.ReadinessProbe.HTTPGet.Scheme)
assert.Equal(t, "", container.ReadinessProbe.HTTPGet.Host)
assert.Equal(t, int32(defaultContainerPort),
container.ReadinessProbe.HTTPGet.Port.IntVal)
- assert.Equal(t, defaultReadinessProbePath,
container.ReadinessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusReadinessProbePath,
container.ReadinessProbe.HTTPGet.Path)
assert.Equal(t, corev1.URISchemeHTTP,
container.LivenessProbe.HTTPGet.Scheme)
assert.Equal(t, int32(1234), container.LivenessProbe.TimeoutSeconds)
}
@@ -148,11 +148,11 @@ func TestProbesOnDeploymentWithCustomScheme(t *testing.T)
{
assert.Equal(t, "", container.LivenessProbe.HTTPGet.Host)
assert.Equal(t, int32(defaultContainerPort),
container.LivenessProbe.HTTPGet.Port.IntVal)
- assert.Equal(t, defaultLivenessProbePath,
container.LivenessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusLivenessProbePath,
container.LivenessProbe.HTTPGet.Path)
assert.Equal(t, corev1.URISchemeHTTPS,
container.ReadinessProbe.HTTPGet.Scheme)
assert.Equal(t, "", container.ReadinessProbe.HTTPGet.Host)
assert.Equal(t, int32(defaultContainerPort),
container.ReadinessProbe.HTTPGet.Port.IntVal)
- assert.Equal(t, defaultReadinessProbePath,
container.ReadinessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusReadinessProbePath,
container.ReadinessProbe.HTTPGet.Path)
assert.Equal(t, corev1.URISchemeHTTPS,
container.LivenessProbe.HTTPGet.Scheme)
assert.Equal(t, int32(1234), container.LivenessProbe.TimeoutSeconds)
}
@@ -207,9 +207,9 @@ func TestProbesOnKnativeService(t *testing.T) {
assert.Equal(t, "", container.LivenessProbe.HTTPGet.Host)
assert.Equal(t, int32(defaultContainerPort),
container.LivenessProbe.HTTPGet.Port.IntVal)
- assert.Equal(t, defaultLivenessProbePath,
container.LivenessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusLivenessProbePath,
container.LivenessProbe.HTTPGet.Path)
assert.Equal(t, "", container.ReadinessProbe.HTTPGet.Host)
assert.Equal(t, int32(defaultContainerPort),
container.ReadinessProbe.HTTPGet.Port.IntVal)
- assert.Equal(t, defaultReadinessProbePath,
container.ReadinessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusReadinessProbePath,
container.ReadinessProbe.HTTPGet.Path)
assert.Equal(t, int32(1234), container.LivenessProbe.TimeoutSeconds)
}
diff --git a/pkg/trait/health.go b/pkg/trait/health.go
index fc691f29c..5f95c5478 100644
--- a/pkg/trait/health.go
+++ b/pkg/trait/health.go
@@ -35,14 +35,33 @@ const (
healthTraitID = "health"
healthTraitOrder = 1700
- defaultLivenessProbePath = "/q/health/live"
- defaultReadinessProbePath = "/q/health/ready"
- defaultStartupProbePath = "/q/health/started"
+ defaultQuarkusBasePath = "/q/health"
+ defaultQuarkusLivenessProbePath = defaultQuarkusBasePath + "/live"
+ defaultQuarkusReadinessProbePath = defaultQuarkusBasePath + "/ready"
+ defaultQuarkusStartupProbePath = defaultQuarkusBasePath + "/started"
+ defaultQuarkusHealthPort = int32(8080)
+
+ defaultObsSvcBasePath = "/observe/health"
+ defaultObsSvcLivenessProbePath = defaultObsSvcBasePath + "/live"
+ defaultObsSvcReadinessProbePath = defaultObsSvcBasePath + "/ready"
+ defaultObsSvcStartupProbePath = defaultObsSvcBasePath + ""
+ defaultObsSvcHealthPort = int32(9876)
+
+ // We need to be a bit more generous with startup
+ // failure. A jvm mode app can take more than 30 secs
+ // to be started up.
+ defaultStartupFailureThreshold = 10
)
type healthTrait struct {
BaseTrait
traitv1.HealthTrait `property:",squash"`
+
+ // Probes port and base path can be also configured via user properties
+ probesPort int32
+ probesLivenessPath string
+ probesReadinessPath string
+ probesStartupPath string
}
func newHealthTrait() Trait {
@@ -54,57 +73,89 @@ func newHealthTrait() Trait {
func (t *healthTrait) Configure(e *Environment) (bool, *TraitCondition, error)
{
if e.Integration == nil ||
(!e.IntegrationInPhase(v1.IntegrationPhaseInitialization) &&
!e.IntegrationInRunningPhases()) ||
- !ptr.Deref(t.Enabled, false) {
+ !ptr.Deref(t.Enabled, true) {
return false, nil, nil
}
+ // The trait used to be disabled by default in older Camel K runtime
+ if e.CamelCatalog != nil && e.CamelCatalog.Runtime.Provider ==
v1.RuntimeProviderQuarkus && !ptr.Deref(t.Enabled, false) {
+ return false, nil, nil
+ }
+
+ // Skip if self managed build, unless enabled on purpose
+ if !e.Integration.IsManagedBuild() && !ptr.Deref(t.Enabled, false) {
+ return false,
NewIntegrationConditionPlatformDisabledWithMessage("Health",
+ "self managed build: container probes disabled, you can
turn explicitly on"), nil
+ }
+
+ // Skip if built from git, unless enabled on purpose
+ if e.Integration.IsGitBuild() && !ptr.Deref(t.Enabled, false) {
+ return false,
NewIntegrationConditionPlatformDisabledWithMessage("Health",
+ "build from Git: container probes disabled, you can
turn explicitly on"), nil
+ }
+
// The trait must be disabled if a debug operation is ongoing
if jt := e.Catalog.GetTrait(jvmTraitID); jt != nil {
if jvm, ok := jt.(*jvmTrait); ok && ptr.Deref(jvm.Debug, false)
{
- return false,
NewIntegrationConditionPlatformDisabledWithMessage("Health", "debug operation
ongoing: incompatible with health checks"), nil
+ return false,
NewIntegrationConditionPlatformDisabledWithMessage("Health",
+ "debug operation ongoing: incompatible with
health checks"), nil
}
}
t.setProbesValues(e)
- return true, nil, nil
+ return ptr.Deref(t.Enabled, true), nil, nil
}
func (t *healthTrait) setProbesValues(e *Environment) {
- if t.LivenessProbe == "" {
- if e.CamelCatalog.Runtime.Capabilities["health"].Metadata !=
nil {
- t.LivenessProbe =
e.CamelCatalog.Runtime.Capabilities["health"].Metadata["defaultLivenessProbePath"]
+ // values are taken by trait configuration as priority
+ t.probesLivenessPath = t.LivenessProbe
+ t.probesReadinessPath = t.ReadinessProbe
+ t.probesStartupPath = t.StartupProbe
+ // Default is 8080 anyway
+ t.probesPort = defaultQuarkusHealthPort
+
+ if e.CamelCatalog == nil {
+ // Likely it is a self managed build integration
+ return
+ }
+ isOlderCamelKRuntime := e.CamelCatalog.Runtime.Provider ==
v1.RuntimeProviderQuarkus
+ t.probesPort = defaultObsSvcHealthPort
+ if isOlderCamelKRuntime {
+ t.probesPort = defaultQuarkusHealthPort
+ }
+
+ if t.probesLivenessPath == "" {
+ if isOlderCamelKRuntime {
+ t.probesLivenessPath = defaultQuarkusLivenessProbePath
} else {
- // Deprecated: to be removed
- t.LivenessProbe = defaultLivenessProbePath
+ t.probesLivenessPath = defaultObsSvcLivenessProbePath
}
}
- if t.ReadinessProbe == "" {
- if e.CamelCatalog.Runtime.Capabilities["health"].Metadata !=
nil {
- t.ReadinessProbe =
e.CamelCatalog.Runtime.Capabilities["health"].Metadata["defaultReadinessProbePath"]
+
+ if t.probesReadinessPath == "" {
+ if isOlderCamelKRuntime {
+ t.probesReadinessPath = defaultQuarkusReadinessProbePath
} else {
- // Deprecated: to be removed
- t.ReadinessProbe = defaultReadinessProbePath
+ t.probesReadinessPath = defaultObsSvcReadinessProbePath
}
}
- if t.StartupProbe == "" {
- if e.CamelCatalog.Runtime.Capabilities["health"].Metadata !=
nil {
- t.StartupProbe =
e.CamelCatalog.Runtime.Capabilities["health"].Metadata["defaultStartupProbePath"]
+
+ if t.probesStartupPath == "" {
+ if isOlderCamelKRuntime {
+ t.probesStartupPath = defaultQuarkusStartupProbePath
} else {
- // Deprecated: to be removed
- t.StartupProbe = defaultStartupProbePath
+ t.probesStartupPath = defaultObsSvcStartupProbePath
}
}
}
func (t *healthTrait) Apply(e *Environment) error {
if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
- if capability, ok :=
e.CamelCatalog.Runtime.Capabilities[v1.CapabilityHealth]; ok {
- for _, dependency := range capability.Dependencies {
-
util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies,
dependency.GetDependencyID())
- }
- // sort the dependencies to get always the same list if
they don't change
- sort.Strings(e.Integration.Status.Dependencies)
+ // Execute this only for the old deprecated provider in order to
+ // maintain backward compatibility
+ if e.CamelCatalog != nil && e.CamelCatalog.Runtime.Provider ==
v1.RuntimeProviderQuarkus {
+ addCamelHealthCapabilityDependency(e)
}
return nil
@@ -119,35 +170,39 @@ func (t *healthTrait) Apply(e *Environment) error {
return fmt.Errorf("unable to find integration container: %s",
e.Integration.Name)
}
- var port *intstr.IntOrString
- containerPort := e.getIntegrationContainerPort()
- if containerPort == nil {
- containerPort = e.createContainerPort()
- }
- p := intstr.FromInt32(containerPort.ContainerPort)
- port = &p
+ p := intstr.FromInt32(t.probesPort)
- return t.setProbes(container, port)
+ return t.setProbes(container, &p)
+}
+
+func addCamelHealthCapabilityDependency(e *Environment) {
+ if capability, ok :=
e.CamelCatalog.Runtime.Capabilities[v1.CapabilityHealth]; ok {
+ for _, dependency := range capability.Dependencies {
+
util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies,
dependency.GetDependencyID())
+ }
+ // sort the dependencies to get always the same list if they
don't change
+ sort.Strings(e.Integration.Status.Dependencies)
+ }
}
func (t *healthTrait) setProbes(container *corev1.Container, port
*intstr.IntOrString) error {
if ptr.Deref(t.LivenessProbeEnabled, false) {
- if t.LivenessProbe == "" {
+ if t.probesLivenessPath == "" {
return errors.New("you need to configure a liveness
probe explicitly or in your catalog")
}
- container.LivenessProbe = t.newLivenessProbe(port,
t.LivenessProbe)
+ container.LivenessProbe = t.newLivenessProbe(port,
t.probesLivenessPath)
}
if ptr.Deref(t.ReadinessProbeEnabled, true) {
- if t.ReadinessProbe == "" {
+ if t.probesReadinessPath == "" {
return errors.New("you need to configure a readiness
probe explicitly or in your catalog")
}
- container.ReadinessProbe = t.newReadinessProbe(port,
t.ReadinessProbe)
+ container.ReadinessProbe = t.newReadinessProbe(port,
t.probesReadinessPath)
}
if ptr.Deref(t.StartupProbeEnabled, false) {
- if t.StartupProbe == "" {
+ if t.probesStartupPath == "" {
return errors.New("you need to configure a startup
probe explicitly or in your catalog")
}
- container.StartupProbe = t.newStartupProbe(port, t.StartupProbe)
+ container.StartupProbe = t.newStartupProbe(port,
t.probesStartupPath)
}
return nil
@@ -178,60 +233,69 @@ func (t *healthTrait) getStartupScheme() corev1.URIScheme
{
}
func (t *healthTrait) newLivenessProbe(port *intstr.IntOrString, path string)
*corev1.Probe {
- p := corev1.Probe{
- ProbeHandler: corev1.ProbeHandler{
- HTTPGet: &corev1.HTTPGetAction{
- Path: path,
- Scheme: t.getLivenessScheme(),
- Port: *t.getLivenessPort(port),
- },
- },
- InitialDelaySeconds: t.LivenessInitialDelay,
- TimeoutSeconds: t.LivenessTimeout,
- PeriodSeconds: t.LivenessPeriod,
- SuccessThreshold: t.LivenessSuccessThreshold,
- FailureThreshold: t.LivenessFailureThreshold,
- }
-
- return &p
+ return newProbe(
+ path,
+ t.getLivenessScheme(),
+ t.getLivenessPort(port),
+ t.LivenessInitialDelay,
+ t.LivenessTimeout,
+ t.LivenessPeriod,
+ t.LivenessSuccessThreshold,
+ t.LivenessFailureThreshold,
+ )
}
func (t *healthTrait) newReadinessProbe(port *intstr.IntOrString, path string)
*corev1.Probe {
- p := corev1.Probe{
- ProbeHandler: corev1.ProbeHandler{
- HTTPGet: &corev1.HTTPGetAction{
- Path: path,
- Scheme: t.getReadinessScheme(),
- Port: *t.getReadinessPort(port),
- },
- },
- InitialDelaySeconds: t.ReadinessInitialDelay,
- TimeoutSeconds: t.ReadinessTimeout,
- PeriodSeconds: t.ReadinessPeriod,
- SuccessThreshold: t.ReadinessSuccessThreshold,
- FailureThreshold: t.ReadinessFailureThreshold,
+ return newProbe(
+ path,
+ t.getReadinessScheme(),
+ t.getReadinessPort(port),
+ t.ReadinessInitialDelay,
+ t.ReadinessTimeout,
+ t.ReadinessPeriod,
+ t.ReadinessSuccessThreshold,
+ t.ReadinessFailureThreshold,
+ )
+}
+
+func (t *healthTrait) newStartupProbe(port *intstr.IntOrString, path string)
*corev1.Probe {
+ startupFailureThreshold := t.StartupFailureThreshold
+ if startupFailureThreshold == 0 {
+ startupFailureThreshold = defaultStartupFailureThreshold
}
- return &p
+ return newProbe(
+ path,
+ t.getStartupScheme(),
+ t.getStartupPort(port),
+ t.StartupInitialDelay,
+ t.StartupTimeout,
+ t.StartupPeriod,
+ t.StartupSuccessThreshold,
+ startupFailureThreshold,
+ )
}
-func (t *healthTrait) newStartupProbe(port *intstr.IntOrString, path string)
*corev1.Probe {
- p := corev1.Probe{
+func newProbe(
+ path string,
+ scheme corev1.URIScheme,
+ resolverPort *intstr.IntOrString,
+ initialDelay, timeout, period, success, failure int32,
+) *corev1.Probe {
+ return &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: path,
- Scheme: t.getStartupScheme(),
- Port: *t.getStartupPort(port),
+ Scheme: scheme,
+ Port: *resolverPort,
},
},
- InitialDelaySeconds: t.StartupInitialDelay,
- TimeoutSeconds: t.StartupTimeout,
- PeriodSeconds: t.StartupPeriod,
- SuccessThreshold: t.StartupSuccessThreshold,
- FailureThreshold: t.StartupFailureThreshold,
+ InitialDelaySeconds: initialDelay,
+ TimeoutSeconds: timeout,
+ PeriodSeconds: period,
+ SuccessThreshold: success,
+ FailureThreshold: failure,
}
-
- return &p
}
func (t *healthTrait) getLivenessPort(port *intstr.IntOrString)
*intstr.IntOrString {
diff --git a/pkg/trait/health_test.go b/pkg/trait/health_test.go
index c155aefe8..c9e9423c1 100644
--- a/pkg/trait/health_test.go
+++ b/pkg/trait/health_test.go
@@ -38,6 +38,81 @@ import (
func TestHealthTrait(t *testing.T) {
catalog, err := camel.DefaultCatalog()
+ catalog.Runtime.Provider = v1.RuntimeProviderPlainQuarkus
+ require.NoError(t, err)
+
+ client, _ := internal.NewFakeClient()
+ traitCatalog := NewCatalog(nil)
+
+ environment := Environment{
+ CamelCatalog: catalog,
+ Catalog: traitCatalog,
+ Client: client,
+ Integration: &v1.Integration{
+ ObjectMeta: metav1.ObjectMeta{
+ Name: ServiceTestName,
+ Namespace: "ns",
+ },
+ Status: v1.IntegrationStatus{
+ Phase: v1.IntegrationPhaseDeploying,
+ },
+ Spec: v1.IntegrationSpec{
+ Traits: v1.Traits{
+ Health: &trait.HealthTrait{
+ LivenessProbeEnabled:
ptr.To(true),
+ ReadinessProbeEnabled:
ptr.To(true),
+ },
+ },
+ },
+ },
+ IntegrationKit: &v1.IntegrationKit{
+ Status: v1.IntegrationKitStatus{
+ Phase: v1.IntegrationKitPhaseReady,
+ },
+ },
+ Platform: platform.Platform{
+ PublishStrategy:
v1.IntegrationPlatformBuildPublishStrategyJib,
+ Registry: v1.RegistrySpec{Address:
"registry"},
+ BuildRuntimeVersion: catalog.Runtime.Version,
+ },
+ EnvVars: make([]corev1.EnvVar, 0),
+ ExecutedTraits: make([]Trait, 0),
+ Resources: kubernetes.NewCollection(),
+ }
+ _, _, err = traitCatalog.apply(&environment)
+ require.NoError(t, err)
+
+ d :=
environment.Resources.GetDeploymentForIntegration(environment.Integration)
+ assert.NotNil(t, d)
+ assert.Len(t, d.Spec.Template.Spec.Containers, 1)
+ assert.NotNil(t, d.Spec.Template.Spec.Containers[0].LivenessProbe)
+ assert.Equal(t, defaultObsSvcLivenessProbePath,
d.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultObsSvcHealthPort,
d.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Port.IntVal)
+ assert.NotNil(t, d.Spec.Template.Spec.Containers[0].ReadinessProbe)
+ assert.Equal(t, defaultObsSvcReadinessProbePath,
d.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultObsSvcHealthPort,
d.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Port.IntVal)
+ assert.Nil(t, d.Spec.Template.Spec.Containers[0].StartupProbe)
+
+ // Change traits configuration
+ environment.Integration.Spec.Traits.Health.LivenessProbeEnabled =
ptr.To(false)
+ environment.Integration.Spec.Traits.Health.ReadinessProbeEnabled =
ptr.To(false)
+ environment.Integration.Spec.Traits.Health.StartupProbeEnabled =
ptr.To(true)
+
+ _, _, err = traitCatalog.apply(&environment)
+ require.NoError(t, err)
+ d =
environment.Resources.GetDeploymentForIntegration(environment.Integration)
+ assert.NotNil(t, d)
+ assert.Len(t, d.Spec.Template.Spec.Containers, 1)
+ assert.Nil(t, d.Spec.Template.Spec.Containers[0].LivenessProbe)
+ assert.Nil(t, d.Spec.Template.Spec.Containers[0].ReadinessProbe)
+ assert.NotNil(t, d.Spec.Template.Spec.Containers[0].StartupProbe)
+ assert.Equal(t, defaultObsSvcStartupProbePath,
d.Spec.Template.Spec.Containers[0].StartupProbe.HTTPGet.Path)
+ assert.Equal(t, defaultObsSvcHealthPort,
d.Spec.Template.Spec.Containers[0].StartupProbe.HTTPGet.Port.IntVal)
+}
+
+func TestHealthTraitOlderRuntime(t *testing.T) {
+ catalog, err := camel.DefaultCatalog()
+ catalog.Runtime.Provider = v1.RuntimeProviderQuarkus
require.NoError(t, err)
client, _ := internal.NewFakeClient()
@@ -88,9 +163,11 @@ func TestHealthTrait(t *testing.T) {
assert.NotNil(t, d)
assert.Len(t, d.Spec.Template.Spec.Containers, 1)
assert.NotNil(t, d.Spec.Template.Spec.Containers[0].LivenessProbe)
- assert.Equal(t, "/q/health/live",
d.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusLivenessProbePath,
d.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusHealthPort,
d.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Port.IntVal)
assert.NotNil(t, d.Spec.Template.Spec.Containers[0].ReadinessProbe)
- assert.Equal(t, "/q/health/ready",
d.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusReadinessProbePath,
d.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusHealthPort,
d.Spec.Template.Spec.Containers[0].ReadinessProbe.HTTPGet.Port.IntVal)
assert.Nil(t, d.Spec.Template.Spec.Containers[0].StartupProbe)
// Change traits configuration
@@ -106,81 +183,55 @@ func TestHealthTrait(t *testing.T) {
assert.Nil(t, d.Spec.Template.Spec.Containers[0].LivenessProbe)
assert.Nil(t, d.Spec.Template.Spec.Containers[0].ReadinessProbe)
assert.NotNil(t, d.Spec.Template.Spec.Containers[0].StartupProbe)
- assert.Equal(t, "/q/health/started",
d.Spec.Template.Spec.Containers[0].StartupProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusStartupProbePath,
d.Spec.Template.Spec.Containers[0].StartupProbe.HTTPGet.Path)
+ assert.Equal(t, defaultQuarkusHealthPort,
d.Spec.Template.Spec.Containers[0].StartupProbe.HTTPGet.Port.IntVal)
}
func TestConfigureHealthTraitDefault(t *testing.T) {
ht, environment := createNominalHealthTrait(t)
configured, condition, err := ht.Configure(environment)
- assert.False(t, configured)
+ assert.True(t, configured)
assert.Nil(t, err)
assert.Nil(t, condition)
}
-func TestConfigureHealthTraitEnabled(t *testing.T) {
- enabled := true
+func TestConfigureHealthTraitDefaultOlderRuntime(t *testing.T) {
ht, environment := createNominalHealthTrait(t)
- ht.Enabled = &enabled
+ environment.CamelCatalog.Runtime.Provider = v1.RuntimeProviderQuarkus
configured, condition, err := ht.Configure(environment)
- assert.True(t, configured)
+ assert.False(t, configured)
assert.Nil(t, err)
assert.Nil(t, condition)
}
-func TestApplyHealthTraitDefault(t *testing.T) {
- enabled := true
+func TestConfigureHealthTraitEnableOlderRuntime(t *testing.T) {
ht, environment := createNominalHealthTrait(t)
- ht.Enabled = &enabled
+ environment.CamelCatalog.Runtime.Provider = v1.RuntimeProviderQuarkus
+ ht.Enabled = ptr.To(true)
configured, condition, err := ht.Configure(environment)
- assert.True(t, configured)
- assert.Nil(t, err)
- assert.Nil(t, condition)
- err = ht.Apply(environment)
- assert.Nil(t, err)
- assert.Equal(t, "/q/health/ready",
environment.GetIntegrationContainer().ReadinessProbe.HTTPGet.Path)
- assert.Equal(t, corev1.URISchemeHTTP,
environment.GetIntegrationContainer().ReadinessProbe.HTTPGet.Scheme)
- assert.Equal(t, "8080",
environment.GetIntegrationContainer().ReadinessProbe.HTTPGet.Port.String())
-}
-func TestApplyHealthTraitLivenessDefault(t *testing.T) {
- enabled := true
- ht, environment := createNominalHealthTrait(t)
- ht.Enabled = &enabled
- ht.LivenessProbeEnabled = &enabled
- configured, condition, err := ht.Configure(environment)
assert.True(t, configured)
assert.Nil(t, err)
assert.Nil(t, condition)
-
- err = ht.Apply(environment)
- assert.Nil(t, err)
- assert.Equal(t, "/q/health/live",
environment.GetIntegrationContainer().LivenessProbe.HTTPGet.Path)
- assert.Equal(t, corev1.URISchemeHTTP,
environment.GetIntegrationContainer().LivenessProbe.HTTPGet.Scheme)
- assert.Equal(t, "8080",
environment.GetIntegrationContainer().LivenessProbe.HTTPGet.Port.String())
}
-func TestApplyHealthTraitStartupDefault(t *testing.T) {
- enabled := true
+func TestConfigureHealthTraitDisabled(t *testing.T) {
+ enabled := false
ht, environment := createNominalHealthTrait(t)
ht.Enabled = &enabled
- ht.StartupProbeEnabled = &enabled
configured, condition, err := ht.Configure(environment)
- assert.True(t, configured)
- assert.Nil(t, err)
- assert.Nil(t, condition)
- err = ht.Apply(environment)
+ assert.False(t, configured)
assert.Nil(t, err)
- assert.Equal(t, "/q/health/started",
environment.GetIntegrationContainer().StartupProbe.HTTPGet.Path)
- assert.Equal(t, corev1.URISchemeHTTP,
environment.GetIntegrationContainer().StartupProbe.HTTPGet.Scheme)
- assert.Equal(t, "8080",
environment.GetIntegrationContainer().StartupProbe.HTTPGet.Port.String())
+ assert.Nil(t, condition)
}
func createNominalHealthTrait(t *testing.T) (*healthTrait, *Environment) {
t.Helper()
catalog, err := camel.DefaultCatalog()
+ catalog.Runtime.Provider = v1.RuntimeProviderPlainQuarkus
assert.Nil(t, err)
trait, _ := newHealthTrait().(*healthTrait)
@@ -224,7 +275,7 @@ func TestApplyHealthTraitSyntheticKit(t *testing.T) {
ht, environment := createNominalHealthTrait(t)
// Simulate a synthetic Kit which has not catalog attached
environment.CamelCatalog = nil
- ht.Enabled = &enabled
+ ht.Enabled = ptr.To(true)
ht.LivenessProbeEnabled = &enabled
ht.ReadinessProbeEnabled = &enabled
ht.StartupProbeEnabled = &enabled
diff --git a/pkg/trait/prometheus.go b/pkg/trait/prometheus.go
index 588c49059..5ae98deaf 100644
--- a/pkg/trait/prometheus.go
+++ b/pkg/trait/prometheus.go
@@ -39,6 +39,9 @@ const (
type prometheusTrait struct {
BaseTrait
traitv1.PrometheusTrait `property:",squash"`
+
+ port int32
+ metricsPath string
}
func newPrometheusTrait() Trait {
@@ -48,7 +51,9 @@ func newPrometheusTrait() Trait {
}
func (t *prometheusTrait) Configure(e *Environment) (bool, *TraitCondition,
error) {
- if e.Integration == nil || !ptr.Deref(t.Enabled, false) {
+ if e.Integration == nil ||
+ (!e.IntegrationInPhase(v1.IntegrationPhaseInitialization) &&
!e.IntegrationInRunningPhases()) ||
+ !ptr.Deref(t.Enabled, false) {
return false, nil, nil
}
@@ -60,11 +65,21 @@ func (t *prometheusTrait) Configure(e *Environment) (bool,
*TraitCondition, erro
"Prometheus trait is deprecated in favour of Camel Monitor
Operator project",
)
+ // Default values
+ t.port = defaultObsSvcHealthPort
+ t.metricsPath = "/observe/metrics"
+ // Set values for older runtime
+ isOlderCamelKRuntime := e.CamelCatalog.Runtime.Provider ==
v1.RuntimeProviderQuarkus
+ if isOlderCamelKRuntime {
+ t.port = defaultQuarkusHealthPort
+ t.metricsPath = "/q/metrics"
+ }
+
return e.IntegrationInPhase(v1.IntegrationPhaseInitialization) ||
e.IntegrationInRunningPhases(), condition, nil
}
func (t *prometheusTrait) Apply(e *Environment) error {
- if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
+ if e.CamelCatalog.Runtime.Provider == v1.RuntimeProviderQuarkus &&
e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
util.StringSliceUniqueAdd(&e.Integration.Status.Capabilities,
v1.CapabilityPrometheus)
}
@@ -87,8 +102,8 @@ func (t *prometheusTrait) Apply(e *Environment) error {
}
containerPort := e.getIntegrationContainerPort()
- if containerPort == nil {
- containerPort = e.createContainerPort()
+ if containerPort == nil || t.port == defaultObsSvcHealthPort {
+ containerPort = createContainerPort(t.port)
container.Ports = append(container.Ports, *containerPort)
}
@@ -148,7 +163,7 @@ func (t *prometheusTrait) getPodMonitorFor(e *Environment,
portName string) (*mo
PodMetricsEndpoints: []monitoringv1.PodMetricsEndpoint{
{
Port: &portName,
- Path: "/q/metrics",
+ Path: t.metricsPath,
},
},
},
@@ -156,3 +171,12 @@ func (t *prometheusTrait) getPodMonitorFor(e *Environment,
portName string) (*mo
return &podMonitor, nil
}
+
+// createContainerPort creates a new container port for Prometheus endpoint.
+func createContainerPort(port int32) *corev1.ContainerPort {
+ return &corev1.ContainerPort{
+ Name: "prometheus",
+ ContainerPort: port,
+ Protocol: corev1.ProtocolTCP,
+ }
+}
diff --git a/pkg/trait/prometheus_test.go b/pkg/trait/prometheus_test.go
index d88d08d75..234c357db 100644
--- a/pkg/trait/prometheus_test.go
+++ b/pkg/trait/prometheus_test.go
@@ -56,6 +56,7 @@ func TestConfigurePrometheusTraitInWrongPhaseDoesNotSucceed(t
*testing.T) {
func TestApplyNominalPrometheusTraitDoesSucceed(t *testing.T) {
trait, environment := createNominalPrometheusTest()
+ trait.Configure(environment)
err := trait.Apply(environment)
require.NoError(t, err)
@@ -85,6 +86,7 @@ func TestApplyPrometheusTraitWithoutContainerDoesNotSucceed(t
*testing.T) {
trait, environment := createNominalPrometheusTest()
environment.Resources = kubernetes.NewCollection()
+ trait.Configure(environment)
err := trait.Apply(environment)
require.NoError(t, err)
diff --git a/pkg/trait/trait_test.go b/pkg/trait/trait_test.go
index 550f06f59..61769a2ef 100644
--- a/pkg/trait/trait_test.go
+++ b/pkg/trait/trait_test.go
@@ -214,6 +214,7 @@ func createTestEnv(t *testing.T, script string)
*Environment {
client, _ := internal.NewFakeClient()
catalog, err := camel.DefaultCatalog()
+ catalog.Runtime.Provider = v1.RuntimeProviderPlainQuarkus
require.NoError(t, err)
res := &Environment{
@@ -268,7 +269,7 @@ func TestExecutedTraitsCondition(t *testing.T) {
v1.IntegrationConditionTraitInfo,
corev1.ConditionTrue,
"TraitConfiguration",
- "Applied traits:
camel,environment,logging,deployer,deployment,gc,container,security-context,mount,quarkus,jvm,owner",
+ "Applied traits:
camel,environment,logging,deployer,deployment,gc,container,security-context,mount,health,quarkus,jvm,owner",
)
assert.Contains(t, conditions, expectedCondition)
}
diff --git a/pkg/trait/trait_types.go b/pkg/trait/trait_types.go
index 4245e596c..f5621dfa7 100644
--- a/pkg/trait/trait_types.go
+++ b/pkg/trait/trait_types.go
@@ -542,29 +542,6 @@ func (e *Environment) getIntegrationContainerPort()
*corev1.ContainerPort {
return nil
}
-// createContainerPort creates a new container port with values taken from
Container trait or default.
-func (e *Environment) createContainerPort() *corev1.ContainerPort {
- var name string
- var port int32
-
- if t := e.Catalog.GetTrait(containerTraitID); t != nil {
- if ct, ok := t.(*containerTrait); ok {
- name = ct.PortName
- port = ct.getPort()
- }
- }
-
- if name == "" {
- name = e.determineDefaultContainerPortName()
- }
-
- return &corev1.ContainerPort{
- Name: name,
- ContainerPort: port,
- Protocol: corev1.ProtocolTCP,
- }
-}
-
// CapabilityPropertyKey returns the key or expand any variable provided in
it. vars variable contain the
// possible dynamic values to use.
func CapabilityPropertyKey(camelPropertyKey string, vars map[string]string)
string {