This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit cfa0f7fa58ec33d4283cea064665f11f249946b4
Author: Antonin Stefanutti <anto...@stefanutti.fr>
AuthorDate: Wed Feb 10 12:38:32 2021 +0100

    chore: Improve ServiceBinding watch error handling
---
 pkg/controller/integration/integration_controller.go | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pkg/controller/integration/integration_controller.go 
b/pkg/controller/integration/integration_controller.go
index 52cae9d..4708aa8 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -221,16 +221,16 @@ func add(mgr manager.Manager, r reconcile.Reconciler, c 
client.Client) error {
                return err
        }
 
-
        // Check the ServiceBinding CRD is present
-       if ok, err := kubernetes.IsAPIResourceInstalled(c, 
"operators.coreos.com/v1alpha1", reflect.TypeOf(sb.ServiceBinding{}).Name()); 
err != nil {
+       serviceBindingKind := reflect.TypeOf(sb.ServiceBinding{}).Name()
+       if ok, err := kubernetes.IsAPIResourceInstalled(c, 
sb.SchemeGroupVersion.String(), serviceBindingKind); err != nil {
                return err
        } else if !ok {
                log.Info("Service binding is disabled, install the Service 
Binding Operator if needed")
-       } else if ok, err := kubernetes.CheckPermission(context.TODO(), c, 
"operators.coreos.com", "ServiceBinding", "", "", "create"); err != nil {
-               log.Error(err, "cannot check permissions for watching 
ServiceBindings")
+       } else if ok, err := kubernetes.CheckPermission(context.TODO(), c, 
sb.SchemeGroupVersion.Group, serviceBindingKind, "", "", "create"); err != nil {
+               return err
        } else if !ok {
-               log.Info("ServiceBinding monitoring is disabled, install 
Service Binding Operator before camel-k if needed")
+               log.Info("Service binding is disabled, the operator is not 
granted permission to create ServiceBindings!")
        } else {
                // Watch ServiceBindings and enqueue owning Integrations
                err = ctrl.Watch(&source.Kind{Type: &sb.ServiceBinding{}}, 
&handler.EnqueueRequestForOwner{

Reply via email to