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

fix: Replace RestrictedEnqueueRequestForOwner with EnqueueRequestForOwner #1792

Merged

Conversation

ruanxin
Copy link
Contributor

@ruanxin ruanxin commented Aug 23, 2024

Description

We have a bug in the current RestrictedEnqueueRequestForOwner implementation, check detail here.
The reason why we previously introduced this customized RestrictedEnqueueRequestForOwner is because we want to limit kyma CR enqueue only triggered by update event which makes manifest CR state changes (we use SSA, which update manifest very frequently before). However, since we limited the SSA in this #1456, there is not necessary to have this customized version, we can directly use the native EnqueueRequestForOwner to achieve the same goal.

This PR also replaced GenerationChangedPredicate, LabelChangedPredicate with ResourceVersionChangedPredicate so that all watched resources can trigger enqueue based on subresource changes. For example, Manifest CR status change can trigger owner kyma CR enqueue.

Related issue(s)
#1762

@ruanxin ruanxin requested a review from a team as a code owner August 23, 2024 09:00
@kyma-bot kyma-bot added cla: yes Indicates the PR's author has signed the CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 23, 2024
@ruanxin ruanxin changed the title debug RestrictedEnqueueRequestForOwner fix: replace RestrictedEnqueueRequestForOwner with EnqueueRequestForOwner Aug 23, 2024
@kyma-bot kyma-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 23, 2024
@ruanxin ruanxin force-pushed the enqueue-kyma-based-on-manifest-state-change branch from 6a8a43c to 237446d Compare August 23, 2024 12:50
// If the two match, create a Request for the objected referred to by
// the OwnerReference. Use the Name from the OwnerReference and the Namespace from the
// object in the event.
if ref.Kind != e.groupKind.Kind || refGV.Group != e.groupKind.Group {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To reviewer:

this condition prevent following logic to enqueue related kyma CR, due to e.groupKind is empty

here is some log based on this commit

{"level":"INFO","date":"2024-08-23T11:17:04.906351175Z","caller":"watch/restricted_enqueue_request_for_owner.go:162","msg":"RestrictedEnqueueRequestForOwner","context":{"groupKind.Kind":"","groupKind.Group":"","ref.Kind":"Kyma","refGV.Group":"operator.kyma-project.io"}}

@ruanxin ruanxin changed the title fix: replace RestrictedEnqueueRequestForOwner with EnqueueRequestForOwner fix: Replace RestrictedEnqueueRequestForOwner with EnqueueRequestForOwner Aug 23, 2024
@ruanxin ruanxin force-pushed the enqueue-kyma-based-on-manifest-state-change branch from 34b1b01 to 3935693 Compare August 26, 2024 09:53
@ruanxin ruanxin force-pushed the enqueue-kyma-based-on-manifest-state-change branch from a6f8dc5 to 70f60eb Compare August 26, 2024 12:28
Copy link
Member

@lindnerby lindnerby left a comment

Choose a reason for hiding this comment

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

lgtm

@kyma-bot kyma-bot added the lgtm Looks good to me! label Aug 26, 2024
@kyma-bot kyma-bot merged commit 9ad1b9e into kyma-project:main Aug 26, 2024
36 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates the PR's author has signed the CLA. lgtm Looks good to me! 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