Skip to content

fix 4509, remove finalizer#4511

Merged
knative-prow-robot merged 6 commits into
knative:masterfrom
vaikas:issue-4509
Nov 16, 2020
Merged

fix 4509, remove finalizer#4511
knative-prow-robot merged 6 commits into
knative:masterfrom
vaikas:issue-4509

Conversation

@vaikas
Copy link
Copy Markdown
Contributor

@vaikas vaikas commented Nov 12, 2020

Fixes #4509

Proposed Changes

  • Do not use finalizer for IMC dispatcher

Release Note

- :broom: Update or clean up current behavior
Do not set the finalizer for InMemoryChannel for dispatcher, just deal with it in reconcilekind

Docs

@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Nov 12, 2020
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 12, 2020
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vaikas

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 12, 2020
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 12, 2020

Codecov Report

Merging #4511 (70468c8) into master (acf65cf) will decrease coverage by 0.00%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4511      +/-   ##
==========================================
- Coverage   81.26%   81.26%   -0.01%     
==========================================
  Files         284      284              
  Lines        8013     8021       +8     
==========================================
+ Hits         6512     6518       +6     
- Misses       1113     1114       +1     
- Partials      388      389       +1     
Impacted Files Coverage Δ
...iler/inmemorychannel/dispatcher/inmemorychannel.go 87.32% <81.81%> (-2.08%) ⬇️
...econciler/inmemorychannel/dispatcher/controller.go 79.59% <100.00%> (+1.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update acf65cf...70468c8. Read the comment docs.

Comment on lines +57 to +63
if imc.Status.Address != nil &&
imc.Status.Address.URL != nil {
if hostName := imc.Status.Address.URL.Host; hostName != "" {
logging.FromContext(ctx).Info("Removing dispatcher")
r.multiChannelMessageHandler.DeleteChannelHandler(hostName)
}
}
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.

I meant do it in controller.go, this won't be called on deletions

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.

I'd do it in a DeleteFunc on:

inmemorychannelInformer.Informer().AddEventHandler(

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.

I think you also want to fetch the object using this helper (then cast it to IMC): https://github.com/knative/pkg/blob/e9570bdb548d85a0ce1d73f64f348771377ae56f/kmeta/accessor.go#L47

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.

@vaikas LMK if you wanna sync on this so we can land it 😉

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'll try to get this done today, working on moving the rabbitmq into the new test infra.

Comment on lines +57 to +58
if imc.Status.Address != nil &&
imc.Status.Address.URL != nil {
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.

Is this new line on purpose?

@slinkydeveloper
Copy link
Copy Markdown
Contributor

/assign

@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 16, 2020
}

func (r *Reconciler) deleteFunc(obj interface{}) {
if acc, err := kmeta.DeletionHandlingAccessor(obj); err == nil {
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.

Generally Go style prefers inverting these and returning early to avoid the deep indentation.

Comment on lines +156 to +157
// If the IMC has been deleted just make sure the handler is removed.
if !imc.GetDeletionTimestamp().IsZero() {
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.

I don't think this will be true on this path because the object we get is the last copy the informer saw, and without a finalizer this won't be set.

@knative-metrics-robot
Copy link
Copy Markdown

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/inmemorychannel/dispatcher/inmemorychannel.go 91.8% 90.9% -0.9

Copy link
Copy Markdown
Member

@mattmoor mattmoor 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 the lgtm Indicates that a PR is ready to be merged. label Nov 16, 2020
@knative-prow-robot knative-prow-robot merged commit fb2f337 into knative:master Nov 16, 2020
@vaikas vaikas deleted the issue-4509 branch November 16, 2020 21:48
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/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.

FinalizeKind is overkill for IMC dispatcher

6 participants