Skip to content

Move left over delivery helpers from pkg/buses to pkg/provisioners#626

Merged
knative-prow-robot merged 7 commits into
knative:masterfrom
neosab:refactor_busses
Nov 28, 2018
Merged

Move left over delivery helpers from pkg/buses to pkg/provisioners#626
knative-prow-robot merged 7 commits into
knative:masterfrom
neosab:refactor_busses

Conversation

@neosab
Copy link
Copy Markdown
Contributor

@neosab neosab commented Nov 16, 2018

Fixes #625 #572

Proposed Changes

  • Move message_dispatcher, message_receiver, logging helpers from pkg/buses to pkg/provisioners
  • Renames channel dispatcher k8s service from <provisioner>-clusterbus to <provisioner>-dispatcher. UPGRADE IMPACT Please follow the discussion below. Thanks @Harwayne

Release Note

Renamed channel dispatcher k8s service from `<provisioner>-clusterbus.svc.cluster.local` to `<provisioner`>-dispatcher.svc.cluster.local`

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Nov 16, 2018
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 16, 2018
@neosab neosab changed the title Movie left over delivery helpers from pkg/busses to pkg/provisioners Movie left over delivery helpers from pkg/buses to pkg/provisioners Nov 16, 2018
@neosab neosab changed the title Movie left over delivery helpers from pkg/buses to pkg/provisioners Move left over delivery helpers from pkg/buses to pkg/provisioners Nov 16, 2018
@neosab
Copy link
Copy Markdown
Contributor Author

neosab commented Nov 16, 2018

/cc @Harwayne @matzew @scothis

@neosab
Copy link
Copy Markdown
Contributor Author

neosab commented Nov 16, 2018

/test pull-knative-eventing-integration-tests

@Harwayne
Copy link
Copy Markdown
Contributor

  • Renames channel dispatcher k8s service from <provisioner>-clusterbus to <provisioner>-dispatcher. Please suggest if there is a better naming to be followed. I don't think this has any impact on the end-user (now that we released 0.2.0) since this is not the Sink URL and it's behind the VirtualService.

I'm not sure this is a safe change. I don't think we validate the spec of the VirtualService during normal Channel reconciliation, just that something with the right name exists. So any Channels that exist before this update is applied will point at the old Service, which will likely work until some point in the future when that Service is deleted.

@neosab
Copy link
Copy Markdown
Contributor Author

neosab commented Nov 16, 2018

I'm not sure this is a safe change. I don't think we validate the spec of the VirtualService during normal Channel reconciliation, just that something with the right name exists. So any Channels that exist before this update is applied will point at the old Service, which will likely work until some point in the future when that Service is deleted.

You are right, I confused the VirtualService resource name and the DNS name and missed the fact we don't change the former.

Few ways to fix this:

Proposal 1 (the right fix)

  • As part of channel reconciliation, check the spec of VirtualService and replace the destination host to *-dispatcher.
  • Also, as part of the ClusterProvisioner controller during reconciliation remove the old dispatcher service *-clusterbus, if found.

Proposal 2 (compromise)

  • Create two dispatcher service's *-clusterbus and *-dispatcher and keep them around.

Proposal 3 (least impactful)
FWIW, only in-memory channel provisioner is impacted as the kafka channel provisioner was never released with 0.2.0.

  • So leave in-memory-clusterbus svc as-is.
  • Use the new service name for all new provisioners (kafka included)

Comment thread pkg/provisioners/message.go
Comment thread pkg/provisioners/message_receiver.go
Comment thread pkg/provisioners/logger_test.go Outdated
@Harwayne
Copy link
Copy Markdown
Contributor

I'm not sure this is a safe change. I don't think we validate the spec of the VirtualService during normal Channel reconciliation, just that something with the right name exists. So any Channels that exist before this update is applied will point at the old Service, which will likely work until some point in the future when that Service is deleted.

You are right, I confused the VirtualService resource name and the DNS name and missed the fact we don't change the former.

Few ways to fix this:

Proposal 1 (the right fix)

  • As part of channel reconciliation, check the spec of VirtualService and replace the destination host to *-dispatcher.
  • Also, as part of the ClusterProvisioner controller during reconciliation remove the old dispatcher service *-clusterbus, if found.

Proposal 2 (compromise)

  • Create two dispatcher service's *-clusterbus and *-dispatcher and keep them around.

Proposal 3 (least impactful)
FWIW, only in-memory channel provisioner is impacted as the kafka channel provisioner was never released with 0.2.0.

  • So leave in-memory-clusterbus svc as-is.
  • Use the new service name for all new provisioners (kafka included)

I guess one important thing we need to know is how backwards compatibility will work. I'm fairly sure we want to support 0.N -> 0.N+1 (upgrading directly from 0.N to 0.N+1) and 0.N+1 -> 0.N+2, without anything breaking. Do we also need to support 0.N -> 0.N+2 (upgrading directly from 0.N to 0.N+2)? @vaikas-google @evankanderson

Regardless of the backwards compatibility story, I think that we should do:

  • As part of channel reconciliation, check the spec of VirtualService and replace the destination host to *-dispatcher.

We can use a similar procedure as in eventing-sources.

And then, for the short-term, I think this is the proper fix until we determine how long we need to be compatible with the current in-memory-channel

Proposal 3 (least impactful)
FWIW, only in-memory channel provisioner is impacted as the kafka channel provisioner was never released with 0.2.0.

  • So leave in-memory-clusterbus svc as-is.
  • Use the new service name for all new provisioners (kafka included)

@knative-prow-robot knative-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 21, 2018
@neosab
Copy link
Copy Markdown
Contributor Author

neosab commented Nov 21, 2018

I guess one important thing we need to know is how backwards compatibility will work. I'm fairly sure we want to support 0.N -> 0.N+1 (upgrading directly from 0.N to 0.N+1) and 0.N+1 -> 0.N+2, without anything breaking. Do we also need to support 0.N -> 0.N+2 (upgrading directly from 0.N to 0.N+2)? @vaikas-google @evankanderson

I will raise this in the weekly meeting.

We can use a similar procedure as in eventing-sources.

And then, for the short-term, I think this is the proper fix until we determine how long we need to be compatible with the current in-memory-channel

Thanks! I just did that, please take a look.

@Harwayne
Copy link
Copy Markdown
Contributor

I guess one important thing we need to know is how backwards compatibility will work. I'm fairly sure we want to support 0.N -> 0.N+1 (upgrading directly from 0.N to 0.N+1) and 0.N+1 -> 0.N+2, without anything breaking. Do we also need to support 0.N -> 0.N+2 (upgrading directly from 0.N to 0.N+2)?

Ping @vaikas-google @evankanderson - what are the requirements for backwards compatibility?

@grantr
Copy link
Copy Markdown
Contributor

grantr commented Nov 28, 2018

/milestone v0.2.1

@knative-prow-robot knative-prow-robot added this to the v0.2.1 milestone Nov 28, 2018
@grantr
Copy link
Copy Markdown
Contributor

grantr commented Nov 28, 2018

/approve
I'll let @Harwayne lgtm.

The release note should mention that the controller will delete the previous service.

If we don't delete the -clusterbus service, will that break anything? What's the impact of leaving it around?

@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: grantr, neosab

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 28, 2018

// The name of the svc has changed since version 0.2.1. Hence, delete old dispatcher service (in-memory-channel-clusterbus)
// that was created previously in version 0.2.0 to ensure backwards compatibility.
err := r.deleteOldDispatcherService(ctx, ccp)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure how much it matters because Istio won't notice right away, but move this after util.CreateDispatcherService, so that the correct VirtualService is updated before the old Service is deleted.

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.

I don't think it matters, I changed the order.

// Update VirtualService if it has changed. This is possible since in version 0.2.0, the destinationHost in
// spec.HTTP.Route for the dispatcher was changed from *-clusterbus to *-dispatcher. Even otherwise, this
// reconciliation is useful for the future mutations to the object.
expected := newVirtualService(channel)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's make the same change to K8s Services as well (comparing and updating if needed).

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.

Hmm, I did this but had to tweak a bit since service.spec.clusterIP is immutable. Take a look and let me know.

@Harwayne
Copy link
Copy Markdown
Contributor

If we don't delete the -clusterbus service, will that break anything? What's the impact of leaving it around?

Nothing will break, but we will always have lingering doubts that something depends on it.

Copy link
Copy Markdown
Contributor

@Harwayne Harwayne 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-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. and removed lgtm Indicates that a PR is ready to be merged. labels Nov 28, 2018
@knative-metrics-robot
Copy link
Copy Markdown

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

File Old Coverage New Coverage Delta
pkg/controller/eventing/inmemory/clusterchannelprovisioner/reconcile.go 100.0% 94.2% -5.8
pkg/provisioners/channel_util.go 85.1% 84.7% -0.4
pkg/provisioners/logger.go Do not exist 100.0%
pkg/provisioners/message.go Do not exist 100.0%
pkg/provisioners/message_dispatcher.go Do not exist 89.1%
pkg/provisioners/message_receiver.go Do not exist 0.0%
pkg/provisioners/provisioner_util.go 77.3% 78.8% 1.5
pkg/provisioners/references.go Do not exist 100.0%

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 28, 2018
Copy link
Copy Markdown
Contributor

@Harwayne Harwayne 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-robot knative-prow-robot merged commit 5fb16a2 into knative:master Nov 28, 2018
@Harwayne Harwayne mentioned this pull request Nov 29, 2018
@neosab neosab deleted the refactor_busses branch November 29, 2018 23:26
Harwayne added a commit to Harwayne/knative-eventing that referenced this pull request Dec 3, 2018
knative-prow-robot pushed a commit that referenced this pull request Dec 3, 2018
* Initial work on the GCP PubSub Channel Controller.

* Switch to the more standard model, a single global dispatcher.

* Args are now defaulted on the controller, removed the ability to customize them per channel. We can add them back later if desired.

* YAML and scaffold for the dispatcher.

* Created the 'receive' side of the dispatcher. The dispatch side is totally unimplemented.

* Initial work on the dispatcher.

* More work on the dispatcher.

* Dispatcher mostly working.

* Handle the reconcileChan

* Minor improvements.

* Touch ups.

* Rename Run->Start.

* Fake PubSub.

* Util unit tests.

* Unit tests for the channel controller.

* Beginning unit tests for dispatcher.

* update-deps

* Unit tests for dispatcher/reconcile.go

* Unit test dispatcher/receiver.

* Add a README.

* DeepCopy the sub

* Add the ServiceEntry to the Channel's config.

* Typo

* PR comments

* buses -> provisioners

* Switch to the common utils.

* Add VirtualService.Update RBAC now that VirtualServices are updated if incorrect.

* PR comments

* Move the contoller packages inside the controller folder.

* PR comments (mostly log levels).

* Desugar to get the fields right.

* Switch service name, to match #626.
creydr added a commit to creydr/knative-eventing that referenced this pull request Jun 17, 2024
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.

7 participants