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

Fixed eventtype create-delete loop on built in sources #7245

Merged
merged 4 commits into from
Sep 12, 2023

Conversation

Cali0707
Copy link
Member

@Cali0707 Cali0707 commented Sep 8, 2023

Fixes #7236

It appears that the eventtypes KReference in the default namespace were being retrieved with Namespace: "", while the eventtypes KReference they were being compared to had Namespace: "default". This caused the deep equality to fail, so they were continually deleted and recreated in the duck reconciler.

Proposed Changes

  • Set Namespace = "default" if Namespace == ""

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

Fixed bug where eventtypes for builtin sources were created and deleted in a loop

Signed-off-by: Calum Murray <cmurray@redhat.com>
@knative-prow knative-prow bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 8, 2023
@knative-prow knative-prow bot requested review from aslom and matzew September 8, 2023 19:36
@Cali0707
Copy link
Member Author

Cali0707 commented Sep 8, 2023

/cc @matzew

Signed-off-by: Calum Murray <cmurray@redhat.com>
@knative-prow knative-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 8, 2023
@codecov
Copy link

codecov bot commented Sep 8, 2023

Codecov Report

Patch coverage: 23.07% and project coverage change: -0.06% ⚠️

Comparison is base (b082850) 77.75% compared to head (bdd7402) 77.70%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7245      +/-   ##
==========================================
- Coverage   77.75%   77.70%   -0.06%     
==========================================
  Files         246      247       +1     
  Lines       13284    13311      +27     
==========================================
+ Hits        10329    10343      +14     
- Misses       2433     2445      +12     
- Partials      522      523       +1     
Files Changed Coverage Δ
pkg/reconciler/apiserversource/apiserversource.go 78.99% <0.00%> (-1.85%) ⬇️
pkg/reconciler/pingsource/pingsource.go 80.37% <0.00%> (-3.94%) ⬇️
pkg/reconciler/source/duck/duck.go 75.15% <100.00%> (+0.47%) ⬆️

... and 5 files with indirect coverage changes

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

@Cali0707
Copy link
Member Author

Cali0707 commented Sep 8, 2023

/test upgrade-tests

@matzew
Copy link
Member

matzew commented Sep 11, 2023

/test reconciler-tests

Copy link
Member

@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 knative-prow bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 11, 2023
@creydr
Copy link
Member

creydr commented Sep 11, 2023

/retest

@Cali0707
Copy link
Member Author

/retest-required

Signed-off-by: Calum Murray <cmurray@redhat.com>
Signed-off-by: Calum Murray <cmurray@redhat.com>
@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/test-and-release Test infrastructure, tests or release and removed lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 11, 2023
@Cali0707
Copy link
Member Author

I fixed the finalizer problems now
/cc @matzew @creydr

Copy link
Member

@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 knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 12, 2023
@knative-prow
Copy link

knative-prow bot commented Sep 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Cali0707, matzew

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

@matzew
Copy link
Member

matzew commented Sep 12, 2023

/cherry-pick release-1.11

@knative-prow-robot
Copy link
Contributor

@matzew: once the present PR merges, I will cherry-pick it on top of release-1.11 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.11

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.

@knative-prow knative-prow bot merged commit 93cec0f into knative:main Sep 12, 2023
36 of 39 checks passed
@knative-prow-robot
Copy link
Contributor

@matzew: #7245 failed to apply on top of branch "release-1.11":

Applying: Fixed eventtype create-delete loop on built in sources
Applying: Fix unit tests
Applying: Fixed source finalizers
Applying: Fixed tests
Using index info to reconstruct a base tree...
M	test/rekt/features/apiserversource/data_plane.go
Falling back to patching base and 3-way merge...
Auto-merging test/rekt/features/apiserversource/data_plane.go
CONFLICT (content): Merge conflict in test/rekt/features/apiserversource/data_plane.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0004 Fixed tests
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.11

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.

@Cali0707
Copy link
Member Author

@matzew I will manually cherry pick this

Cali0707 added a commit to Cali0707/eventing that referenced this pull request Sep 12, 2023
* Fixed eventtype create-delete loop on built in sources

Signed-off-by: Calum Murray <cmurray@redhat.com>

* Fix unit tests

Signed-off-by: Calum Murray <cmurray@redhat.com>

* Fixed source finalizers

Signed-off-by: Calum Murray <cmurray@redhat.com>

* Fixed tests

Signed-off-by: Calum Murray <cmurray@redhat.com>

---------

Signed-off-by: Calum Murray <cmurray@redhat.com>
knative-prow bot pushed a commit that referenced this pull request Sep 12, 2023
* Fixed eventtype create-delete loop on built in sources



* Fix unit tests



* Fixed source finalizers



* Fixed tests



---------

Signed-off-by: Calum Murray <cmurray@redhat.com>
dsimansk pushed a commit to dsimansk/eventing that referenced this pull request Jan 12, 2024
…knative#7250)

* Fixed eventtype create-delete loop on built in sources



* Fix unit tests



* Fixed source finalizers



* Fixed tests



---------

Signed-off-by: Calum Murray <cmurray@redhat.com>
openshift-merge-bot bot pushed a commit to openshift-knative/eventing that referenced this pull request Jan 12, 2024
…knative#7250) (#491)

* Fixed eventtype create-delete loop on built in sources



* Fix unit tests



* Fixed source finalizers



* Fixed tests



---------

Signed-off-by: Calum Murray <cmurray@redhat.com>
Co-authored-by: Calum Murray <cmurray@redhat.com>
Comment on lines +137 to +143
func (r *Reconciler) FinalizeKind(ctx context.Context, source *v1.ApiServerSource) pkgreconciler.Event {
logging.FromContext(ctx).Info("Deleting source")
// Allow for eventtypes to be cleaned up
source.Status.CloudEventAttributes = []duckv1.CloudEventAttributes{}
return nil
}

Copy link
Member

@pierDipi pierDipi Feb 26, 2024

Choose a reason for hiding this comment

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

This update is not guaranteed to be seen by the other controller (since after FinalizeKind ends the finalizer is removed and with it the resource) and also I think there is (or there should be) an owner reference that should clean up event types associated with this source.

Comment on lines +218 to +220
if eventType.Spec.Reference.Namespace == "" {
eventType.Spec.Reference.Namespace = defaultNamespace
}
Copy link
Member

Choose a reason for hiding this comment

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

If we want to set a namespace, the correct one is src.Namespace, assuming default is wrong

Copy link
Member

Choose a reason for hiding this comment

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

I think we had this assumption before.

but I like this suggestion

Copy link
Member

@pierDipi pierDipi Feb 26, 2024

Choose a reason for hiding this comment

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

We did not, that was on the Broker name, which different from the reference namespace here

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/test-and-release Test infrastructure, tests or release 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.

Event Types created for build-in sources are created an deleted in a loop
5 participants