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