Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RBAC missing permissions for channels and inmemorychannels in messaging.knative.dev #3390

Closed
christophd opened this issue Jun 23, 2022 · 6 comments · Fixed by #3400
Closed

Comments

@christophd
Copy link
Contributor

The Camel K operator has lost the permission to get/list and manage channels/inmemorychannels in messaging.knative.dev group. This causes the knative trait to raise permission errors when binding a Kamelet to channels/inmemorychannels for instance.

To reproduce add a KameletBinding that makes use of a Knative channel.

apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: message-event-sink
spec:
  source:
    ref:
      kind: Channel
      apiVersion: messaging.knative.dev/v1
      name: messages
  sink:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1alpha1
      name: log-sink

This will result in errors in Camel K operator logs and the KameletBinding is stuck in "Creating" phase.

{"level":"error","ts":1655995698.9808981,"logger":"controller.integration-controller","msg":"Reconciler error","reconciler group":"camel.apache.org","reconciler kind":"Integration","name":"prize-event-sink","namespace":"yaks-demo","error":"error during trait customization: unexpected error while executing handler for channel prize-channel: cannot determine address of channel prize-channel: channels.messaging.knative.dev \"prize-channel\" is forbidden: User \"system:serviceaccount:openshift-operators:camel-k-operator\" cannot get resource \"channels\" in API group \"messaging.knative.dev\" in the namespace \"yaks-demo\"","errorVerbose":"channels.messaging.knative.dev \"prize-channel\" is forbidden: User \"system:serviceaccount:openshift-operators:camel-k-operator\" cannot get resource \"channels\" in API group \"messaging.knative.dev\" in the namespace \"yaks-demo\"\ncannot determine address of channel prize-channel\ngithub.com/apache/camel-k/pkg/trait.(*knativeTrait).withServiceDo.func1\n\tgithub.com/apach...
christophd added a commit to christophd/camel-k that referenced this issue Jun 23, 2022
- Kamelet bindings connecting with Knative channels/inmemorychannels as source/sink do require this permission
@phantomjinx
Copy link
Contributor

Fixed in #3382

@astefanutti
Copy link
Member

Possible duplicate of #3328.

@christophd
Copy link
Contributor Author

I think the addressable changes do apply for Knative channels as a sink. I was using the channel as a source in the KameletBinding. Does that make a difference?

@astefanutti
Copy link
Member

I think #2958 should apply whether a Knative Addressable to be resolved is used as a sink or source.

@christophd
Copy link
Contributor Author

christophd commented Jun 27, 2022

@astefanutti I can see {"level":"info","ts":1656322558.1037383,"logger":"cmd","msg":"Cannot bind the Knative Addressable resolver aggregated ClusterRole: skipping."} in my operator logs. So that is why the camel-k specific addressable-resolver cluster role binding is not present on my cluster.

Need to find out what that exact problem is here

@christophd
Copy link
Contributor Author

I have found the root cause with the Knative addressable-resolver cluster role binding.

{"level":"debug","ts":1656354670.720523,"logger":"camel-k.cmd","msg":"Error while binding the Knative Addressable resolver aggregated ClusterRole","error":"ClusterRoleBinding.rbac.authorization.k8s.io \"camel-k-operator-addressable-resolver\" is invalid: subjects[0].namespace: Required value"}

Only global operators hit that problem because the empty operator watch namespace was used in the service account subject while creating the cluster role binding (https://github.com/apache/camel-k/blob/main/pkg/install/knative.go#L73).

christophd added a commit to christophd/camel-k that referenced this issue Jun 27, 2022
…ng in global operator mode

Use proper operator namespace in the service account role binding subject for global operators. Was using empty global operator watch namespace before which caused errors in the cluster role binding.
christophd added a commit to christophd/camel-k that referenced this issue Jun 28, 2022
…ng in global operator mode

Use proper operator namespace in the service account role binding subject for global operators. Was using empty global operator watch namespace before which caused errors in the cluster role binding.
christophd added a commit to christophd/camel-k that referenced this issue Jun 30, 2022
…ng in global operator mode

Use proper operator namespace in the service account role binding subject for global operators. Was using empty global operator watch namespace before which caused errors in the cluster role binding.
oscerd pushed a commit that referenced this issue Jul 1, 2022
…global operator mode

Use proper operator namespace in the service account role binding subject for global operators. Was using empty global operator watch namespace before which caused errors in the cluster role binding.
christophd added a commit to christophd/camel-k that referenced this issue Jul 6, 2022
…ng in global operator mode

Use proper operator namespace in the service account role binding subject for global operators. Was using empty global operator watch namespace before which caused errors in the cluster role binding.

(cherry picked from commit 2ffdcfa)
tadayosi pushed a commit that referenced this issue Jul 8, 2022
…global operator mode

Use proper operator namespace in the service account role binding subject for global operators. Was using empty global operator watch namespace before which caused errors in the cluster role binding.

(cherry picked from commit 2ffdcfa)
claudio4j pushed a commit to claudio4j/camel-k that referenced this issue Aug 10, 2022
…ng in global operator mode

Use proper operator namespace in the service account role binding subject for global operators. Was using empty global operator watch namespace before which caused errors in the cluster role binding.

(cherry picked from commit 2ffdcfa)
squakez pushed a commit to jboss-fuse/camel-k that referenced this issue Aug 11, 2022
…ng in global operator mode

Use proper operator namespace in the service account role binding subject for global operators. Was using empty global operator watch namespace before which caused errors in the cluster role binding.

(cherry picked from commit 2ffdcfa)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants