-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Sync-waves not working as expected #12376
Comments
Needs help with investigation. Possibly a bug |
We've observed the same behavior. |
If it helps, I was using ArgoCD 2.3, where it was happening the same. If it is a bug, it would came from some previous versions. |
Same issue here i am using crossplane It have no problem when it create it will follow the order |
do we know of a version where synch-waves are working? |
it looks like the never worked as supposed to. |
I observe the same problems, especially with crossplane. It really just fires out all the ressources without waiting for healthy ressources or waiting "ARGOCD_SYNC_WAVE_DELAY" seconds. Which is by default 2. where is the code for the sync waves located? |
We are seeing this as well with argo 2.5 and have seen this behavior since 2.3. |
Hey there, I've raised a PR. Can somebody from you folks give it a try and see if it fixes the problem? Here's a test scenario: Use: https://github.com/rh-gitops-qe/argocd-apps-examples/tree/main/syncwaves-example e.g.
You should see namespaces-test 1, 2, 3 created in order. To see the order, you might want to use |
Deletion isn't supposed to obey sync wave semantics, though. It is supposed to follow the order (which it does, I guess). What just doesn't happen is that we actually wait for the resources to be fully recycled. So if I understand this bug correctly, when sync waves 1, 2 and 3 are in place, the order of deletion would be 3, 2, 1 (which it currently is, I believe) but wait between the syncs, e.g. first delete resources from wave 3, wait for them to be completely recycled (and not just putting a DeletionTimestamp on it), then proceed to delete wave 2 resources, etc Is that a correct summary of the expectation? |
this is what we exactly expect. |
but @jannfis , reading this piece of code: |
It seems that this particular piece of code only targets deletion when you delete the Application. The pruning that happens during a sync (like, you demonstrated in your original description) is handled in another part of the code, more likely in the sync code within gitops-engine. You could see how the pruning behaves when you delete the Application vs when you sync-with-prune. |
I think I have a simple reproducer for this: It's not as easy as I initially thought of. According to @jannfis new comment, the code for Sync Prune is different from what we were originally looking at. It lives in the gitops-engine repository. The core goal of this card is to have a test, that allows us to verify when this bug is fixed. So the best approach is not to write a unit-test, at least not for now. The best approach is to have a reproducer, so right now it fails (because of the wrong behavior) and when we fix the code, it should work fine. Here's the reproducer I came up with:
This will create a namespace, called
Notice that ArgoCD correctly sets them up in the appropriate order (you can see this with
Actual Behavior: ArgoCD tried to delete everything at once (the namespace and the pods). See my screenshot: You can also verify this behavior via terminal:
As you can see, ArgoCD tried to delete everything, but it couldn't delete podtest1 and podtest2 and the namespace. It couldn't do it because in my original Expected behavior: Since according to syncwaves attached to the pods, the
So |
Ok, some findings:
Here I have 4 namespaces with (10, 20, 30, 40 sync waves) but the pruning doesn't happen in reverse order!
so the question here is, should I try to modify the |
could this be an option when deleting? Something that is not clear for me is the expected behaviour. A part from the issue of not ordering correctly. Is it expected that only mark objects for deletion? If we need some kind of sync between each object deletion, are there any other alternatives for deletion? If no, I guess this is a feature very interesting. |
According to argoproj/argo-cd#12376 waves don't actually work properly for deletion. I can see in the code it does a reverse sort and picks off the largest wave first, but I guess there's a bug where it'll kick off the next wave before the first has actually deleted (or something to that effect). However, we can tell argo not to delete something and let CAPI do its own thing, which appears to work more reliably. Anecdotally, the secret at wave -1 still gets deleted last, which defies all logic and tells some something kinda works in some situations and not others!!
According to argoproj/argo-cd#12376 waves don't actually work properly for deletion. I can see in the code it does a reverse sort and picks off the largest wave first, but I guess there's a bug where it'll kick off the next wave before the first has actually deleted (or something to that effect). However, we can tell argo not to delete something and let CAPI do its own thing, which appears to work more reliably. Anecdotally, the secret at wave -1 still gets deleted last, which defies all logic and tells some something kinda works in some situations and not others!!
Any news on this issue? I also hit the same issue that syncwave deletion order is not working as expected, It tried positive and negative syncwaves but no luck |
I still have the same issue on ArgoCD 2.7.10, does anyone have a trick while waiting for a fix? I use the External PostgreSQL server operator and spin-up some temporary review environments (thanks to Edit: typo. |
I have created an enhancement proposal (#15074) to address this. Please let me know what you think. |
Hello everyone! 👋 I've created a patch (argoproj/gitops-engine#538) to address this issue. I'd love for some folks to give it a try and share your thoughts. If you're up for it, let me know! |
Will this change be part of v2.11.0? |
@xsoheilalizadeh - I believe so. The PR was merged after the 2.10 RCs were out, therefore it didn't go in 2.10.x. |
Checklist:
argocd version
.ArgoCD 2.4.20
Describe the bug
When doing a sync delete, the objects are not deleted according to the sync-waves
To Reproduce
I have an ArgoCD app with different Resources. The one with the lowest syn-wave is a Namespace, which is -10. All the other objects have a sync-wave 1.
When I delete all the objects and sync (and prune) all the objects are deleted at the same time. In the following video, it can be seen, how the Namespace is marked as terminating immediately after the sync is invoked.
delete-no-respect-waves.mp4
Other objects, in this case some Secrets and BareMetalHost, are taking longer to be deleted. But there is no wait between waves.
I have been looking this feature:
#3959
that should implement this waits, according to this code:
https://github.com/argoproj/argo-cd/pull/3959/files/c2e5ccc81e0aaca81a2d002436d39d52a4364d2d#diff-f952d05ea83b61f771541425e28fa3931af2f2e7950261dd59cab93bdcfe2e9e
Actually, there is one comment about that. There is a wait of objects deletion before going to other wave.
Expected behavior
The Namespace object is deleted, only, after the other objects have been deleted.
Screenshots
Version
ArgoCD 2.4.20
Logs
The text was updated successfully, but these errors were encountered: