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

Remove egresses copy when comparing resources for change detection #1393

Conversation

pierDipi
Copy link
Member

@pierDipi pierDipi commented Oct 29, 2021

The assumption that contract.resources[*].egreeses don't change
when we update a resource in the contract is not true anymore
(and it is not really needed for most of our resources,
only Broker needs that),
so removing the copy.

Part of #312

Proposed Changes

  • Remove egresses copy when comparing resources

Release Note

None

Docs

None

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Oct 29, 2021
@knative-prow-robot knative-prow-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. area/control-plane approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 29, 2021
@pierDipi pierDipi changed the title Remove egresses copy when comparing resources for change detection [WIP] Remove egresses copy when comparing resources for change detection Oct 29, 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 Oct 29, 2021
@codecov
Copy link

codecov bot commented Oct 29, 2021

Codecov Report

Merging #1393 (b3ca318) into main (09d25fd) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1393      +/-   ##
============================================
+ Coverage     76.56%   76.57%   +0.01%     
  Complexity      584      584              
============================================
  Files            99       99              
  Lines          3597     3599       +2     
  Branches        165      165              
============================================
+ Hits           2754     2756       +2     
  Misses          633      633              
  Partials        210      210              
Flag Coverage Δ
java-unittests 82.27% <ø> (ø)

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

Impacted Files Coverage Δ
control-plane/pkg/core/config/resource.go 100.00% <100.00%> (ø)
control-plane/pkg/reconciler/broker/broker.go 70.44% <100.00%> (+0.14%) ⬆️
control-plane/pkg/reconciler/source/source.go 57.39% <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 09d25fd...b3ca318. Read the comment docs.

@pierDipi pierDipi force-pushed the KNATIVE-312_Remove-egresses-copy branch from 792e2b4 to ad896a5 Compare October 29, 2021 13:50
@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 29, 2021
The assumption that contract.resources[*].egreeses don't change
when we update a resource in the contract is not true anymore
(and it is not really needed), so removing the copy.

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
@pierDipi pierDipi force-pushed the KNATIVE-312_Remove-egresses-copy branch from ad896a5 to b3ca318 Compare November 2, 2021 08:24
@pierDipi pierDipi changed the title [WIP] Remove egresses copy when comparing resources for change detection Remove egresses copy when comparing resources for change detection Nov 2, 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 Nov 2, 2021
@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/broker/broker.go 84.2% 84.3% 0.1

Copy link
Contributor

@matzew matzew left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matzew, 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

@@ -46,14 +46,19 @@ const (
ResourceUnchanged
)

func SetResourceEgressesFromContract(contract *contract.Contract, resource *contract.Resource, index int) {
if index != NoResource {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we get a comment here on a follow up PR?

@@ -171,6 +171,7 @@ func (r *Reconciler) reconcileKind(ctx context.Context, broker *eventing.Broker)

brokerIndex := coreconfig.FindResource(ct, broker.UID)
// Update contract data with the new contract configuration
Copy link
Contributor

Choose a reason for hiding this comment

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

should we expand this comment, based on the reasoning for the newly added line?

@pierDipi
Copy link
Member Author

pierDipi commented Nov 2, 2021

/test pull-knative-sandbox-eventing-kafka-broker-integration-tests

@knative-prow-robot knative-prow-robot merged commit f327038 into knative-extensions:main Nov 3, 2021
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 cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants