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

Allow configuring whether to allow cross namespaces Brokers configuration references #7455

Conversation

pierDipi
Copy link
Member

@pierDipi pierDipi commented Nov 16, 2023

Instead of always allowing to specify cross namespace configuration references for Broker allow users to configure whether to disallow such references as it might be problematic in multi tenant environments.

Proposed Changes

  • Allow configuring whether to allow cross namespaces Brokers configuration references

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

Allow configuring whether to allow cross namespaces Brokers configuration using the `config-br-defaults` ConfigMap.

For example, to disallow cross namespaces Brokers configuration references cluster wide, the following ConfigMap can be applied:


`
apiVersion: v1
kind: ConfigMap
metadata:
  name: config-br-defaults
  namespace: knative-eventing
  labels:
    app.kubernetes.io/version: devel
    app.kubernetes.io/name: knative-eventing
data:
  # Configures the default for any Broker that does not specify a spec.config or Broker class.
  default-br-config: |
    clusterDefault:
      disallowDifferentNamespaceConfig: true
      # ...
`

Docs

Instead of always allowing to specify cross namespace configuration
references for Broker allow users to configure whether to disallow
such references as it might be problematic in multi tenant
environments.

Signed-off-by: Pierangelo Di Pilato <[email protected]>
Copy link

knative-prow bot commented Nov 16, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pierDipi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 16, 2023
@knative-prow knative-prow bot requested review from aslom and matzew November 16, 2023 11:21
@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 16, 2023
Copy link

codecov bot commented Nov 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (360ec60) 76.72% compared to head (68863a1) 76.75%.
Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7455      +/-   ##
==========================================
+ Coverage   76.72%   76.75%   +0.03%     
==========================================
  Files         253      253              
  Lines       13903    13974      +71     
==========================================
+ Hits        10667    10726      +59     
- Misses       2702     2712      +10     
- Partials      534      536       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that you need to run codegen, also I was wondering - what happens if I have a broker in one namespace ns1, which is allowed to send to other namespaces and it sends to a broker in namespace ns2 which is not allowed to send to other namespaces. What would happen to a reply in that scenario?

Signed-off-by: Pierangelo Di Pilato <[email protected]>
@pierDipi
Copy link
Member Author

pierDipi commented Nov 16, 2023

This configuration is only for control plane configurations isolation, cross namespace data plane communication is still allowed and need to be handled with a service mesh or eventually when OIDC + authorization are implemented since even with disallowing cross reference for sink, users can still use absolute URLs and pass the check on the references for subscriber/reply/sink.

For example, I'd like to disallow using the same underlying Kafka cluster credentials from 2 different namespaces

Copy link
Member

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Nov 16, 2023
@knative-prow knative-prow bot merged commit 32d7dd8 into knative:main Nov 16, 2023
38 of 41 checks passed
pierDipi added a commit to pierDipi/eventing that referenced this pull request Nov 17, 2023
…tion references (knative#7455)

* Allow configuring disallow cross namespaces Brokers configuration ref

Instead of always allowing to specify cross namespace configuration
references for Broker allow users to configure whether to disallow
such references as it might be problematic in multi tenant
environments.

Signed-off-by: Pierangelo Di Pilato <[email protected]>

* Codegen

Signed-off-by: Pierangelo Di Pilato <[email protected]>

---------

Signed-off-by: Pierangelo Di Pilato <[email protected]>
openshift-merge-bot bot pushed a commit to openshift-knative/eventing that referenced this pull request Dec 6, 2023
…tion references (knative#7455) (#426)

* Allow configuring disallow cross namespaces Brokers configuration ref

Instead of always allowing to specify cross namespace configuration
references for Broker allow users to configure whether to disallow
such references as it might be problematic in multi tenant
environments.



* Codegen



---------

Signed-off-by: Pierangelo Di Pilato <[email protected]>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/knative-eventing that referenced this pull request Dec 6, 2023
…tion references (knative#7455)

* Allow configuring disallow cross namespaces Brokers configuration ref

Instead of always allowing to specify cross namespace configuration
references for Broker allow users to configure whether to disallow
such references as it might be problematic in multi tenant
environments.

Signed-off-by: Pierangelo Di Pilato <[email protected]>

* Codegen

Signed-off-by: Pierangelo Di Pilato <[email protected]>

---------

Signed-off-by: Pierangelo Di Pilato <[email protected]>
openshift-merge-bot bot pushed a commit to openshift-knative/eventing that referenced this pull request Jan 30, 2024
…tion references (knative#7455) (#453)

* Allow configuring disallow cross namespaces Brokers configuration ref

Instead of always allowing to specify cross namespace configuration
references for Broker allow users to configure whether to disallow
such references as it might be problematic in multi tenant
environments.



* Codegen



---------

Signed-off-by: Pierangelo Di Pilato <[email protected]>
Co-authored-by: Pierangelo Di Pilato <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants