Skip to content

Commit

Permalink
feat(trait): ServiceBinding deprecation
Browse files Browse the repository at this point in the history
Closes #5868
  • Loading branch information
squakez committed Sep 27, 2024
1 parent 0866f10 commit 5520f3d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/modules/traits/pages/service-binding.adoc
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/camel/v1/trait/service_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion pkg/trait/service_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion pkg/trait/service_binding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit 5520f3d

Please sign in to comment.