This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 6d3c834559732d4fc3f6f40bdf9c6661ecec6bfa
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Mon May 20 13:20:21 2024 +0200

    fix(trait): health for synthetic Kits
    
    Ref #5519
---
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  | 21 ++++++
 docs/modules/traits/pages/health.adoc              | 12 ++++
 helm/camel-k/crds/crd-integration-platform.yaml    | 24 +++++++
 helm/camel-k/crds/crd-integration-profile.yaml     | 24 +++++++
 helm/camel-k/crds/crd-integration.yaml             | 12 ++++
 helm/camel-k/crds/crd-kamelet-binding.yaml         | 12 ++++
 helm/camel-k/crds/crd-pipe.yaml                    | 12 ++++
 pkg/apis/camel/v1/trait/health.go                  |  6 ++
 .../camel.apache.org_integrationplatforms.yaml     | 24 +++++++
 .../camel.apache.org_integrationprofiles.yaml      | 24 +++++++
 .../crd/bases/camel.apache.org_integrations.yaml   | 12 ++++
 .../bases/camel.apache.org_kameletbindings.yaml    | 12 ++++
 .../config/crd/bases/camel.apache.org_pipes.yaml   | 12 ++++
 pkg/trait/health.go                                | 75 ++++++++++++++--------
 pkg/trait/health_test.go                           | 30 +++++++++
 15 files changed, 284 insertions(+), 28 deletions(-)

diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc 
b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index 3c66b0987..1d00aaae8 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -7034,6 +7034,13 @@ int32
 
 Minimum consecutive failures for the liveness probe to be considered failed 
after having succeeded.
 
+|`livenessProbe` +
+string
+|
+
+
+The liveness probe path to use (default provided by the Catalog runtime used).
+
 |`readinessProbeEnabled` +
 bool
 |
@@ -7083,6 +7090,13 @@ int32
 
 Minimum consecutive failures for the readiness probe to be considered failed 
after having succeeded.
 
+|`readinessProbe` +
+string
+|
+
+
+The readiness probe path to use (default provided by the Catalog runtime used).
+
 |`startupProbeEnabled` +
 bool
 |
@@ -7132,6 +7146,13 @@ int32
 
 Minimum consecutive failures for the startup probe to be considered failed 
after having succeeded.
 
+|`startupProbe` +
+string
+|
+
+
+The startup probe path to use (default provided by the Catalog runtime used).
+
 
 |===
 
diff --git a/docs/modules/traits/pages/health.adoc 
b/docs/modules/traits/pages/health.adoc
index c53656338..6bf487823 100755
--- a/docs/modules/traits/pages/health.adoc
+++ b/docs/modules/traits/pages/health.adoc
@@ -57,6 +57,10 @@ The following configuration options are available:
 | int32
 | Minimum consecutive failures for the liveness probe to be considered failed 
after having succeeded.
 
+| health.liveness-probe
+| string
+| The liveness probe path to use (default provided by the Catalog runtime 
used).
+
 | health.readiness-probe-enabled
 | bool
 | Configures the readiness probe for the integration container (default 
`true`).
@@ -85,6 +89,10 @@ The following configuration options are available:
 | int32
 | Minimum consecutive failures for the readiness probe to be considered failed 
after having succeeded.
 
+| health.readiness-probe
+| string
+| The readiness probe path to use (default provided by the Catalog runtime 
used).
+
 | health.startup-probe-enabled
 | bool
 | Configures the startup probe for the integration container (default `false`).
@@ -113,6 +121,10 @@ The following configuration options are available:
 | int32
 | Minimum consecutive failures for the startup probe to be considered failed 
after having succeeded.
 
+| health.startup-probe
+| string
+| The startup probe path to use (default provided by the Catalog runtime used).
+
 |===
 
 // End of autogenerated code - DO NOT EDIT! (configuration)
diff --git a/helm/camel-k/crds/crd-integration-platform.yaml 
b/helm/camel-k/crds/crd-integration-platform.yaml
index 048ad2baa..ed67e6cd8 100644
--- a/helm/camel-k/crds/crd-integration-platform.yaml
+++ b/helm/camel-k/crds/crd-integration-platform.yaml
@@ -1030,6 +1030,10 @@ spec:
                         description: How often to perform the liveness probe.
                         format: int32
                         type: integer
+                      livenessProbe:
+                        description: The liveness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       livenessProbeEnabled:
                         description: Configures the liveness probe for the 
integration
                           container (default `false`).
@@ -1062,6 +1066,10 @@ spec:
                         description: How often to perform the readiness probe.
                         format: int32
                         type: integer
+                      readinessProbe:
+                        description: The readiness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       readinessProbeEnabled:
                         description: Configures the readiness probe for the 
integration
                           container (default `true`).
@@ -1094,6 +1102,10 @@ spec:
                         description: How often to perform the startup probe.
                         format: int32
                         type: integer
+                      startupProbe:
+                        description: The startup probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       startupProbeEnabled:
                         description: Configures the startup probe for the 
integration
                           container (default `false`).
@@ -3008,6 +3020,10 @@ spec:
                         description: How often to perform the liveness probe.
                         format: int32
                         type: integer
+                      livenessProbe:
+                        description: The liveness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       livenessProbeEnabled:
                         description: Configures the liveness probe for the 
integration
                           container (default `false`).
@@ -3040,6 +3056,10 @@ spec:
                         description: How often to perform the readiness probe.
                         format: int32
                         type: integer
+                      readinessProbe:
+                        description: The readiness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       readinessProbeEnabled:
                         description: Configures the readiness probe for the 
integration
                           container (default `true`).
@@ -3072,6 +3092,10 @@ spec:
                         description: How often to perform the startup probe.
                         format: int32
                         type: integer
+                      startupProbe:
+                        description: The startup probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       startupProbeEnabled:
                         description: Configures the startup probe for the 
integration
                           container (default `false`).
diff --git a/helm/camel-k/crds/crd-integration-profile.yaml 
b/helm/camel-k/crds/crd-integration-profile.yaml
index f88110735..8374b1ed0 100644
--- a/helm/camel-k/crds/crd-integration-profile.yaml
+++ b/helm/camel-k/crds/crd-integration-profile.yaml
@@ -907,6 +907,10 @@ spec:
                         description: How often to perform the liveness probe.
                         format: int32
                         type: integer
+                      livenessProbe:
+                        description: The liveness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       livenessProbeEnabled:
                         description: Configures the liveness probe for the 
integration
                           container (default `false`).
@@ -939,6 +943,10 @@ spec:
                         description: How often to perform the readiness probe.
                         format: int32
                         type: integer
+                      readinessProbe:
+                        description: The readiness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       readinessProbeEnabled:
                         description: Configures the readiness probe for the 
integration
                           container (default `true`).
@@ -971,6 +979,10 @@ spec:
                         description: How often to perform the startup probe.
                         format: int32
                         type: integer
+                      startupProbe:
+                        description: The startup probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       startupProbeEnabled:
                         description: Configures the startup probe for the 
integration
                           container (default `false`).
@@ -2768,6 +2780,10 @@ spec:
                         description: How often to perform the liveness probe.
                         format: int32
                         type: integer
+                      livenessProbe:
+                        description: The liveness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       livenessProbeEnabled:
                         description: Configures the liveness probe for the 
integration
                           container (default `false`).
@@ -2800,6 +2816,10 @@ spec:
                         description: How often to perform the readiness probe.
                         format: int32
                         type: integer
+                      readinessProbe:
+                        description: The readiness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       readinessProbeEnabled:
                         description: Configures the readiness probe for the 
integration
                           container (default `true`).
@@ -2832,6 +2852,10 @@ spec:
                         description: How often to perform the startup probe.
                         format: int32
                         type: integer
+                      startupProbe:
+                        description: The startup probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       startupProbeEnabled:
                         description: Configures the startup probe for the 
integration
                           container (default `false`).
diff --git a/helm/camel-k/crds/crd-integration.yaml 
b/helm/camel-k/crds/crd-integration.yaml
index bb8917237..2be45505b 100644
--- a/helm/camel-k/crds/crd-integration.yaml
+++ b/helm/camel-k/crds/crd-integration.yaml
@@ -6968,6 +6968,10 @@ spec:
                         description: How often to perform the liveness probe.
                         format: int32
                         type: integer
+                      livenessProbe:
+                        description: The liveness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       livenessProbeEnabled:
                         description: Configures the liveness probe for the 
integration
                           container (default `false`).
@@ -7000,6 +7004,10 @@ spec:
                         description: How often to perform the readiness probe.
                         format: int32
                         type: integer
+                      readinessProbe:
+                        description: The readiness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       readinessProbeEnabled:
                         description: Configures the readiness probe for the 
integration
                           container (default `true`).
@@ -7032,6 +7040,10 @@ spec:
                         description: How often to perform the startup probe.
                         format: int32
                         type: integer
+                      startupProbe:
+                        description: The startup probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       startupProbeEnabled:
                         description: Configures the startup probe for the 
integration
                           container (default `false`).
diff --git a/helm/camel-k/crds/crd-kamelet-binding.yaml 
b/helm/camel-k/crds/crd-kamelet-binding.yaml
index 8bf051f3f..9c5bb4500 100644
--- a/helm/camel-k/crds/crd-kamelet-binding.yaml
+++ b/helm/camel-k/crds/crd-kamelet-binding.yaml
@@ -7251,6 +7251,10 @@ spec:
                             description: How often to perform the liveness 
probe.
                             format: int32
                             type: integer
+                          livenessProbe:
+                            description: The liveness probe path to use 
(default provided
+                              by the Catalog runtime used).
+                            type: string
                           livenessProbeEnabled:
                             description: Configures the liveness probe for the 
integration
                               container (default `false`).
@@ -7283,6 +7287,10 @@ spec:
                             description: How often to perform the readiness 
probe.
                             format: int32
                             type: integer
+                          readinessProbe:
+                            description: The readiness probe path to use 
(default
+                              provided by the Catalog runtime used).
+                            type: string
                           readinessProbeEnabled:
                             description: Configures the readiness probe for 
the integration
                               container (default `true`).
@@ -7315,6 +7323,10 @@ spec:
                             description: How often to perform the startup 
probe.
                             format: int32
                             type: integer
+                          startupProbe:
+                            description: The startup probe path to use 
(default provided
+                              by the Catalog runtime used).
+                            type: string
                           startupProbeEnabled:
                             description: Configures the startup probe for the 
integration
                               container (default `false`).
diff --git a/helm/camel-k/crds/crd-pipe.yaml b/helm/camel-k/crds/crd-pipe.yaml
index 292e2ec94..b0ffe4f17 100644
--- a/helm/camel-k/crds/crd-pipe.yaml
+++ b/helm/camel-k/crds/crd-pipe.yaml
@@ -7249,6 +7249,10 @@ spec:
                             description: How often to perform the liveness 
probe.
                             format: int32
                             type: integer
+                          livenessProbe:
+                            description: The liveness probe path to use 
(default provided
+                              by the Catalog runtime used).
+                            type: string
                           livenessProbeEnabled:
                             description: Configures the liveness probe for the 
integration
                               container (default `false`).
@@ -7281,6 +7285,10 @@ spec:
                             description: How often to perform the readiness 
probe.
                             format: int32
                             type: integer
+                          readinessProbe:
+                            description: The readiness probe path to use 
(default
+                              provided by the Catalog runtime used).
+                            type: string
                           readinessProbeEnabled:
                             description: Configures the readiness probe for 
the integration
                               container (default `true`).
@@ -7313,6 +7321,10 @@ spec:
                             description: How often to perform the startup 
probe.
                             format: int32
                             type: integer
+                          startupProbe:
+                            description: The startup probe path to use 
(default provided
+                              by the Catalog runtime used).
+                            type: string
                           startupProbeEnabled:
                             description: Configures the startup probe for the 
integration
                               container (default `false`).
diff --git a/pkg/apis/camel/v1/trait/health.go 
b/pkg/apis/camel/v1/trait/health.go
index 2d7e88870..f86eb536d 100644
--- a/pkg/apis/camel/v1/trait/health.go
+++ b/pkg/apis/camel/v1/trait/health.go
@@ -39,6 +39,8 @@ type HealthTrait struct {
        LivenessSuccessThreshold int32 `property:"liveness-success-threshold" 
json:"livenessSuccessThreshold,omitempty"`
        // Minimum consecutive failures for the liveness probe to be considered 
failed after having succeeded.
        LivenessFailureThreshold int32 `property:"liveness-failure-threshold" 
json:"livenessFailureThreshold,omitempty"`
+       // The liveness probe path to use (default provided by the Catalog 
runtime used).
+       LivenessProbe string `property:"liveness-probe" 
json:"livenessProbe,omitempty"`
 
        // Configures the readiness probe for the integration container 
(default `true`).
        ReadinessProbeEnabled *bool `property:"readiness-probe-enabled" 
json:"readinessProbeEnabled,omitempty"`
@@ -54,6 +56,8 @@ type HealthTrait struct {
        ReadinessSuccessThreshold int32 `property:"readiness-success-threshold" 
json:"readinessSuccessThreshold,omitempty"`
        // Minimum consecutive failures for the readiness probe to be 
considered failed after having succeeded.
        ReadinessFailureThreshold int32 `property:"readiness-failure-threshold" 
json:"readinessFailureThreshold,omitempty"`
+       // The readiness probe path to use (default provided by the Catalog 
runtime used).
+       ReadinessProbe string `property:"readiness-probe" 
json:"readinessProbe,omitempty"`
 
        // Configures the startup probe for the integration container (default 
`false`).
        StartupProbeEnabled *bool `property:"startup-probe-enabled" 
json:"startupProbeEnabled,omitempty"`
@@ -69,4 +73,6 @@ type HealthTrait struct {
        StartupSuccessThreshold int32 `property:"startup-success-threshold" 
json:"startupSuccessThreshold,omitempty"`
        // Minimum consecutive failures for the startup probe to be considered 
failed after having succeeded.
        StartupFailureThreshold int32 `property:"startup-failure-threshold" 
json:"startupFailureThreshold,omitempty"`
+       // The startup probe path to use (default provided by the Catalog 
runtime used).
+       StartupProbe string `property:"startup-probe" 
json:"startupProbe,omitempty"`
 }
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 048ad2baa..ed67e6cd8 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -1030,6 +1030,10 @@ spec:
                         description: How often to perform the liveness probe.
                         format: int32
                         type: integer
+                      livenessProbe:
+                        description: The liveness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       livenessProbeEnabled:
                         description: Configures the liveness probe for the 
integration
                           container (default `false`).
@@ -1062,6 +1066,10 @@ spec:
                         description: How often to perform the readiness probe.
                         format: int32
                         type: integer
+                      readinessProbe:
+                        description: The readiness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       readinessProbeEnabled:
                         description: Configures the readiness probe for the 
integration
                           container (default `true`).
@@ -1094,6 +1102,10 @@ spec:
                         description: How often to perform the startup probe.
                         format: int32
                         type: integer
+                      startupProbe:
+                        description: The startup probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       startupProbeEnabled:
                         description: Configures the startup probe for the 
integration
                           container (default `false`).
@@ -3008,6 +3020,10 @@ spec:
                         description: How often to perform the liveness probe.
                         format: int32
                         type: integer
+                      livenessProbe:
+                        description: The liveness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       livenessProbeEnabled:
                         description: Configures the liveness probe for the 
integration
                           container (default `false`).
@@ -3040,6 +3056,10 @@ spec:
                         description: How often to perform the readiness probe.
                         format: int32
                         type: integer
+                      readinessProbe:
+                        description: The readiness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       readinessProbeEnabled:
                         description: Configures the readiness probe for the 
integration
                           container (default `true`).
@@ -3072,6 +3092,10 @@ spec:
                         description: How often to perform the startup probe.
                         format: int32
                         type: integer
+                      startupProbe:
+                        description: The startup probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       startupProbeEnabled:
                         description: Configures the startup probe for the 
integration
                           container (default `false`).
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 f88110735..8374b1ed0 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
@@ -907,6 +907,10 @@ spec:
                         description: How often to perform the liveness probe.
                         format: int32
                         type: integer
+                      livenessProbe:
+                        description: The liveness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       livenessProbeEnabled:
                         description: Configures the liveness probe for the 
integration
                           container (default `false`).
@@ -939,6 +943,10 @@ spec:
                         description: How often to perform the readiness probe.
                         format: int32
                         type: integer
