Skip to content

Commit

Permalink
chore: name the ServiceBinding simply to the integration name
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpoth authored and astefanutti committed Mar 5, 2021
1 parent aeb0857 commit 8853ffe
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/trait/service_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (t *serviceBindingTrait) Configure(e *Environment) (bool, error) {
}

func (t *serviceBindingTrait) Apply(e *Environment) error {
integrationServiceBindingName := e.Integration.Name + "-service-binding-request"
services, err := t.parseProvisionedServices(e)
if err != nil {
return err
Expand All @@ -76,19 +75,19 @@ func (t *serviceBindingTrait) Apply(e *Environment) error {
return err
}
if len(services) > 0 {
serviceBindings = append(serviceBindings, integrationServiceBindingName)
serviceBindings = append(serviceBindings, e.Integration.Name)
}
if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
serviceBindingsCollectionReady := true
for _, name := range serviceBindings {
isIntSB := name == integrationServiceBindingName
isIntSB := name == e.Integration.Name
serviceBinding, err := t.getServiceBinding(e, name)
// Do not throw an error if the ServiceBinding is not found and if we are managing it: we will create it
if (err != nil && !k8serrors.IsNotFound(err)) || (err != nil && !isIntSB) {
return err
}
if isIntSB {
request := createServiceBinding(e, services, integrationServiceBindingName)
request := createServiceBinding(e, services, e.Integration.Name)
e.Resources.Add(&request)
}
if isCollectionReady(serviceBinding) {
Expand Down Expand Up @@ -134,8 +133,8 @@ func (t *serviceBindingTrait) Apply(e *Environment) error {
return nil
}
e.ServiceBindings[name] = sb.Status.Secret
if name == integrationServiceBindingName {
request := createServiceBinding(e, services, integrationServiceBindingName)
if name == e.Integration.Name {
request := createServiceBinding(e, services, e.Integration.Name)
e.Resources.Add(&request)
}
}
Expand Down

0 comments on commit 8853ffe

Please sign in to comment.