You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/02/10 17:30:25 UTC

[camel-k] branch master updated (cfa0f7f -> 7743ca2)

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

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


    from cfa0f7f  chore: Improve ServiceBinding watch error handling
     new 5196188  fix: Resource name must be used instead of kind for SelfSubjectAccessReview request
     new 7743ca2  fix: The SAR request for ServiceBinding creation must be scoped to the operator watch namespace

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pkg/controller/integration/integration_controller.go | 5 ++---
 pkg/platform/operator.go                             | 8 ++++++++
 2 files changed, 10 insertions(+), 3 deletions(-)


[camel-k] 01/02: fix: Resource name must be used instead of kind for SelfSubjectAccessReview request

Posted by as...@apache.org.
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 5196188c8ffa85b148013b16b20550328f422393
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed Feb 10 16:44:15 2021 +0100

    fix: Resource name must be used instead of kind for SelfSubjectAccessReview request
---
 pkg/controller/integration/integration_controller.go | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/pkg/controller/integration/integration_controller.go b/pkg/controller/integration/integration_controller.go
index 4708aa8..08307c2 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -222,12 +222,11 @@ func add(mgr manager.Manager, r reconcile.Reconciler, c client.Client) error {
 	}
 
 	// Check the ServiceBinding CRD is present
-	serviceBindingKind := reflect.TypeOf(sb.ServiceBinding{}).Name()
-	if ok, err := kubernetes.IsAPIResourceInstalled(c, sb.SchemeGroupVersion.String(), serviceBindingKind); err != nil {
+	if ok, err := kubernetes.IsAPIResourceInstalled(c, sb.SchemeGroupVersion.String(), reflect.TypeOf(sb.ServiceBinding{}).Name()); 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, sb.SchemeGroupVersion.Group, serviceBindingKind, "", "", "create"); err != nil {
+	} else if ok, err := kubernetes.CheckPermission(context.TODO(), c, sb.SchemeGroupVersion.Group, "servicebindings", "", "", "create"); err != nil {
 		return err
 	} else if !ok {
 		log.Info("Service binding is disabled, the operator is not granted permission to create ServiceBindings!")


[camel-k] 02/02: fix: The SAR request for ServiceBinding creation must be scoped to the operator watch namespace

Posted by as...@apache.org.
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 7743ca2fd0ef1d75e60098b413994c6115ac8f1b
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed Feb 10 16:54:20 2021 +0100

    fix: The SAR request for ServiceBinding creation must be scoped to the operator watch namespace
---
 pkg/controller/integration/integration_controller.go | 2 +-
 pkg/platform/operator.go                             | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/pkg/controller/integration/integration_controller.go b/pkg/controller/integration/integration_controller.go
index 08307c2..e4a7335 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -226,7 +226,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler, c client.Client) error {
 		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, sb.SchemeGroupVersion.Group, "servicebindings", "", "", "create"); err != nil {
+	} else if ok, err := kubernetes.CheckPermission(context.TODO(), c, sb.SchemeGroupVersion.Group, "servicebindings", platform.GetOperatorWatchNamespace(), "", "create"); err != nil {
 		return err
 	} else if !ok {
 		log.Info("Service binding is disabled, the operator is not granted permission to create ServiceBindings!")
diff --git a/pkg/platform/operator.go b/pkg/platform/operator.go
index d0ff38b..05538a9 100644
--- a/pkg/platform/operator.go
+++ b/pkg/platform/operator.go
@@ -67,6 +67,14 @@ func IsCurrentOperatorGlobal() bool {
 	return false
 }
 
+// GetOperatorWatchNamespace returns the namespace the operator watches
+func GetOperatorWatchNamespace() string {
+	if namespace, envSet := os.LookupEnv(operatorWatchNamespaceEnvVariable); envSet {
+		return namespace
+	}
+	return ""
+}
+
 // GetOperatorNamespace returns the namespace where the current operator is located (if set)
 func GetOperatorNamespace() string {
 	if podNamespace, envSet := os.LookupEnv(operatorNamespaceEnvVariable); envSet {