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
The following commit(s) were added to refs/heads/main by this push:
new b36123ba4 feat(trait): ServiceBinding deprecation
b36123ba4 is described below
commit b36123ba47305960f780dde3678f52c31d74f32d
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Fri Sep 27 07:19:50 2024 +0200
feat(trait): ServiceBinding deprecation
Closes #5868
---
docs/modules/traits/pages/service-binding.adoc | 1 +
pkg/apis/camel/v1/trait/service_binding.go | 4 ++++
pkg/trait/service_binding.go | 14 +++++++++++++-
pkg/trait/service_binding_test.go | 4 +++-
4 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/docs/modules/traits/pages/service-binding.adoc
b/docs/modules/traits/pages/service-binding.adoc
index 73582ad98..7ae2879ad 100755
--- a/docs/modules/traits/pages/service-binding.adoc
+++ b/docs/modules/traits/pages/service-binding.adoc
@@ -1,6 +1,7 @@
= Service Binding Trait
// Start of autogenerated code - DO NOT EDIT! (badges)
+image:https://img.shields.io/badge/2.5.0-white?label=Deprecated&labelColor=C40C0C&color=gray[Deprecated
Badge]
// End of autogenerated code - DO NOT EDIT! (badges)
// Start of autogenerated code - DO NOT EDIT! (description)
The Service Binding trait allows users to connect to Services in Kubernetes:
diff --git a/pkg/apis/camel/v1/trait/service_binding.go
b/pkg/apis/camel/v1/trait/service_binding.go
index 97e758fe4..82aff8e01 100644
--- a/pkg/apis/camel/v1/trait/service_binding.go
+++ b/pkg/apis/camel/v1/trait/service_binding.go
@@ -17,11 +17,15 @@ limitations under the License.
package trait
+// WARNING: The Registry trait is **deprecated** and will removed in future
release versions.
+//
+
// The Service Binding trait allows users to connect to Services in Kubernetes:
// https://github.com/k8s-service-bindings/spec#service-binding
// As the specification is still evolving this is subject to change.
//
// +camel-k:trait=service-binding.
+// +camel-k:deprecated=2.5.0.
type ServiceBindingTrait struct {
Trait `property:",squash" json:",inline"`
// List of Services in the form
[[apigroup/]version:]kind:[namespace/]name
diff --git a/pkg/trait/service_binding.go b/pkg/trait/service_binding.go
index b8fd4ba45..def9c6d62 100644
--- a/pkg/trait/service_binding.go
+++ b/pkg/trait/service_binding.go
@@ -78,7 +78,19 @@ func (t *serviceBindingTrait) Configure(e *Environment)
(bool, *TraitCondition,
return false, nil, nil
}
- return e.IntegrationInPhase(v1.IntegrationPhaseInitialization) ||
e.IntegrationInRunningPhases(), nil, nil
+ var condition *TraitCondition
+ enabled := e.IntegrationInPhase(v1.IntegrationPhaseInitialization) ||
e.IntegrationInRunningPhases()
+ if enabled {
+ condition = NewIntegrationCondition(
+ "ServiceBinding",
+ v1.IntegrationConditionTraitInfo,
+ corev1.ConditionTrue,
+ traitConfigurationReason,
+ "ServiceBinding trait is deprecated as the Service
Binding Operator is no longer supported. It may be removed in future version.",
+ )
+ }
+
+ return enabled, condition, nil
}
func (t *serviceBindingTrait) Apply(e *Environment) error {
diff --git a/pkg/trait/service_binding_test.go
b/pkg/trait/service_binding_test.go
index 81831d0f1..545b38b0b 100644
--- a/pkg/trait/service_binding_test.go
+++ b/pkg/trait/service_binding_test.go
@@ -39,7 +39,9 @@ func TestServiceBinding(t *testing.T) {
assert.True(t, configured)
require.NoError(t, err)
- assert.Nil(t, condition)
+ assert.NotNil(t, condition)
+ assert.Equal(t, "ServiceBinding trait is deprecated as the Service
Binding Operator is no longer supported. It may be removed in future version.",
+ condition.message)
// Required for local testing purposes only
handlers = []pipeline.Handler{}