From 4dd44e6999b3d2e08720030a865feb0a5d51f88e Mon Sep 17 00:00:00 2001 From: Edward Cheng Date: Mon, 15 Jul 2024 09:14:58 +1000 Subject: [PATCH] add resources sync-job --- resources/sync-job/base/kustomization.yaml | 5 +++++ resources/sync-job/base/post-sync-job.yaml | 16 ++++++++++++++++ resources/sync-job/base/pre-sync-job.yaml | 16 ++++++++++++++++ resources/sync-job/env/k3s-cluster/config.json | 11 +++++++++++ .../sync-job/env/k3s-cluster/kustomization.yaml | 4 ++++ 5 files changed, 52 insertions(+) create mode 100644 resources/sync-job/base/kustomization.yaml create mode 100644 resources/sync-job/base/post-sync-job.yaml create mode 100644 resources/sync-job/base/pre-sync-job.yaml create mode 100644 resources/sync-job/env/k3s-cluster/config.json create mode 100644 resources/sync-job/env/k3s-cluster/kustomization.yaml diff --git a/resources/sync-job/base/kustomization.yaml b/resources/sync-job/base/kustomization.yaml new file mode 100644 index 0000000..3cd0c42 --- /dev/null +++ b/resources/sync-job/base/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./pre-sync-job.yaml + - ./post-sync-job.yaml \ No newline at end of file diff --git a/resources/sync-job/base/post-sync-job.yaml b/resources/sync-job/base/post-sync-job.yaml new file mode 100644 index 0000000..cef38f0 --- /dev/null +++ b/resources/sync-job/base/post-sync-job.yaml @@ -0,0 +1,16 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: after + annotations: + argocd.argoproj.io/hook: PostSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded +spec: + template: + spec: + containers: + - name: sleep + image: alpine:latest + command: ["sleep", "10"] + restartPolicy: Never + backoffLimit: 0 diff --git a/resources/sync-job/base/pre-sync-job.yaml b/resources/sync-job/base/pre-sync-job.yaml new file mode 100644 index 0000000..110ddeb --- /dev/null +++ b/resources/sync-job/base/pre-sync-job.yaml @@ -0,0 +1,16 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: before + annotations: + argocd.argoproj.io/hook: PreSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded +spec: + template: + spec: + containers: + - name: sleep + image: alpine:latest + command: ["sleep", "10"] + restartPolicy: Never + backoffLimit: 0 diff --git a/resources/sync-job/env/k3s-cluster/config.json b/resources/sync-job/env/k3s-cluster/config.json new file mode 100644 index 0000000..6a1af33 --- /dev/null +++ b/resources/sync-job/env/k3s-cluster/config.json @@ -0,0 +1,11 @@ +{ + "appName": "sync-job", + "userGivenName": "sync-job", + "destNamespace": "argocd", + "destServer": "https://kubernetes.default.svc", + "srcPath": "resources/sync-job/env/k3s-cluster", + "srcRepoURL": "https://github.com/3dwardch3ng/home-cluster-ops.git", + "srcTargetRevision": "", + "labels": null, + "annotations": null +} \ No newline at end of file diff --git a/resources/sync-job/env/k3s-cluster/kustomization.yaml b/resources/sync-job/env/k3s-cluster/kustomization.yaml new file mode 100644 index 0000000..a227ac4 --- /dev/null +++ b/resources/sync-job/env/k3s-cluster/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../../base \ No newline at end of file