argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
18.01k stars 5.49k forks source link

Can't terminate sync outside of sync window #20799

Closed hanikesn closed 3 days ago

hanikesn commented 1 week ago

Describe the bug

Can't terminate outstanding sync outside of sync window.

To Reproduce

  1. Configure a sync window for an application and enable auto sync
  2. Apply an update to the Application using kubectl with the following options:
    apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      # ...
    operation: null
    spec:
      # ...
      source:
        # ...
      syncPolicy:
        automated:
          allowEmpty: false
          prune: true
          selfHeal: true
        syncOptions:
          - ApplyOutOfSyncOnly=true
          - FailOnSharedResource=true
          - PruneLast=true
          - RespectIgnoreDifferences=true
  3. The sync will get started, but is blocked Sync operation blocked by sync window
  4. Try terminating the sync in the web interface

Expected behavior

Even outside a sync window I'm able to terminate an outstanding sync.

Screenshots

image

Version

v2.12.6+4dab5bd
andrii-korotkov-verkada commented 1 week ago

I've checked the code and it seems like TerminateOperation has a separate path from checking a sync window. I think Sync operation blocked by sync window refers to the sync attempt, not the termination attempt. Can you share more details about what happens after you terminate the sync? I see it's in the phase "Terminating", so it may take some time. But I'm curious what eventually happens after that.

hanikesn commented 1 week ago

But I'm curious what eventually happens after that.

It's in this state until the sync window opens. I saw a pre-sync hook stuck in pending as well. I couldn't reproduce right now. But will closely monitor when it happens again in our CD pipeline.

andrii-korotkov-verkada commented 3 days ago

I'll close for now, but feel free to re-open if this happens again. Try upgrading to v2.13.1 as well if not too much hassle.