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

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

commit 7047e12e6abbac37e9e6a1582188ad2874ea453f
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                                | 73 ++++++++++++++--------
 pkg/trait/health_test.go                           | 30 +++++++++
 15 files changed, 283 insertions(+), 27 deletions(-)

diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc 
b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index bdbf00995..b11fe645a 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -6980,6 +6980,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
 |
@@ -7029,6 +7036,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
 |
@@ -7078,6 +7092,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 1f4402508..79dbd3fb7 100755
--- a/docs/modules/traits/pages/health.adoc
+++ b/docs/modules/traits/pages/health.adoc
@@ -55,6 +55,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`).
@@ -83,6 +87,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`).
@@ -111,6 +119,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 7e7668d38..226dc17da 100644
--- a/helm/camel-k/crds/crd-integration-platform.yaml
+++ b/helm/camel-k/crds/crd-integration-platform.yaml
@@ -992,6 +992,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`).
@@ -1024,6 +1028,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`).
@@ -1056,6 +1064,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`).
@@ -2903,6 +2915,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`).
@@ -2935,6 +2951,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`).
@@ -2967,6 +2987,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 f78210e5c..411ccafa5 100644
--- a/helm/camel-k/crds/crd-integration-profile.yaml
+++ b/helm/camel-k/crds/crd-integration-profile.yaml
@@ -869,6 +869,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`).
@@ -901,6 +905,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`).
@@ -933,6 +941,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`).
@@ -2663,6 +2675,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`).
@@ -2695,6 +2711,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`).
@@ -2727,6 +2747,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 e96e1006e..35224b34d 100644
--- a/helm/camel-k/crds/crd-integration.yaml
+++ b/helm/camel-k/crds/crd-integration.yaml
@@ -6888,6 +6888,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`).
@@ -6920,6 +6924,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`).
@@ -6952,6 +6960,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 63407d267..79670e9de 100644
--- a/helm/camel-k/crds/crd-kamelet-binding.yaml
+++ b/helm/camel-k/crds/crd-kamelet-binding.yaml
@@ -7176,6 +7176,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`).
@@ -7208,6 +7212,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`).
@@ -7240,6 +7248,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 8a3edf340..e7f2a58b8 100644
--- a/helm/camel-k/crds/crd-pipe.yaml
+++ b/helm/camel-k/crds/crd-pipe.yaml
@@ -7174,6 +7174,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`).
@@ -7206,6 +7210,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`).
@@ -7238,6 +7246,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 587249afe..659b86ab3 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 7e7668d38..226dc17da 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -992,6 +992,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`).
@@ -1024,6 +1028,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`).
@@ -1056,6 +1064,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`).
@@ -2903,6 +2915,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`).
@@ -2935,6 +2951,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`).
@@ -2967,6 +2987,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 f78210e5c..411ccafa5 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
@@ -869,6 +869,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`).
@@ -901,6 +905,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`).
@@ -933,6 +941,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`).
@@ -2663,6 +2675,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`).
@@ -2695,6 +2711,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`).
@@ -2727,6 +2747,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 e96e1006e..35224b34d 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
@@ -6888,6 +6888,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`).
@@ -6920,6 +6924,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`).
@@ -6952,6 +6960,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 63407d267..79670e9de 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_kameletbindings.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_kameletbindings.yaml
@@ -7176,6 +7176,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`).
@@ -7208,6 +7212,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`).
@@ -7240,6 +7248,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 8a3edf340..e7f2a58b8 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
@@ -7174,6 +7174,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`).
@@ -7206,6 +7210,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`).
@@ -7238,6 +7246,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 c1a3e8b9c..0a05fe724 100644
--- a/pkg/trait/health.go
+++ b/pkg/trait/health.go
@@ -53,20 +53,47 @@ 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
        }
        if !pointer.BoolDeref(t.Enabled, false) {
                return 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 {
        if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
                if capability, ok := 
e.CamelCatalog.Runtime.Capabilities[v1.CapabilityHealth]; ok {
@@ -96,38 +123,30 @@ func (t *healthTrait) Apply(e *Environment) error {
        p := intstr.FromInt(int(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 1de406671..599b24fa6 100644
--- a/pkg/trait/health_test.go
+++ b/pkg/trait/health_test.go
@@ -118,3 +118,33 @@ func TestHealthTrait(t *testing.T) {
        assert.Equal(t, "/q/health/started", 
d.Spec.Template.Spec.Containers[0].StartupProbe.HTTPGet.Path)
 
 }
+
+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