pedjak commented on a change in pull request #2627: URL: https://github.com/apache/camel-k/pull/2627#discussion_r708195684
########## File path: pkg/trait/service_binding.go ########## @@ -53,137 +54,65 @@ func (t *serviceBindingTrait) Configure(e *Environment) (bool, error) { return false, nil } - if len(t.ServiceBindings) == 0 { + if len(t.Services) == 0 { return false, nil } return e.IntegrationInPhase( v1.IntegrationPhaseInitialization, - v1.IntegrationPhaseWaitingForBindings, v1.IntegrationPhaseDeploying, v1.IntegrationPhaseRunning, ), nil } func (t *serviceBindingTrait) Apply(e *Environment) error { - services, err := t.parseProvisionedServices(e) + ctx, err := t.getContext(e) if err != nil { return err } - serviceBindings, err := t.parseServiceBindings(e) + // let the SBO retry policy be controlled by Camel-k + err = process(ctx, getHandlers()) if err != nil { return err } - if len(services) > 0 { - serviceBindings = append(serviceBindings, e.Integration.Name) - } - if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) { - serviceBindingsCollectionReady := true - for _, name := range serviceBindings { - 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, e.Integration.Name) - e.Resources.Add(&request) - } - if isCollectionReady(serviceBinding) { - setCollectionReady(e, name, corev1.ConditionTrue) - } else { - setCollectionReady(e, name, corev1.ConditionFalse) - serviceBindingsCollectionReady = false - } - } - if !serviceBindingsCollectionReady { - e.PostProcessors = append(e.PostProcessors, func(environment *Environment) error { - e.Integration.Status.Phase = v1.IntegrationPhaseWaitingForBindings - return nil - }) - } - return nil - } else if e.IntegrationInPhase(v1.IntegrationPhaseWaitingForBindings) { - for _, name := range serviceBindings { - serviceBinding, err := t.getServiceBinding(e, name) - if err != nil { - return err - } - if isCollectionReady(serviceBinding) { - setCollectionReady(e, name, corev1.ConditionTrue) - } else { - setCollectionReady(e, name, corev1.ConditionFalse) - return nil - } - if name == e.Integration.Name { - request := createServiceBinding(e, services, name) - e.Resources.Add(&request) - } - } - } else if e.IntegrationInPhase(v1.IntegrationPhaseDeploying, v1.IntegrationPhaseRunning) { - e.ServiceBindings = make(map[string]string) - for _, name := range serviceBindings { - sb, err := t.getServiceBinding(e, name) - if err != nil { - return err - } - if !isCollectionReady(sb) { - setCollectionReady(e, name, corev1.ConditionFalse) - e.PostProcessors = append(e.PostProcessors, func(environment *Environment) error { - e.Integration.Status.Phase = v1.IntegrationPhaseWaitingForBindings - return nil - }) - return nil - } - e.ServiceBindings[name] = sb.Status.Secret - if name == e.Integration.Name { - request := createServiceBinding(e, services, name) - e.Resources.Add(&request) - } - } + + secret := createSecret(ctx, e.Integration.Namespace) + if secret != nil { Review comment: what is the reason for not injecting binding through SBO default pipeline? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org