From 0ad95c51bcefef6c1b42f7ebd64089e6ea13a8e7 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Wed, 5 Jun 2019 09:22:02 -0700 Subject: [PATCH] Sync wave (#28) --- README.md | 1 + sync-waves/manifests.yaml | 114 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 sync-waves/manifests.yaml diff --git a/README.md b/README.md index 1be07ab..10e14d8 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ to explore ArgoCD and GitOps! | [jsonnet-guestbook](jsonnet-guestbook/) | The guestbook application as a raw jsonnet | | [kustomize-guestbook](kustomize-guestbook/) | The guestbook application as a Kustomize 2 app | | [pre-post-sync](pre-post-sync/) | Demonstrates Argo CD PreSync and PostSync hooks | +| [sync-waves](sync-waves/) | Demonstrates Argo CD sync waves with hooks | | [helm-dependency](helm-dependency/) | Demonstrates how to customize an OTS (off-the-shelf) helm chart from an upstream repo | | [sock-shop](sock-shop/) | A microservices demo application (https://microservices-demo.github.io) | | [plugins](plugins/) | Applications which demonstrate config management plugins usage | diff --git a/sync-waves/manifests.yaml b/sync-waves/manifests.yaml new file mode 100644 index 0000000..11fddf1 --- /dev/null +++ b/sync-waves/manifests.yaml @@ -0,0 +1,114 @@ +--- +apiVersion: batch/v1 +kind: Job +metadata: + generateName: upgrade-sql-schema + annotations: + argocd.argoproj.io/hook: PreSync +spec: + template: + spec: + containers: + - name: upgrade-sql-schema + image: alpine:latest + command: ["sleep", "5"] + restartPolicy: Never +--- +apiVersion: apps/v1 +kind: ReplicaSet +metadata: + name: backend +spec: + replicas: 1 + selector: + matchLabels: + tier: backend + template: + metadata: + labels: + tier: backend + spec: + containers: + - name: main + image: nginx:latest +--- +apiVersion: v1 +kind: Service +metadata: + name: backend +spec: + selector: + tier: backend + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 +--- +apiVersion: batch/v1 +kind: Job +metadata: + generateName: maint-page-up- + annotations: + argocd.argoproj.io/hook: Sync + argocd.argoproj.io/hook-delete-policy: HookSucceeded + argocd.argoproj.io/sync-wave: "1" +spec: + template: + spec: + containers: + - name: page-up + image: alpine:latest + command: ["sleep", "2"] + restartPolicy: Never + backoffLimit: 0 +--- +apiVersion: apps/v1 +kind: ReplicaSet +metadata: + name: frontend + annotations: + argocd.argoproj.io/sync-wave: "2" +spec: + replicas: 1 + selector: + matchLabels: + tier: frontend + template: + metadata: + labels: + tier: frontend + spec: + containers: + - name: main + image: nginx:latest +--- +apiVersion: v1 +kind: Service +metadata: + name: frontend + annotations: + argocd.argoproj.io/sync-wave: "2" +spec: + selector: + tier: frontend + ports: + - protocol: TCP + port: 80 + targetPort: 80 +--- +apiVersion: batch/v1 +kind: Job +metadata: + generateName: maint-page-down- + annotations: + argocd.argoproj.io/hook: Sync + argocd.argoproj.io/hook-delete-policy: HookSucceeded + argocd.argoproj.io/sync-wave: "3" +spec: + template: + spec: + containers: + - name: page-down + image: alpine:latest + command: ["sleep", "2"] + restartPolicy: Never