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 fdbacc5ad92502ff70574a83ca5668cec9a15877
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Fri Oct 25 07:42:12 2024 +0200

    feat(trait): deprecate 3 scale
---
 addons/threescale/3scale.go      | 15 ++++++++++++++-
 addons/threescale/3scale_test.go |  4 ++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/addons/threescale/3scale.go b/addons/threescale/3scale.go
index 54750c337..d15faa09f 100644
--- a/addons/threescale/3scale.go
+++ b/addons/threescale/3scale.go
@@ -20,6 +20,7 @@ package threescale
 import (
        "strconv"
 
+       corev1 "k8s.io/api/core/v1"
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
        "k8s.io/utils/ptr"
 
@@ -33,7 +34,10 @@ import (
 //
 // The 3scale trait is disabled by default.
 //
+// WARNING: The trait is **deprecated** and will removed in future release 
versions: configure directly the Camel properties as required by the component 
instead.
+//
 // +camel-k:trait=3scale.
+// +camel-k:deprecated=2.5.0.
 type Trait struct {
        traitv1.Trait `property:",squash" json:",inline"`
        // Enables automatic configuration of the trait.
@@ -95,6 +99,15 @@ func (t *threeScaleTrait) Configure(e *trait.Environment) 
(bool, *trait.TraitCon
                return false, nil, nil
        }
 
+       condition := trait.NewIntegrationCondition(
+               "3Scale",
+               v1.IntegrationConditionTraitInfo,
+               corev1.ConditionTrue,
+               trait.TraitConfigurationReason,
+               "3Scale trait is deprecated and may be removed in future 
version: "+
+                       "use service trait to add 3Scale labels and annotations 
instead",
+       )
+
        if ptr.Deref(t.Auto, true) {
                if t.Scheme == "" {
                        t.Scheme = ThreeScaleSchemeDefaultValue
@@ -111,7 +124,7 @@ func (t *threeScaleTrait) Configure(e *trait.Environment) 
(bool, *trait.TraitCon
                }
        }
 
-       return true, nil, nil
+       return true, condition, nil
 }
 
 func (t *threeScaleTrait) Apply(e *trait.Environment) error {
diff --git a/addons/threescale/3scale_test.go b/addons/threescale/3scale_test.go
index 4aba8fdce..0954e2745 100644
--- a/addons/threescale/3scale_test.go
+++ b/addons/threescale/3scale_test.go
@@ -54,7 +54,7 @@ func TestThreeScaleInjection(t *testing.T) {
        ok, condition, err := threeScale.Configure(e)
        require.NoError(t, err)
        assert.True(t, ok)
-       assert.Nil(t, condition)
+       assert.NotNil(t, condition)
 
        err = threeScale.Apply(e)
        require.NoError(t, err)
@@ -75,7 +75,7 @@ func TestThreeScaleInjectionNoAPIPath(t *testing.T) {
        ok, condition, err := threeScale.Configure(e)
        require.NoError(t, err)
        assert.True(t, ok)
-       assert.Nil(t, condition)
+       assert.NotNil(t, condition)
 
        err = threeScale.Apply(e)
        require.NoError(t, err)

Reply via email to