+                      readinessProbe:
+                        description: The readiness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       readinessProbeEnabled:
                         description: Configures the readiness probe for the 
integration
                           container (default `true`).
@@ -971,6 +979,10 @@ spec:
                         description: How often to perform the startup probe.
                         format: int32
                         type: integer
+                      startupProbe:
+                        description: The startup probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       startupProbeEnabled:
                         description: Configures the startup probe for the 
integration
                           container (default `false`).
@@ -2768,6 +2780,10 @@ spec:
                         description: How often to perform the liveness probe.
                         format: int32
                         type: integer
+                      livenessProbe:
+                        description: The liveness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       livenessProbeEnabled:
                         description: Configures the liveness probe for the 
integration
                           container (default `false`).
@@ -2800,6 +2816,10 @@ spec:
                         description: How often to perform the readiness probe.
                         format: int32
                         type: integer
+                      readinessProbe:
+                        description: The readiness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       readinessProbeEnabled:
                         description: Configures the readiness probe for the 
integration
                           container (default `true`).
@@ -2832,6 +2852,10 @@ spec:
                         description: How often to perform the startup probe.
                         format: int32
                         type: integer
+                      startupProbe:
+                        description: The startup probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       startupProbeEnabled:
                         description: Configures the startup probe for the 
integration
                           container (default `false`).
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 bb8917237..2be45505b 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
@@ -6968,6 +6968,10 @@ spec:
                         description: How often to perform the liveness probe.
                         format: int32
                         type: integer
+                      livenessProbe:
+                        description: The liveness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       livenessProbeEnabled:
                         description: Configures the liveness probe for the 
integration
                           container (default `false`).
@@ -7000,6 +7004,10 @@ spec:
                         description: How often to perform the readiness probe.
                         format: int32
                         type: integer
+                      readinessProbe:
+                        description: The readiness probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       readinessProbeEnabled:
                         description: Configures the readiness probe for the 
integration
                           container (default `true`).
@@ -7032,6 +7040,10 @@ spec:
                         description: How often to perform the startup probe.
                         format: int32
                         type: integer
+                      startupProbe:
+                        description: The startup probe path to use (default 
provided
+                          by the Catalog runtime used).
+                        type: string
                       startupProbeEnabled:
                         description: Configures the startup probe for the 
integration
                           container (default `false`).
diff --git 
a/pkg/resources/config/crd/bases/camel.apache.org_kameletbindings.yaml 
b/pkg/resources/config/crd/bases/camel.apache.org_kameletbindings.yaml
index 8bf051f3f..9c5bb4500 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_kameletbindings.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_kameletbindings.yaml
@@ -7251,6 +7251,10 @@ spec:
                             description: How often to perform the liveness 
probe.
                             format: int32
                             type: integer
+                          livenessProbe:
+                            description: The liveness probe path to use 
(default provided
+                              by the Catalog runtime used).
+                            type: string
                           livenessProbeEnabled:
                             description: Configures the liveness probe for the 
integration
                               container (default `false`).
@@ -7283,6 +7287,10 @@ spec:
                             description: How often to perform the readiness 
probe.
                             format: int32
                             type: integer
+                          readinessProbe:
+                            description: The readiness probe path to use 
(default
+                              provided by the Catalog runtime used).
+                            type: string
                           readinessProbeEnabled:
                             description: Configures the readiness probe for 
the integration
                               container (default `true`).
@@ -7315,6 +7323,10 @@ spec:
                             description: How often to perform the startup 
probe.
                             format: int32
                             type: integer
+                          startupProbe:
+                            description: The startup probe path to use 
(default provided
+                              by the Catalog runtime used).
+                            type: string
                           startupProbeEnabled:
                             description: Configures the startup probe for the 
integration
                               container (default `false`).
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 292e2ec94..b0ffe4f17 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
@@ -7249,6 +7249,10 @@ spec:
                             description: How often to perform the liveness 
probe.
                             format: int32
                             type: integer
+                          livenessProbe:
+                            description: The liveness probe path to use 
(default provided
+                              by the Catalog runtime used).
+                            type: string
                           livenessProbeEnabled:
                             description: Configures the liveness probe for the 
integration
                               container (default `false`).
@@ -7281,6 +7285,10 @@ spec:
                             description: How often to perform the readiness 
probe.
                             format: int32
                             type: integer
+                          readinessProbe:
+                            description: The readiness probe path to use 
(default
+                              provided by the Catalog runtime used).
+                            type: string
                           readinessProbeEnabled:
                             description: Configures the readiness probe for 
the integration
                               container (default `true`).
@@ -7313,6 +7321,10 @@ spec:
                             description: How often to perform the startup 
probe.
                             format: int32
                             type: integer
+                          startupProbe:
+                            description: The startup probe path to use 
(default provided
+                              by the Catalog runtime used).
+                            type: string
                           startupProbeEnabled:
                             description: Configures the startup probe for the 
integration
                               container (default `false`).
diff --git a/pkg/trait/health.go b/pkg/trait/health.go
index 25d5401f9..bbaf9b66c 100644
--- a/pkg/trait/health.go
+++ b/pkg/trait/health.go
@@ -56,11 +56,9 @@ func newHealthTrait() Trait {
 }
 
 func (t *healthTrait) Configure(e *Environment) (bool, *TraitCondition, error) 
{
-       if e.CamelCatalog == nil {
-               return false, 
NewIntegrationConditionPlatformDisabledCatalogMissing(), nil
-       }
        if e.Integration == nil ||
-               !e.IntegrationInPhase(v1.IntegrationPhaseInitialization) && 
!e.IntegrationInRunningPhases() {
+               (!e.IntegrationInPhase(v1.IntegrationPhaseInitialization) && 
!e.IntegrationInRunningPhases()) ||
+               !pointer.BoolDeref(t.Enabled, false) {
                return false, nil, nil
        }
 
@@ -71,7 +69,36 @@ func (t *healthTrait) Configure(e *Environment) (bool, 
*TraitCondition, error) {
                }
        }
 
-       return pointer.BoolDeref(t.Enabled, false), nil, nil
+       t.setProbesValues(e)
+
+       return true, nil, nil
+}
+
+func (t *healthTrait) setProbesValues(e *Environment) {
+       if t.LivenessProbe == "" {
+               if e.CamelCatalog != nil && 
e.CamelCatalog.Runtime.Capabilities["health"].Metadata != nil {
+                       t.LivenessProbe = 
e.CamelCatalog.Runtime.Capabilities["health"].Metadata["defaultLivenessProbePath"]
+               } else {
+                       // Deprecated: to be removed
+                       t.LivenessProbe = defaultLivenessProbePath
+               }
+       }
+       if t.ReadinessProbe == "" {
+               if e.CamelCatalog != nil && 
e.CamelCatalog.Runtime.Capabilities["health"].Metadata != nil {
+                       t.ReadinessProbe = 
e.CamelCatalog.Runtime.Capabilities["health"].Metadata["defaultReadinessProbePath"]
+               } else {
+                       // Deprecated: to be removed
+                       t.ReadinessProbe = defaultReadinessProbePath
+               }
+       }
+       if t.StartupProbe == "" {
+               if e.CamelCatalog != nil && 
e.CamelCatalog.Runtime.Capabilities["health"].Metadata != nil {
+                       t.StartupProbe = 
e.CamelCatalog.Runtime.Capabilities["health"].Metadata["defaultStartupProbePath"]
+               } else {
+                       // Deprecated: to be removed
+                       t.StartupProbe = defaultStartupProbePath
+               }
+       }
 }
 
 func (t *healthTrait) Apply(e *Environment) error {
@@ -103,38 +130,30 @@ func (t *healthTrait) Apply(e *Environment) error {
        p := intstr.FromInt32(containerPort.ContainerPort)
        port = &p
 
-       if e.CamelCatalog.Runtime.Capabilities["health"].Metadata != nil {
-               t.setCatalogConfiguration(container, port, 
e.CamelCatalog.Runtime.Capabilities["health"].Metadata)
-       } else {
-               t.setDefaultConfiguration(container, port)
-       }
-
-       return nil
+       return t.setProbes(container, port)
 }
 
-func (t *healthTrait) setCatalogConfiguration(container *corev1.Container, 
port *intstr.IntOrString, metadata map[string]string) {
+func (t *healthTrait) setProbes(container *corev1.Container, port 
*intstr.IntOrString) error {
        if pointer.BoolDeref(t.LivenessProbeEnabled, false) {
-               container.LivenessProbe = t.newLivenessProbe(port, 
metadata["defaultLivenessProbePath"])
+               if t.LivenessProbe == "" {
+                       return fmt.Errorf("you need to configure a liveness 
probe explicitly or in your catalog")
+               }
+               container.LivenessProbe = t.newLivenessProbe(port, 
t.LivenessProbe)
        }
        if pointer.BoolDeref(t.ReadinessProbeEnabled, true) {
-               container.ReadinessProbe = t.newReadinessProbe(port, 
metadata["defaultReadinessProbePath"])
+               if t.ReadinessProbe == "" {
+                       return fmt.Errorf("you need to configure a readiness 
probe explicitly or in your catalog")
+               }
+               container.ReadinessProbe = t.newReadinessProbe(port, 
t.ReadinessProbe)
        }
        if pointer.BoolDeref(t.StartupProbeEnabled, false) {
-               container.StartupProbe = t.newStartupProbe(port, 
metadata["defaultStartupProbePath"])
+               if t.StartupProbe == "" {
+                       return fmt.Errorf("you need to configure a startup 
probe explicitly or in your catalog")
+               }
+               container.StartupProbe = t.newStartupProbe(port, t.StartupProbe)
        }
-}
 
-// Deprecated: to be removed in future release in favor of func 
setCatalogConfiguration().
-func (t *healthTrait) setDefaultConfiguration(container *corev1.Container, 
port *intstr.IntOrString) {
-       if pointer.BoolDeref(t.LivenessProbeEnabled, false) {
-               container.LivenessProbe = t.newLivenessProbe(port, 
defaultLivenessProbePath)
-       }
-       if pointer.BoolDeref(t.ReadinessProbeEnabled, true) {
-               container.ReadinessProbe = t.newReadinessProbe(port, 
defaultReadinessProbePath)
-       }
-       if pointer.BoolDeref(t.StartupProbeEnabled, false) {
-               container.StartupProbe = t.newStartupProbe(port, 
defaultStartupProbePath)
-       }
+       return nil
 }
 
 func (t *healthTrait) newLivenessProbe(port *intstr.IntOrString, path string) 
*corev1.Probe {
diff --git a/pkg/trait/health_test.go b/pkg/trait/health_test.go
index c9c306856..b22709081 100644
--- a/pkg/trait/health_test.go
+++ b/pkg/trait/health_test.go
@@ -228,3 +228,33 @@ func createNominalHealthTrait(t *testing.T) (*healthTrait, 
*Environment) {
 
        return trait, environment
 }
+
+func TestApplyHealthTraitSyntheticKit(t *testing.T) {
+       enabled := true
+       ht, environment := createNominalHealthTrait(t)
+       // Simulate a synthetic Kit which has not catalog attached
+       environment.CamelCatalog = nil
+       ht.Enabled = &enabled
+       ht.LivenessProbeEnabled = &enabled
+       ht.ReadinessProbeEnabled = &enabled
+       ht.StartupProbeEnabled = &enabled
+       ht.LivenessProbe = "/my-live"
+       ht.ReadinessProbe = "/my-ready"
+       ht.StartupProbe = "/my-startup"
+       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, "/my-live", 
environment.GetIntegrationContainer().LivenessProbe.HTTPGet.Path)
+       assert.Equal(t, corev1.URISchemeHTTP, 
environment.GetIntegrationContainer().StartupProbe.HTTPGet.Scheme)
+       assert.Equal(t, "8080", 
environment.GetIntegrationContainer().StartupProbe.HTTPGet.Port.String())
+       assert.Equal(t, "/my-ready", 
environment.GetIntegrationContainer().ReadinessProbe.HTTPGet.Path)
+       assert.Equal(t, corev1.URISchemeHTTP, 
environment.GetIntegrationContainer().StartupProbe.HTTPGet.Scheme)
+       assert.Equal(t, "8080", 
environment.GetIntegrationContainer().StartupProbe.HTTPGet.Port.String())
+       assert.Equal(t, "/my-startup", 
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())
+}


Reply via email to