nicolaferraro commented on a change in pull request #1952:
URL: https://github.com/apache/camel-k/pull/1952#discussion_r565935499



##########
File path: pkg/controller/integration/platform_setup.go
##########
@@ -46,7 +46,8 @@ func (action *platformSetupAction) Name() string {
 // CanHandle tells whether this action can handle the integration
 func (action *platformSetupAction) CanHandle(integration *v1.Integration) bool 
{
        return integration.Status.Phase == v1.IntegrationPhaseNone ||
-               integration.Status.Phase == 
v1.IntegrationPhaseWaitingForPlatform
+               integration.Status.Phase == 
v1.IntegrationPhaseWaitingForPlatform ||
+               integration.Status.Phase == 
v1.IntegrationPhaseWaitingForServiceBindingCollectionReady

Review comment:
       Is this needed? I think it does not do anything related.

##########
File path: pkg/controller/integration/integration_controller.go
##########
@@ -217,6 +218,15 @@ func add(mgr manager.Manager, r reconcile.Reconciler) 
error {
                return err
        }
 
+       // Watch ServiceBindings created
+       err = c.Watch(&source.Kind{Type: &sb.ServiceBinding{}}, 
&handler.EnqueueRequestForOwner{

Review comment:
       I think this may cause issues in case the `ServiceBinding` resource is 
not present in the cluster (or not yet present when the Camel K operator is 
installed). We have a similar issue with Knative where we ended up watching the 
`ReplicaSet` instead of specific Knative resources (right @astefanutti ?). Is 
there a child standard resource that we can watch?

##########
File path: pkg/trait/service_binding.go
##########
@@ -0,0 +1,266 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package trait
+
+import (
+       "fmt"
+       "strings"
+
+       v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+       sb 
"github.com/redhat-developer/service-binding-operator/pkg/apis/operators/v1alpha1"
+       corev1 "k8s.io/api/core/v1"
+       k8serrors "k8s.io/apimachinery/pkg/api/errors"
+       metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+       k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
+)
+
+// The Service Binding trait allows users to connect to Provisioned Services 
and ServiceBindings 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
+type serviceBindingTrait struct {
+       BaseTrait `property:",squash"`
+       // List of Provisioned Services and ServiceBindings in the form 
KIND.VERSION.GROUP/NAME[/NAMESPACE]
+       ServiceBindings []string `property:"service-bindings" 
json:"serviceBindings,omitempty"`
+}
+
+func newServiceBindingTrait() Trait {
+       return &serviceBindingTrait{
+               BaseTrait: NewBaseTrait("service-binding", 250),
+       }
+}
+
+// IsAllowedInProfile overrides default
+func (t *serviceBindingTrait) IsAllowedInProfile(profile v1.TraitProfile) bool 
{
+       return profile == v1.TraitProfileKubernetes ||
+               profile == v1.TraitProfileOpenShift

Review comment:
       Is there a reason why the 3rd profile is excluded (Knative)?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to