Skip to content

Avoid replacing the monitor's bus with the wrong bus#298

Merged
google-prow-robot merged 1 commit into
knative:masterfrom
scothis:bus-anti-clobber
Aug 2, 2018
Merged

Avoid replacing the monitor's bus with the wrong bus#298
google-prow-robot merged 1 commit into
knative:masterfrom
scothis:bus-anti-clobber

Conversation

@scothis
Copy link
Copy Markdown
Contributor

@scothis scothis commented Jul 31, 2018

For a namespaces bus, if there is a cluster bus installed with the same
name, the cluster bus will be captured in the monitor and used to check
if a channel is for that bus. This effectively causes channels to be
provisioned by the wrong bus, or not at all.

Before replacing the bus reference for the monitor, we need to check the
kind, name and namespace. Previously, only the name and namespace where
checked.

For a namespaces bus, if there is a cluster bus installed with the same
name, the cluster bus will be captured in the monitor and used to check
if a channel is for that bus. This effectively causes channels to be
provisioned by the wrong bus, or not at all.

Before replacing the bus reference for the monitor, we need to check the
kind, name and namespace. Previously, only the name and namespace where
checked.
@google-prow-robot google-prow-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 31, 2018
Comment thread pkg/buses/monitor.go

func (m *Monitor) createOrUpdateClusterBus(clusterBus *channelsv1alpha1.ClusterBus) error {
if clusterBus.Name != m.bus.GetObjectMeta().GetName() {
if m.bus.GetObjectKind().GroupVersionKind().Kind != clusterBus.Kind ||
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this mean we were sometimes passing a ClusterBus to createOrUpdateBus and vice-versa?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

createOrUpdateClusterBus will only receive a ClusterBus and createOrUpdateBus will only receive a Bus. The issue is that they both assign to m.bus which is a GenericBus interface that can be either.

The monitor is listening for Bus/ClusterBus so that it can receive updated parameters for channels and subscriptions. Realistically, it should only ever need to listen for either Buses or ClusterBuses, never both.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, this is a method on the monitor; I keep forgetting that these controllers aren't stateless (and each Monitor will see all the Bus & ClusterBus updates and choose which ones apply to its stored bus).

/lgtm
/approve

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 1, 2018
@google-prow-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: evankanderson, scothis

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

The pull request process is described here

Details 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

@google-prow-robot google-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 1, 2018
@scothis
Copy link
Copy Markdown
Contributor Author

scothis commented Aug 2, 2018

/test pull-knative-eventing-integration-tests

4 similar comments
@scothis
Copy link
Copy Markdown
Contributor Author

scothis commented Aug 2, 2018

/test pull-knative-eventing-integration-tests

@scothis
Copy link
Copy Markdown
Contributor Author

scothis commented Aug 2, 2018

/test pull-knative-eventing-integration-tests

@scothis
Copy link
Copy Markdown
Contributor Author

scothis commented Aug 2, 2018

/test pull-knative-eventing-integration-tests

@scothis
Copy link
Copy Markdown
Contributor Author

scothis commented Aug 2, 2018

/test pull-knative-eventing-integration-tests

@google-prow-robot google-prow-robot merged commit 2117963 into knative:master Aug 2, 2018
@scothis scothis deleted the bus-anti-clobber branch August 2, 2018 21:15
n3wscott pushed a commit to n3wscott/eventing that referenced this pull request Aug 3, 2018
For a namespaces bus, if there is a cluster bus installed with the same
name, the cluster bus will be captured in the monitor and used to check
if a channel is for that bus. This effectively causes channels to be
provisioned by the wrong bus, or not at all.

Before replacing the bus reference for the monitor, we need to check the
kind, name and namespace. Previously, only the name and namespace where
checked.
ReToCode pushed a commit to ReToCode/eventing that referenced this pull request Aug 3, 2023
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants