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

first cut at multi-tenant broker #2760

Merged
merged 13 commits into from
Mar 18, 2020
Merged

Conversation

vaikas
Copy link
Contributor

@vaikas vaikas commented Mar 17, 2020

Fixes #

Introduce a Multi Tenant Channel Based Broker that shares the running pieces of the code in knative-eventing namespace, instead of in the brokers namespace to make it easier, cheaper and simpler to operate brokers.
This uses a MTChannelBasedBroker class, and is not installed out of the box, so totes won't affect any existing code unless you want to play with it.

Proposed Changes

Release Note

- 🎁 Add new feature
Add multi tenant channel based broker.

Docs

@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 17, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 17, 2020
@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 17, 2020
@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 17, 2020
configMapWatcher.Watch(loggingConfigMapName, logging.UpdateLevelFromConfigMap(sl, atomicLevel, component))

bin := tracing.BrokerIngressName(tracing.BrokerIngressNameArgs{
Namespace: "knative-eventing",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Namespace: "knative-eventing",
Namespace: system.Namespace(),

@@ -0,0 +1,64 @@
# Copyright 2020 The Knative Authors
Copy link
Member

Choose a reason for hiding this comment

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

These should all go under ./brokers/mt-channel-broker

configMapWatcher.Watch(loggingConfigMapName, logging.UpdateLevelFromConfigMap(sl, atomicLevel, component))

bin := tracing.BrokerFilterName(tracing.BrokerFilterNameArgs{
Namespace: env.Namespace,
Copy link
Member

Choose a reason for hiding this comment

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

This is the only use of Namespace, is this MT yet? Could it be system.Namespace() and drop that field?

// TODO(vaikas): Can we just add this into the controller as part of the filtering
// so they won't even get queued into my queue???
if r.brokerClass != "" {
if b.GetAnnotations()[eventing.BrokerClassKey] != r.brokerClass {
Copy link
Member

Choose a reason for hiding this comment

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

Didn't the current broker just drop this logic?

triggerLister: triggerInformer.Lister(),
brokerClass: env.BrokerClass,
}
impl := brokerreconciler.NewImpl(ctx, r)
Copy link
Member

Choose a reason for hiding this comment

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

I believe this needs to pass ClassName

b.Status.MarkFilterFailed("DeploymentFailure", "%v", err)
return err
}
b.Status.PropagateFilterDeploymentAvailability(filterDeployment)
Copy link
Member

Choose a reason for hiding this comment

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

This assumes a particular anatomy, which isn't particularly flexible. Given that all you really care about is whether the network endpoint is "ready", I would change this (and the same below) to examine the Endpoints resources for non-empty addresses.

This approach should also be portable to the single-tenant Broker, and is actually (very slightly) more correct because even if the Deployment is "ready" it doesn't necessarily follow that the Endpoints have observed that and been updated to reflect it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack yes +1, just kept the existing behaviour for now as discussed offline :) I'll port your changes here.

Copy link
Member

Choose a reason for hiding this comment

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

Just to close the loop: #2766

mattmoor added a commit to mattmoor/eventing that referenced this pull request Mar 17, 2020
Today the fact that the Broker lifecycle stuff propagates *Deployment* status for filter/ingress leaks implementation details into the API types.  An example of where this leakage is bas would be if I were to run a multi-tenant broker (knative#2760) as something other than a Deployment.

This change corrects one small part of this leaky interface by shifting from Deployment to Endpoints as the canonical resource for establishing readiness.

This is also slightly more correct as it assesses not just whether the Deployment is ready, but whether that information has propagated to the Service / Endpoints.
mattmoor added a commit to mattmoor/eventing that referenced this pull request Mar 17, 2020
Today the fact that the Broker lifecycle stuff propagates *Deployment* status for filter/ingress leaks implementation details into the API types.  An example of where this leakage is bas would be if I were to run a multi-tenant broker (knative#2760) as something other than a Deployment.

This change corrects one small part of this leaky interface by shifting from Deployment to Endpoints as the canonical resource for establishing readiness.

This is also slightly more correct as it assesses not just whether the Deployment is ready, but whether that information has propagated to the Service / Endpoints.
@vaikas vaikas marked this pull request as ready for review March 18, 2020 00:10
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 18, 2020
@mattmoor
Copy link
Member

/retest

This test is flaky on testgrid

knative-prow-robot pushed a commit that referenced this pull request Mar 18, 2020
Today the fact that the Broker lifecycle stuff propagates *Deployment* status for filter/ingress leaks implementation details into the API types.  An example of where this leakage is bas would be if I were to run a multi-tenant broker (#2760) as something other than a Deployment.

This change corrects one small part of this leaky interface by shifting from Deployment to Endpoints as the canonical resource for establishing readiness.

This is also slightly more correct as it assesses not just whether the Deployment is ready, but whether that information has propagated to the Service / Endpoints.
@@ -0,0 +1 @@
roles/filter-clusterrole.yaml
Copy link
Member

Choose a reason for hiding this comment

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

Add trailing newline:

Suggested change
roles/filter-clusterrole.yaml
roles/filter-clusterrole.yaml

@@ -0,0 +1 @@
roles/filter-serviceaccount.yaml
Copy link
Member

Choose a reason for hiding this comment

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

Add trailing newline:

Suggested change
roles/filter-serviceaccount.yaml
roles/filter-serviceaccount.yaml

@@ -0,0 +1 @@
roles/ingress-clusterrole.yaml
Copy link
Member

Choose a reason for hiding this comment

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

Add trailing newline:

Suggested change
roles/ingress-clusterrole.yaml
roles/ingress-clusterrole.yaml

@@ -0,0 +1 @@
roles/ingress-serviceaccount.yaml
Copy link
Member

Choose a reason for hiding this comment

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

Add trailing newline:

Suggested change
roles/ingress-serviceaccount.yaml
roles/ingress-serviceaccount.yaml

@@ -0,0 +1 @@
roles/filter-clusterrolebinding.yaml
Copy link
Member

Choose a reason for hiding this comment

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

Add trailing newline:

Suggested change
roles/filter-clusterrolebinding.yaml
roles/filter-clusterrolebinding.yaml

@@ -0,0 +1 @@
roles/ingress-clusterrolebinding.yaml
Copy link
Member

Choose a reason for hiding this comment

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

Add trailing newline:

Suggested change
roles/ingress-clusterrolebinding.yaml
roles/ingress-clusterrolebinding.yaml

@@ -0,0 +1 @@
deployments/broker-filter.yaml
Copy link
Member

Choose a reason for hiding this comment

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

Add trailing newline:

Suggested change
deployments/broker-filter.yaml
deployments/broker-filter.yaml

@@ -0,0 +1 @@
deployments/broker-ingress.yaml
Copy link
Member

Choose a reason for hiding this comment

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

Add trailing newline:

Suggested change
deployments/broker-ingress.yaml
deployments/broker-ingress.yaml

@@ -0,0 +1 @@
deployments/controller.yaml
Copy link
Member

Choose a reason for hiding this comment

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

Add trailing newline:

Suggested change
deployments/controller.yaml
deployments/controller.yaml

@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/mtbroker/filter/filter_handler.go Do not exist 77.8%
pkg/mtbroker/filter/stats_reporter.go Do not exist 80.6%
pkg/mtbroker/ingress/ingress_handler.go Do not exist 81.0%
pkg/mtbroker/ingress/stats_reporter.go Do not exist 82.4%
pkg/mtbroker/ttl.go Do not exist 85.0%
pkg/reconciler/mtbroker/broker.go Do not exist 73.0%
pkg/reconciler/mtbroker/config.go Do not exist 73.3%
pkg/reconciler/mtbroker/controller.go Do not exist 89.5%
pkg/reconciler/mtbroker/resources/channel.go Do not exist 90.0%
pkg/reconciler/mtbroker/resources/subscription.go Do not exist 100.0%
pkg/reconciler/mtbroker/trigger.go Do not exist 88.2%

@vaikas
Copy link
Contributor Author

vaikas commented Mar 18, 2020

/test pull-knative-eventing-unit-tests

@n3wscott
Copy link
Contributor

/lgtm
/approve

Awesome work.

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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

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. area/performance area/test-and-release Test infrastructure, tests or release cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants