Progressive Syncs

Alpha Feature

This is an experimental, alpha-quality feature that allows you to control the order in which the ApplicationSet controller will create or update the Applications owned by an ApplicationSet resource. It may be removed in future releases or modified in backwards-incompatible ways.

Use Cases

The Progressive Syncs feature set is intended to be light and flexible. The feature only interacts with the health of managed Applications. It is not intended to support direct integrations with other Rollout controllers (such as the native ReplicaSet controller or Argo Rollouts).

  • Progressive Syncs watch for the managed Application resources to become “Healthy” before proceeding to the next stage.
  • Deployments, DaemonSets, StatefulSets, and Argo Rollouts are all supported, because the Application enters a “Progressing” state while pods are being rolled out. In fact, any resource with a health check that can report a “Progressing” status is supported.
  • Argo CD Resource Hooks are supported. We recommend this approach for users that need advanced functionality when an Argo Rollout cannot be used, such as smoke testing after a DaemonSet change.

Enabling Progressive Syncs

As an experimental feature, progressive syncs must be explicitly enabled, in one of these ways.

  1. Pass --enable-progressive-syncs to the ApplicationSet controller args.
  2. Set ARGOCD_APPLICATIONSET_CONTROLLER_ENABLE_PROGRESSIVE_SYNCS=true in the ApplicationSet controller environment variables.
  3. Set applicationsetcontroller.enable.progressive.syncs: true in the Argo CD argocd-cmd-params-cm ConfigMap.

Strategies

  • AllAtOnce (default)
  • RollingSync

AllAtOnce

This default Application update behavior is unchanged from the original ApplicationSet implementation.

All Applications managed by the ApplicationSet resource are updated simultaneously when the ApplicationSet is updated.

RollingSync

This update strategy allows you to group Applications by labels present on the generated Application resources. When the ApplicationSet changes, the changes will be applied to each group of Application resources sequentially.

  • Application groups are selected using their labels and matchExpressions.
  • All matchExpressions must be true for an Application to be selected (multiple expressions match with AND behavior).
  • The In and NotIn operators must match at least one value to be considered true (OR behavior).
  • The NotIn operator has priority in the event that both a NotIn and In operator produce a match.
  • All Applications in each group must become Healthy before the ApplicationSet controller will proceed to update the next group of Applications.
  • The number of simultaneous Application updates in a group will not exceed its maxUpdate parameter (default is 100%, unbounded).
  • RollingSync will capture external changes outside the ApplicationSet resource, since it relies on watching the OutOfSync status of the managed Applications.
  • RollingSync will force all generated Applications to have autosync disabled. Warnings are printed in the applicationset-controller logs for any Application specs with an automated syncPolicy enabled.
  • Sync operations are triggered the same way as if they were triggered by the UI or CLI (by directly setting the operation status field on the Application resource). This means that a RollingSync will respect sync windows just as if a user had clicked the “Sync” button in the Argo UI.
  • When a sync is triggered, the sync is performed with the same syncPolicy configured for the Application. For example, this preserves the Application’s retry settings.
  • If an Application is considered “Pending” for applicationsetcontroller.default.application.progressing.timeout seconds, the Application is automatically moved to Healthy status (default 300).

Example

The following example illustrates how to stage a progressive sync over Applications with explicitly configured environment labels.

Once a change is pushed, the following will happen in order.

  • All env-dev Applications will be updated simultaneously.
  • The rollout will wait for all env-qa Applications to be manually synced via the argocd CLI or by clicking the Sync button in the UI.
  • 10% of all env-prod Applications will be updated at a time until all env-prod Applications have been updated.
  1. ---
  2. apiVersion: argoproj.io/v1alpha1
  3. kind: ApplicationSet
  4. metadata:
  5. name: guestbook
  6. spec:
  7. generators:
  8. - list:
  9. elements:
  10. - cluster: engineering-dev
  11. url: https://1.2.3.4
  12. env: env-dev
  13. - cluster: engineering-qa
  14. url: https://2.4.6.8
  15. env: env-qa
  16. - cluster: engineering-prod
  17. url: https://9.8.7.6/
  18. env: env-prod
  19. strategy:
  20. type: RollingSync
  21. rollingSync:
  22. steps:
  23. - matchExpressions:
  24. - key: envLabel
  25. operator: In
  26. values:
  27. - env-dev
  28. #maxUpdate: 100% # if undefined, all applications matched are updated together (default is 100%)
  29. - matchExpressions:
  30. - key: envLabel
  31. operator: In
  32. values:
  33. - env-qa
  34. maxUpdate: 0 # if 0, no matched applications will be updated
  35. - matchExpressions:
  36. - key: envLabel
  37. operator: In
  38. values:
  39. - env-prod
  40. maxUpdate: 10% # maxUpdate supports both integer and percentage string values (rounds down, but floored at 1 Application for >0%)
  41. goTemplate: true
  42. goTemplateOptions: ["missingkey=error"]
  43. template:
  44. metadata:
  45. name: '{{.cluster}}-guestbook'
  46. labels:
  47. envLabel: '{{.env}}'
  48. spec:
  49. project: my-project
  50. source:
  51. repoURL: https://github.com/infra-team/cluster-deployments.git
  52. targetRevision: HEAD
  53. path: guestbook/{{.cluster}}
  54. destination:
  55. server: '{{.url}}'
  56. namespace: guestbook