Skip to content

Feature: Priority Queue #2374

Open
Open

Description

@fabriziopandini

Tasks

Ideas:

Feature enablement

The feature can be enabled by setting the UsePriorityQueue option to true, e.g.:

	ctrlOptions := ctrl.Options{
		Controller: config.Controller{
			UsePriorityQueue: ptr.To[bool](true),
		},
        ...
	}

	mgr, err := ctrl.NewManager(restConfig, ctrlOptions)

Original issue description

While discussing #857 (comment) an idea come up about having something like a priority queue, so we can give resync events a lower priority while assigning to other events a higher priority.

This could help when there are many objects of the same type and at every resync period there is a storm of events being added to the queue.

cc @alvaroaleman @sbueringer

Activity

  1. alvaroaleman commented on Jun 12, 2023

    @alvaroaleman
    Member

    While resync events are one example, I think that it makes sense in general to allow specifying a priority when adding items to the workqueue.

    One challenge here is the fact that as of today, there is no priority queue implementation in upstream kube.

  2. troy0820 commented on Aug 25, 2023

    @troy0820
    Member

    /kind feature

  3. k8s-triage-robot commented on Jan 27, 2024

    @k8s-triage-robot

    The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

    This bot triages un-triaged issues according to the following rules:

    • After 90d of inactivity, lifecycle/stale is applied
    • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
    • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

    You can:

    • Mark this issue as fresh with /remove-lifecycle stale
    • Close this issue with /close
    • Offer to help out with Issue Triage

    Please send feedback to sig-contributor-experience at kubernetes/community.

    /lifecycle stale

  4. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Jan 27, 2024
  5. k8s-triage-robot commented on Feb 26, 2024

    @k8s-triage-robot

    The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

    This bot triages un-triaged issues according to the following rules:

    • After 90d of inactivity, lifecycle/stale is applied
    • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
    • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

    You can:

    • Mark this issue as fresh with /remove-lifecycle rotten
    • Close this issue with /close
    • Offer to help out with Issue Triage

    Please send feedback to sig-contributor-experience at kubernetes/community.

    /lifecycle rotten

  6. added
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Feb 26, 2024
  7. k8s-triage-robot commented on Mar 27, 2024

    @k8s-triage-robot

    The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

    This bot triages issues according to the following rules:

    • After 90d of inactivity, lifecycle/stale is applied
    • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
    • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

    You can:

    • Reopen this issue with /reopen
    • Mark this issue as fresh with /remove-lifecycle rotten
    • Offer to help out with Issue Triage

    Please send feedback to sig-contributor-experience at kubernetes/community.

    /close not-planned

  8. k8s-ci-robot commented on Mar 27, 2024

    @k8s-ci-robot
    Contributor

    @k8s-triage-robot: Closing this issue, marking it as "Not Planned".

    Details

    In response to this:

    The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

    This bot triages issues according to the following rules:

    • After 90d of inactivity, lifecycle/stale is applied
    • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
    • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

    You can:

    • Reopen this issue with /reopen
    • Mark this issue as fresh with /remove-lifecycle rotten
    • Offer to help out with Issue Triage

    Please send feedback to sig-contributor-experience at kubernetes/community.

    /close not-planned

    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.

  9. sbueringer commented on Mar 28, 2024

    @sbueringer
    Member

    /remove-lifecycle rotten
    /reopen

  10. k8s-ci-robot commented on Mar 28, 2024

    @k8s-ci-robot
    Contributor

    @sbueringer: Reopened this issue.

    Details

    In response to this:

    /remove-lifecycle rotten
    /reopen

    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.

  11. removed
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    on Mar 28, 2024
  12. 3 remaining items

  13. added
    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Jun 27, 2024
  14. alvaroaleman commented on Nov 16, 2024

    @alvaroaleman
    Member

    /assign

  15. alvaroaleman commented on Nov 17, 2024

    @alvaroaleman
    Member

    All,

    I've written a small design doc and POC for this. Would appreciate everyones feedback

  16. sbueringer commented on Jan 2, 2025

    @sbueringer
    Member

    I've updated the issue so we can use it as an umbrella issue for the feature going forward

  17. changed the title [-]Implement priority queue as an option for reconcile loops[/-] [+]Feature: Priority Queue[/+] on Jan 2, 2025
  18. lingdie commented on Apr 8, 2025

    @lingdie

    Can we provide more example codes on priority queue feature?

  19. sbueringer commented on Apr 8, 2025

    @sbueringer
    Member

    What example code are you looking for? To use the feature you only have to set a boolean field to true

  20. lingdie commented on Apr 8, 2025

    @lingdie

    Is that all? Can't believe. :)

  21. sbueringer commented on Apr 8, 2025

    @sbueringer
    Member

    Yup. Literally just that. We try to implement this in a way that it just works.

    (I added a short config snippet to the issue description)

  22. vishalbalaji-v commented on Aug 13, 2025

    @vishalbalaji-v

    Hi everyone,

    Is there timeline on when this will be generally available? The doc for priority queue says it's currently in beta (link).

    We have a use case for it, but people are worried about putting it in production since the doc says it's in beta. I'd be happy to contribute to something if required. The design also doesn't seem to have been updated in a while.

  23. alvaroaleman commented on Aug 13, 2025

    @alvaroaleman
    Member

    Is there timeline on when this will be generally available? The doc for priority queue says it's currently in beta (link).

    The main reason for that is that we don't want to call it GA until we are sure we don't want to change the interface definition. The priority queue is being used in production in places where it matters and there are no known issues with it.

  24. sbueringer commented on Oct 6, 2025

    @sbueringer
    Member

    And PQ is enabled per default 🎉

    Thx to everyone that is contributing to this feature!

  25. fabriziopandini commented on Nov 7, 2025

    @fabriziopandini
    MemberAuthor

    Awesome job folks!

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

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions