github.com/argoproj/argo-cd@v1.8.7/docs/user-guide/sync_windows.md (about)

     1  # Sync Windows
     2  
     3  Sync windows are configurable windows of time where syncs will either be blocked or allowed. These are defined
     4  by a kind, which can be either `allow` or `deny`, a `schedule` in cron format and a duration along with one or 
     5  more of either `applications`, `namespaces` and `clusters`. Wildcards are supported. These windows affect the running 
     6  of both manual and automated syncs but allow an override for manual syncs which is useful if you are only interested
     7  in preventing automated syncs or if you need to temporarily override a window to perform a sync.
     8  
     9  The windows work in the following way. If there are no windows matching an application then all syncs are allowed. If there
    10  are any `allow` windows matching an application then syncs will only be allowed when there ia an active `allow` windows. If there
    11  are any `deny` windows matching an application then all syncs will be denied when the `deny` windows are active. If there is an
    12  active matching `allow` and an active matching `deny` then syncs will be denied as `deny` windows override `allow` windows. The
    13  UI and the CLI will both display the state of the sync windows. The UI has a panel which will display different colours depending
    14  on the state. The colours are as follows. `Red: sync denied`, `Orange: manual allowed` and `Green: sync allowed`.
    15  
    16  To display the sync state using the CLI:
    17  
    18  ```bash
    19  argocd app get APP
    20  ```
    21  
    22  Which will return the sync state and any matching windows.
    23  
    24  ```
    25  Name:               guestbook
    26  Project:            default
    27  Server:             in-cluster
    28  Namespace:          default
    29  URL:                http://localhost:8080/applications/guestbook
    30  Repo:               https://github.com/argoproj/argocd-example-apps.git
    31  Target:
    32  Path:               guestbook
    33  SyncWindow:         Sync Denied
    34  Assigned Windows:   deny:0 2 * * *:1h,allow:0 2 3 3 3:1h
    35  Sync Policy:        Automated
    36  Sync Status:        Synced to  (5c2d89b)
    37  Health Status:      Healthy
    38  ```
    39  
    40  Windows can be created using the CLI:
    41  
    42  ```bash
    43  argocd proj windows add PROJECT \
    44      --kind allow \
    45      --schedule "0 22 * * *" \
    46      --duration 1h \
    47      --applications "*"
    48  ```
    49  
    50  Alternatively, they can be created directly in the `AppProject` manifest:
    51   
    52  ```yaml
    53  apiVersion: argoproj.io/v1alpha1
    54  kind: AppProject
    55  metadata:
    56    name: default
    57  spec:
    58    syncWindows:
    59    - kind: allow
    60      schedule: '10 1 * * *'
    61      duration: 1h
    62      applications:
    63      - '*-prod'
    64      manualSync: true
    65    - kind: deny
    66      schedule: '0 22 * * *'
    67      duration: 1h
    68      namespaces:
    69      - default
    70     - kind: allow
    71       schedule: '0 23 * * *'
    72       duration: 1h
    73       clusters:
    74       - in-cluster
    75       - cluster1
    76  ```
    77  
    78  In order to perform a sync when syncs are being prevented by a window, you can configure the window to allow manual syncs
    79  using the CLI, UI or directly in the `AppProject` manifest:
    80  
    81  ```bash
    82  argocd proj windows enable-manual-sync PROJECT ID
    83  ```
    84  
    85  To disable
    86  
    87  ```bash
    88  argocd proj windows disable-manual-sync PROJECT ID
    89  ```
    90  
    91  Windows can be listed using the CLI or viewed in the UI:
    92  
    93  ```bash
    94  argocd proj windows list PROJECT
    95  ```
    96  
    97  ```bash
    98  ID  STATUS    KIND   SCHEDULE    DURATION  APPLICATIONS  NAMESPACES  CLUSTERS  MANUALSYNC
    99  0   Active    allow  * * * * *   1h        -             -           prod1     Disabled
   100  1   Inactive  deny   * * * * 1   3h        -             default     -         Disabled
   101  2   Inactive  allow  1 2 * * *   1h        prod-*        -           -         Enabled
   102  3   Active    deny   * * * * *   1h        -             default     -         Disabled
   103  ```
   104  
   105  All fields of a window can be updated using either the CLI or UI. The `applications`, `namespaces` and `clusters` fields
   106  require the update to contain all of the required values. For example if updating the `namespaces` field and it already
   107  contains default and kube-system then the new value would have to include those in the list. 
   108  
   109  ```bash
   110  argocd proj windows update PROJECT ID --namespaces default,kube-system,prod1
   111  ```