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

Implemented delivery order label #701

Merged
merged 21 commits into from
Mar 22, 2021

Conversation

slinkydeveloper
Copy link
Contributor

@slinkydeveloper slinkydeveloper commented Mar 5, 2021

Signed-off-by: Francesco Guardiani francescoguard@gmail.com

Part of #589

Proposed Changes

  • 🎁 Implemented delivery order label
  • πŸ› Modified default value for delivery order in contract
  • πŸ—‘οΈ Removed temporarily the usage of upstream features, since they're unstable and causes update issues

Release Note

Now eventing-kafka-broker implements ordered delivery. You can choose between ordered and unordered delivery through the label kafka.eventing.knative.dev/delivery.order in your triggers. Check out the docs for more details

Docs

Coming soon in another PR to docs repo

@slinkydeveloper slinkydeveloper requested review from a team as code owners March 5, 2021 12:54
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 5, 2021
@knative-prow-robot knative-prow-robot added area/control-plane size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 5, 2021
@slinkydeveloper slinkydeveloper changed the title Implemented delivery order annotation [WIP] Implemented delivery order annotation Mar 5, 2021
@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 5, 2021
@slinkydeveloper
Copy link
Contributor Author

I'm going to implement a basic e2e test, although I'm not sure how far I can go with testing this feature in a e2e manner

@codecov
Copy link

codecov bot commented Mar 5, 2021

Codecov Report

Merging #701 (082dcb9) into main (1258e97) will decrease coverage by 0.15%.
The diff coverage is 76.92%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #701      +/-   ##
============================================
- Coverage     76.78%   76.63%   -0.16%     
+ Complexity      441      440       -1     
============================================
  Files            77       77              
  Lines          2908     2923      +15     
  Branches        133      133              
============================================
+ Hits           2233     2240       +7     
- Misses          525      532       +7     
- Partials        150      151       +1     
Flag Coverage Ξ” Complexity Ξ”
java-unittests 80.37% <ΓΈ> (-0.25%) 0.00 <ΓΈ> (ΓΈ)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Ξ” Complexity Ξ”
control-plane/pkg/reconciler/trigger/trigger.go 71.42% <76.92%> (+0.22%) 0.00 <0.00> (ΓΈ)
...dispatcher/consumer/impl/OrderedOffsetManager.java 79.31% <0.00%> (-20.69%) 9.00% <0.00%> (-2.00%)
...r/dispatcher/http/HttpConsumerVerticleFactory.java 85.26% <0.00%> (ΓΈ) 24.00% <0.00%> (ΓΈ%)
...spatcher/consumer/impl/UnorderedOffsetManager.java 100.00% <0.00%> (+2.40%) 13.00% <0.00%> (+1.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 1258e97...082dcb9. Read the comment docs.

@slinkydeveloper
Copy link
Contributor Author

/retest

@slinkydeveloper
Copy link
Contributor Author

Because I would love to use reconciler-test for the e2e, I've opened this one #703

@pierDipi
Copy link
Member

pierDipi commented Mar 5, 2021

/this-is-fine 😍

@pierDipi
Copy link
Member

pierDipi commented Mar 5, 2021

If you want we can have a status condition to indicate the DeliveryOrder configured for a Trigger since it's easy to make a typo and then the DeliveryOrder configured is the default one rather than the one users wanted. (A separate PR is fine too)

@pierDipi
Copy link
Member

pierDipi commented Mar 5, 2021

/kind enhancement

@slinkydeveloper
Copy link
Contributor Author

If you want we can have a status condition to indicate the DeliveryOrder configured for a Trigger since it's easy to make a typo and then the DeliveryOrder configured is the default one rather than the one users wanted. (A separate PR is fine too)

I don't see the point TBH, there's no need to tell the user the controller read the contract properly IMO

@pierDipi
Copy link
Member

pierDipi commented Mar 8, 2021

I mean an annotation is weak compared to a key in the spec because we don't have a way to validate that the key is correct for that reason a status condition would be nice to have IMO.

@slinkydeveloper slinkydeveloper mentioned this pull request Mar 10, 2021
7 tasks
@knative-prow-robot knative-prow-robot added area/test size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 17, 2021
@slinkydeveloper
Copy link
Contributor Author

slinkydeveloper commented Mar 17, 2021

@pierDipi can we tackle the status issue in another PR? From my understanding (I might be wrong here) we need to setup some alternate condition set, like done in receiver_condition_set.go, right? If that's the case, i think it deserves a separate PR

@slinkydeveloper slinkydeveloper changed the title [WIP] Implemented delivery order annotation Implemented delivery order annotation Mar 17, 2021
@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 17, 2021
@slinkydeveloper
Copy link
Contributor Author

Rebased on top of #730 for testing, we need to merge the #730 first

test/e2e_new/ordered_test.go Outdated Show resolved Hide resolved
test/e2e_new/trigger/trigger.go Show resolved Hide resolved
@slinkydeveloper
Copy link
Contributor Author

I've removed broker_test.go, since upstream movement around features is unstable now...

For me we're ready to go
/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 19, 2021
@slinkydeveloper
Copy link
Contributor Author

/hold

one sec, maybe it's better to use a label (that's what other people does πŸ˜„ )

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 19, 2021
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@slinkydeveloper
Copy link
Contributor Author

/unhold

Ok now we use labels

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 19, 2021
@slinkydeveloper slinkydeveloper changed the title Implemented delivery order annotation Implemented delivery order label Mar 19, 2021
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@pierDipi
Copy link
Member

I see no benefits in using a label here, basically, the difference is that using a label I can query all objects with that label without doing a full scan or building a custom index whereas an annotation requires a full scan or a custom index.

For example, we use a label in our triggers to get fast access to all triggers associated with a broker.
https://github.com/knative-sandbox/eventing-kafka-broker/blob/1258e973843974a5a7fc42aff651cab4ed2a3f56/control-plane/pkg/reconciler/trigger/controller.go#L141-L157

In this case, a query like "give me all ordered trigger" seems pretty useless.

Of course, the benefit of using a label comes with additional storage, memory, and compute costs, so my preference would be to use an annotation since this value is only useful in a single reconcile cycle.

@slinkydeveloper
Copy link
Contributor Author

@pierDipi the reason i went for a label is to align with kafka source: https://knative.dev/docs/eventing/samples/kafka/source/#optional-specify-the-key-deserializer

But yeah i was checking in serving and they use annotations too for "special"/"experimental" features, so i'll revert and go for the annotation

This reverts commit 78a2c2d

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
This reverts commit 789f4d3

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-sandbox-eventing-kafka-broker-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
control-plane/pkg/reconciler/trigger/trigger.go 85.6% 85.1% -0.5

@pierDipi
Copy link
Member

pierDipi commented Mar 22, 2021

I wonder how this works given the issue on the partitionkey on Slack πŸ€”

Copy link
Member

@pierDipi pierDipi left a comment

Choose a reason for hiding this comment

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

Unhold when you're ready!
/hold

@knative-prow-robot knative-prow-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Mar 22, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pierDipi

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 22, 2021
@slinkydeveloper
Copy link
Contributor Author

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 22, 2021
@knative-prow-robot knative-prow-robot merged commit 5b73edd into knative-extensions:main Mar 22, 2021
@slinkydeveloper slinkydeveloper deleted the 589_part_4 branch March 22, 2021 20:29
@slinkydeveloper
Copy link
Contributor Author

slinkydeveloper commented Mar 22, 2021

I wonder how this works given the issue on the partitionkey on Slack thinking

My test uses a broker with a single partition :) I'm going to develop a test with different partitions once partitionKey is fixed

@pierDipi
Copy link
Member

My test uses a broker with a single partition :) I'm going to develop a test with different partitions once partitionKey is fixed

Oh, gotcha!

matzew pushed a commit to matzew/eventing-kafka-broker that referenced this pull request May 26, 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. area/control-plane area/data-plane area/test cla: yes Indicates the PR's author has signed the CLA. kind/enhancement 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.

None yet

4 participants