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

Prevent generation only updates #3915

Merged

Conversation

pierDipi
Copy link
Member

@pierDipi pierDipi commented May 31, 2024

This guards and discard contract ConfigMap updates when only generation
changes.

While this approach is technically slightly slower, the latency is negligible,
and it is more robust and easier to maintain.

Proposed Changes

  • guards and discard contract ConfigMap updates when only generation
    changes
  • move change detection to the shared library

Release Note

Prevent unnecessary ConfigMap updates and reduce API server load

Docs

This guards contract ConfigMap updates when only `generation`
changes.

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 31, 2024
Copy link

knative-prow bot commented May 31, 2024

[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 knative-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 31, 2024
Copy link

codecov bot commented May 31, 2024

Codecov Report

Attention: Patch coverage is 44.70588% with 47 lines in your changes are missing coverage. Please review.

Project coverage is 49.24%. Comparing base (97732b7) to head (9b4d7e0).
Report is 1 commits behind head on main.

Files Patch % Lines
control-plane/pkg/reconciler/trigger/trigger.go 16.66% 7 Missing and 3 partials ⚠️
control-plane/pkg/reconciler/channel/channel.go 60.00% 6 Missing and 2 partials ⚠️
control-plane/pkg/reconciler/broker/broker.go 36.36% 5 Missing and 2 partials ⚠️
control-plane/pkg/reconciler/sink/kafka_sink.go 30.00% 5 Missing and 2 partials ⚠️
...ntrol-plane/pkg/reconciler/channel/v2/channelv2.go 28.57% 4 Missing and 1 partial ⚠️
control-plane/pkg/reconciler/consumer/consumer.go 54.54% 3 Missing and 2 partials ⚠️
control-plane/pkg/reconciler/base/reconciler.go 62.50% 2 Missing and 1 partial ⚠️
control-plane/pkg/contract/extensions.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3915      +/-   ##
============================================
- Coverage     53.59%   49.24%   -4.36%     
============================================
  Files           344      247      -97     
  Lines         18346    14925    -3421     
  Branches        294        0     -294     
============================================
- Hits           9833     7350    -2483     
+ Misses         7575     6816     -759     
+ Partials        938      759     -179     
Flag Coverage Δ
java-unittests ?

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pierDipi pierDipi changed the title [WIP] Prevent generation only updates Prevent generation only updates May 31, 2024
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 31, 2024
@pierDipi pierDipi requested a review from Cali0707 May 31, 2024 11:19
Comment on lines +1063 to +1065
BrokerDispatcherPod(env.SystemNamespace, map[string]string{
base.VolumeGenerationAnnotationKey: "0",
}),
Copy link
Member Author

@pierDipi pierDipi May 31, 2024

Choose a reason for hiding this comment

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

This is because the test wants to test "no operations" and without an annotation now the control plane will set the annotation on the data plane pod so that the CM and the annotation is fully consistent

Copy link
Contributor

@creydr creydr 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 knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label May 31, 2024
@creydr
Copy link
Contributor

creydr commented May 31, 2024

Putting on hold in case you want some other reviews too
/hold

Feel free to unhold

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 31, 2024
@knative-prow knative-prow bot merged commit 483904b into knative-extensions:main May 31, 2024
35 of 37 checks passed
@mgencur
Copy link
Contributor

mgencur commented May 31, 2024

I'm not an expert here but it looks good.

pierDipi added a commit to pierDipi/eventing-kafka-broker that referenced this pull request May 31, 2024
* Prevent generation only contract updates

This guards contract ConfigMap updates when only `generation`
changes.

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Refactor to simplify and remove reconciler level change detection

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

---------

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
openshift-merge-bot bot pushed a commit to openshift-knative/eventing-kafka-broker that referenced this pull request Jun 5, 2024
* Prevent generation only contract updates

This guards contract ConfigMap updates when only `generation`
changes.



* Refactor to simplify and remove reconciler level change detection



---------

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
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 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. 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.

3 participants