这是indexloc提供的服务,不要输入任何密码
Skip to content

Refactor rabbit service to return Results #552

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

Merged
merged 2 commits into from
Jan 12, 2022

Conversation

benmoss
Copy link
Contributor

@benmoss benmoss commented Dec 14, 2021

Changes

  • 🧹 Change the contract of the RabbitService interface to return Result objects rather than the CRD
  • 🧹 Remove exchange, binding, and queue informers and just use the rabbitmq typed client to do CRUD operations from within the RabbitService

/kind cleanup

Requested to be split out of #533 by @ikvmw

@knative-prow-robot knative-prow-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 14, 2021
@codecov
Copy link

codecov bot commented Dec 14, 2021

Codecov Report

Merging #552 (25b27a5) into main (d49cd0f) will decrease coverage by 0.08%.
The diff coverage is 69.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #552      +/-   ##
==========================================
- Coverage   75.44%   75.35%   -0.09%     
==========================================
  Files          47       47              
  Lines        2879     2857      -22     
==========================================
- Hits         2172     2153      -19     
+ Misses        569      566       -3     
  Partials      138      138              
Impacted Files Coverage Δ
pkg/reconciler/trigger/trigger.go 59.84% <40.00%> (-0.53%) ⬇️
pkg/reconciler/broker/broker.go 89.38% <100.00%> (-0.62%) ⬇️
pkg/reconciler/broker/controller.go 95.83% <100.00%> (ø)
pkg/reconciler/trigger/controller.go 73.52% <100.00%> (ø)

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 d49cd0f...25b27a5. Read the comment docs.

Ben Moss added 2 commits December 14, 2021 10:36
This should allow us to start creating policies instead of just queues
and returning an aggregate result
if !exchange.Ready {
logging.FromContext(ctx).Warnf("Exchange %q is not ready", exchange.Name)
MarkExchangeFailed(&b.Status, "ExchangeFailure", fmt.Sprintf("exchange %q is not ready", exchange.Name))
return nil
}
args.Name = naming.BrokerExchangeName(b, true)
dlxExchange, err := r.rabbit.ReconcileExchange(ctx, args)
Copy link
Contributor

Choose a reason for hiding this comment

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

it's not clear that dlxExchange is not an Exchange anymore but a Result.

maybe other vars as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It still does represent the exchange, in that the Ready and Name fields are about the exchange, it's just a different struct than the CRD type. I don't really like calling the variable result, since that's just generic. I'm not crazy about exchangeResult either, I don't see a problem with it being called exchange still.

@deadtrickster
Copy link

LGTM

@knative-prow-robot
Copy link

@deadtrickster: changing LGTM is restricted to collaborators

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ikavgo
Copy link
Contributor

ikavgo commented Jan 12, 2022

LGTM

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2022
@knative-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: benmoss, deadtrickster, ikvmw

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

@knative-prow-robot knative-prow-robot merged commit 3baf140 into knative-extensions:main Jan 12, 2022
@benmoss benmoss deleted the policy-1 branch January 12, 2022 14: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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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.

4 participants