Skip to content

refactor(events): use typed queue and simplify controller#6346

Open
ivankatliarchuk wants to merge 5 commits intokubernetes-sigs:masterfrom
gofogo:refactor/events-controller-type-safe-queue
Open

refactor(events): use typed queue and simplify controller#6346
ivankatliarchuk wants to merge 5 commits intokubernetes-sigs:masterfrom
gofogo:refactor/events-controller-type-safe-queue

Conversation

@ivankatliarchuk
Copy link
Copy Markdown
Member

@ivankatliarchuk ivankatliarchuk commented Apr 4, 2026

What does it do ?

  • Queue type changed from [any] → [*eventsv1.Event], eliminating the runtime type assertion in processNextWorkItem
  • dryRun bool + hostname string fields replaced by pre-computed createOpts metav1.CreateOptions
  • maxTriesPerEvent renamed to maxRetriesPerEvent
  • event.ReportingController assignment removed from emit as it already set here
    ReportingController: controllerName,
  • Tests migrated from hand-built Controller structs to NewEventController(...) - less internal coupling
  • fake.EventEmitter.Add fixed to iterate all events instead of only events[0] (was a panic on empty input); test updated accordingly

follow-up

Motivation

The any-typed queue required an unsafe cast on every dequeue, and dryRun was being read on every processNextWorkItem call to reconstruct CreateOptions. Switching to a concrete type and pre-building createOpts removes both the runtime risk and the per-call allocation.

More

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • Yes, I updated end user documentation accordingly

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 4, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign szuecs for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 4, 2026
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 4, 2026

Pull Request Test Coverage Report for Build 23981619245

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 80.513%

Files with Coverage Reduction New Missed Lines %
openshift_route.go 1 82.93%
Totals Coverage Status
Change from base Build 23940145743: -0.02%
Covered Lines: 17146
Relevant Lines: 21296

💛 - Coveralls

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
@ivankatliarchuk
Copy link
Copy Markdown
Member Author

/test pull-external-dns-unit-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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