[Book] [OK!] 7.8 Define Synchronization Windows


Делаю:
2024.04.07


Разрешать и запрещать синхронизацию в зависимости от времени.


$ cat << 'EOF' | kubectl create -f -
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
  name: default
spec:
  syncWindows:
  - kind: allow
    schedule: '0 22 * * *'
    duration: 1h
    applications:
    - '*-prod'
EOF


$ cat << 'EOF' | kubectl create -f -
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
  name: default
  namespace: argocd
spec:
  syncWindows:
  - kind: deny
    schedule: '0 22 * * *'
    duration: 1h
    manualSync: true
    namespaces:
    - bgd
  - kind: allow
    schedule: '0 23 * * *'
    duration: 1h
    clusters:
    - prod-cluster
EOF


$ argocd proj windows list default
ID  STATUS    KIND   SCHEDULE    DURATION  APPLICATIONS  NAMESPACES  CLUSTERS      MANUALSYNC  TIMEZONE
0   Inactive  deny   0 22 * * *  1h        -             bgd         -             Enabled
1   Inactive  allow  0 23 * * *  1h        -             -           prod-cluster  Disabled