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

Add a namespace controller for the MT Broker. #2778

Merged
merged 2 commits into from
Mar 19, 2020

Conversation

mattmoor
Copy link
Member

  • 🎁 Add new feature

This adds a namespace controller that creates brokers per namespace without the additional components that are only needed by the single-tenant brokers (ConfigMapProp, RoleBindings, ServiceAccounts).

Since the footprint of the MT Broker is effectively nothing, I've made this version of the controller opt-out vs. opt-in.

/assign @vaikas
/hold

This adds a namespace controller that creates brokers per namespace without the additional components that are only needed by the single-tenant brokers (ConfigMapProp, RoleBindings, ServiceAccounts).

Since the footprint of the MT Broker is effectively nothing, I've made this version of the controller opt-out vs. opt-in.
@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 19, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 19, 2020
@knative-prow-robot knative-prow-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Mar 19, 2020
@mattmoor
Copy link
Member Author

/retest

pkg/reconciler/mtnamespace/namespace.go Outdated Show resolved Hide resolved
pkg/reconciler/mtnamespace/namespace.go Outdated Show resolved Hide resolved
pkg/reconciler/mtnamespace/namespace_test.go Outdated Show resolved Hide resolved
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-eventing-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/mtnamespace/controller.go Do not exist 100.0%
pkg/reconciler/mtnamespace/namespace.go Do not exist 83.8%

@n3wscott
Copy link
Contributor

/lgtm
/approve

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 19, 2020
return err
}

if original.Labels[resources.InjectionLabelKey] == resources.InjectionDisabledLabelValue {
Copy link
Contributor

Choose a reason for hiding this comment

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

So, this means that to opt-out, you have to create the namespace with this label in it which means you can't just do:
kubectl create ns foobar
but have to create the object (or is there a way to do this?)

I'm fine with getting this in as is for now, but perhaps we should use the configmap to control this behaviour for the opt-out as a follow on?
Also, could you add an issue for adding the docs for this feature?

Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I don't see an option to label namespaces in kubectl create ns foo. I think if we were going to go the ConfigMap route we'd want consistency with ST Broker. Env vars seem to be popular for configuring this.

How about making the default behavior configurable via DEFAULT_BROKER_INJECTION and having the two reconcilers default it differently?

re: docs

I'm happy to follow up with a PR after this lands. I was thinking we'd fold the "enable" tab into the ST Broker instructions, and combine this with the MT Broker instructions. I'll start on that and we can discuss there?

Copy link
Member Author

Choose a reason for hiding this comment

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

mattmoor added a commit to mattmoor/docs that referenced this pull request Mar 19, 2020
@vaikas
Copy link
Contributor

vaikas commented Mar 19, 2020

/lgtm
/approve

I'll clean up a few things in a followup.

@mattmoor
Copy link
Member Author

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 19, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor, n3wscott, vaikas

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

@mattmoor
Copy link
Member Author

/retest

@vaikas
Copy link
Contributor

vaikas commented Mar 19, 2020

/test pull-knative-eventing-integration-tests

retrying after the #2786 went in.

@vaikas
Copy link
Contributor

vaikas commented Mar 19, 2020

/test pull-knative-eventing-unit-tests

@knative-prow-robot knative-prow-robot merged commit fefe3c2 into knative:master Mar 19, 2020
@matzew
Copy link
Member

matzew commented Apr 2, 2020

Sorry, that I am late here, but ...

k get broker --all-namespaces
NAMESPACE          NAME      READY   REASON   URL                                                                                 AGE
default            default   True             http://broker-ingress.knative-eventing.svc.cluster.local/default/default            6m4s
fooooo             default   True             http://broker-ingress.knative-eventing.svc.cluster.local/fooooo/default             3s
knative-eventing   default   True             http://broker-ingress.knative-eventing.svc.cluster.local/knative-eventing/default   6m4s
knative-serving    default   True             http://broker-ingress.knative-eventing.svc.cluster.local/knative-serving/default    6m4s
kourier-system     default   True             http://broker-ingress.knative-eventing.svc.cluster.local/kourier-system/default     6m4s
kube-node-lease    default   True             http://broker-ingress.knative-eventing.svc.cluster.local/kube-node-lease/default    6m2s
kube-public        default   True             http://broker-ingress.knative-eventing.svc.cluster.local/kube-public/default        6m4s
kube-system        default   True             http://broker-ingress.knative-eventing.svc.cluster.local/kube-system/default        6m4s

@mattmoor Is that really really needed ? Not sure 🤔

@matzew
Copy link
Member

matzew commented Apr 2, 2020

reminds me a bit of the sinkbinding webhook, that goes to all deployments etc, on all namespaces.

IMO bad default ...

@lionelvillard
Copy link
Member

I do feel the same

@mattmoor
Copy link
Member Author

mattmoor commented Apr 2, 2020

Let's pick one place to discuss this, perhaps: knative/docs#2325?

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. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants