2.5.2. 例: 同時デプロイメントのための AllAtOnce 作成ストラテジー
次の例は、複数のクラスターにわたってすべてのアプリケーションを同時にデプロイするための AllAtOnce 作成ストラテジーの設定方法を示しています。
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: monitoring-apps
namespace: openshift-gitops
spec:
strategy:
type: AllAtOnce
generators:
- list:
elements:
- cluster: us-east-cluster
url: https://us-east-cluster.example.com
region: us-east
- cluster: us-west-cluster
url: https://us-west-cluster.example.com
region: us-west
- cluster: eu-central-cluster
url: https://eu-central-cluster.example.com
region: eu-central
template:
metadata:
name: 'monitoring-{{cluster}}'
labels:
region: '{{region}}'
spec:
project: default
source:
repoURL: https://github.com/example/monitoring-stack.git
targetRevision: HEAD
path: manifests
destination:
server: '{{url}}'
namespace: monitoring
syncPolicy:
automated:
prune: true
selfHeal: true
この例では、以下が適用されます。
- すべてのアプリケーションは、3 つのクラスターすべてにおいて同時に作成および更新されます。
- AllAtOnce ストラテジーは、すべてのクラスター監視インスタンスが独立しており、互いに依存関係がないため、このモニタリングスタックデプロイメントに適しています。
- ApplicationSet が更新されると、すべてのリージョンにわたるすべての監視アプリケーションが同時に更新を受信します。
- このアプローチにより、すべてのクラスターにわたって一貫した監視範囲が遅延なく展開されることが保証されます。