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: Put app to the operation queue after refresh queue processing to avoid race condition [#18500] #18694

Commits on Jul 28, 2024

  1. fix: Put app to the operation queue after refresh queue processing to…

    … avoid race condition - Fixes [argoproj#18500]
    
    Adding app to the operation queue and refresh queue could cause waiting for resource for minutes to tens of minutes.
    Sync state operates on resources gathered from reconciliation, so if the app operation event is processed before the refresh one (when triggered on resource update/creation), the refresh doesn’t help sync to progress and it essentially needs to wait for another app refresh.
    
    The fix seems to be to schedule app operation event after refresh event is finished processing. There’s one place where operation event is scheduled without refresh event (which can be kept there), and one place where refresh even is scheduled without the operation one during the app deletion handling https://github.com/argoproj/argo-cd/blob/3e2cfb138795e24df98c9745d813e4b7f1720dbd/controller/appcontroller.go#L2177. It’s probably safe to schedule operation even after that, since it has some code to check that app was deleted. If not, an update can be made to have refresh queue storing a tuple with app key and bool whether to enqueue app operation.
    
    If there are issues: try keeping both old places to add to app operation queue and new addition after refresh.
    
    Note on cherry pick: add to as many releases as you can. This can be a significant performance boost.
    
    Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
    andrii-korotkov-verkada committed Jul 28, 2024
    Configuration menu
    Copy the full SHA
    5664b2f View commit details
    Browse the repository at this point in the history