You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2025/01/30 17:21:26 UTC

(camel-k) branch release-2.5.x updated: fix(trait): telemetry workaround

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

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


The following commit(s) were added to refs/heads/release-2.5.x by this push:
     new aec3cc23d fix(trait): telemetry workaround
aec3cc23d is described below

commit aec3cc23da2287a77f17680d43f708d16256ea90
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Tue Jan 28 18:42:03 2025 +0100

    fix(trait): telemetry workaround
    
    Closes #6002
---
 pkg/trait/telemetry.go | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/pkg/trait/telemetry.go b/pkg/trait/telemetry.go
index 3eb820e89..cc8fce54b 100644
--- a/pkg/trait/telemetry.go
+++ b/pkg/trait/telemetry.go
@@ -20,6 +20,7 @@ package trait
 import (
 	"fmt"
 
+	"github.com/Masterminds/semver"
 	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 	traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
 	"github.com/apache/camel-k/v2/pkg/trait/discovery"
@@ -123,11 +124,20 @@ func (t *telemetryTrait) Configure(e *Environment) (bool, *TraitCondition, error
 func (t *telemetryTrait) Apply(e *Environment) error {
 	util.StringSliceUniqueAdd(&e.Integration.Status.Capabilities, v1.CapabilityTelemetry)
 
-	// Hack for camel-k-runtime 3.15.0
-	if e.CamelCatalog.CamelCatalogSpec.Runtime.Provider == v1.RuntimeProviderQuarkus &&
-		e.CamelCatalog.CamelCatalogSpec.Runtime.Version == "3.15.0" {
-		t.setRuntimeProviderQuarkus315Properties(e)
-		return nil
+	if e.CamelCatalog.CamelCatalogSpec.Runtime.Provider == v1.RuntimeProviderQuarkus {
+		// Hack for camel-k-runtime >= 3.15.0
+		ck315, err := semver.NewVersion("3.15.0")
+		if err != nil {
+			return err
+		}
+		qv, err := semver.NewVersion(e.CamelCatalog.CamelCatalogSpec.Runtime.Version)
+		if err != nil {
+			return err
+		}
+		if qv.Compare(ck315) >= 0 {
+			t.setRuntimeProviderQuarkus315Properties(e)
+			return nil
+		}
 	}
 	if e.CamelCatalog.Runtime.Capabilities["telemetry"].RuntimeProperties != nil {
 		t.setCatalogConfiguration(e)