From 3abafe0361a1f7b33ec509ea7a98c8ec984fe261 Mon Sep 17 00:00:00 2001 From: Roman Kathriner Date: Fri, 15 May 2020 23:41:08 +0200 Subject: [PATCH] Add way to enable app of apps in kustomize way --- app-of-apps-kustomize/base/config.env | 4 ++ .../base/helm-guestbook.yaml | 16 +++++++ app-of-apps-kustomize/base/helm-hooks.yaml | 16 +++++++ app-of-apps-kustomize/base/kustomization.yaml | 47 +++++++++++++++++++ .../base/kustomize-argocd-config.yaml | 13 +++++ .../base/kustomize-guestbook.yaml | 16 +++++++ app-of-apps-kustomize/base/namespaces.yaml | 27 +++++++++++ app-of-apps-kustomize/base/sync-waves.yaml | 16 +++++++ 8 files changed, 155 insertions(+) create mode 100644 app-of-apps-kustomize/base/config.env create mode 100644 app-of-apps-kustomize/base/helm-guestbook.yaml create mode 100644 app-of-apps-kustomize/base/helm-hooks.yaml create mode 100644 app-of-apps-kustomize/base/kustomization.yaml create mode 100644 app-of-apps-kustomize/base/kustomize-argocd-config.yaml create mode 100644 app-of-apps-kustomize/base/kustomize-guestbook.yaml create mode 100644 app-of-apps-kustomize/base/namespaces.yaml create mode 100644 app-of-apps-kustomize/base/sync-waves.yaml diff --git a/app-of-apps-kustomize/base/config.env b/app-of-apps-kustomize/base/config.env new file mode 100644 index 0000000..710c23f --- /dev/null +++ b/app-of-apps-kustomize/base/config.env @@ -0,0 +1,4 @@ +SERVER=https://kubernetes.default.svc +REPO_URL=https://github.com/argoproj/argocd-example-apps +TARGET_REVISION=HEADs +PROJECT=default diff --git a/app-of-apps-kustomize/base/helm-guestbook.yaml b/app-of-apps-kustomize/base/helm-guestbook.yaml new file mode 100644 index 0000000..a6e1b53 --- /dev/null +++ b/app-of-apps-kustomize/base/helm-guestbook.yaml @@ -0,0 +1,16 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: helm-guestbook + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + destination: + namespace: helm-guestbook + server: $(SERVER) + project: $(PROJECT) + source: + path: helm-guestbook + repoURL: $(REPO_URL) + targetRevision: $(TARGET_REVISION) diff --git a/app-of-apps-kustomize/base/helm-hooks.yaml b/app-of-apps-kustomize/base/helm-hooks.yaml new file mode 100644 index 0000000..a050be2 --- /dev/null +++ b/app-of-apps-kustomize/base/helm-hooks.yaml @@ -0,0 +1,16 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: helm-hooks + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + destination: + namespace: helm-hooks + server: $(SERVER) + project: $(PROJECT) + source: + path: helm-hooks + repoURL: $(REPO_URL) + targetRevision: $(TARGET_REVISION) diff --git a/app-of-apps-kustomize/base/kustomization.yaml b/app-of-apps-kustomize/base/kustomization.yaml new file mode 100644 index 0000000..577a09f --- /dev/null +++ b/app-of-apps-kustomize/base/kustomization.yaml @@ -0,0 +1,47 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +configurations: +- kustomize-argocd-config.yaml + +resources: +- helm-guestbook.yaml +- helm-hooks.yaml +- kustomize-guestbook.yaml +- namespaces.yaml +- sync-waves.yaml + +configMapGenerator: + - name: argocd-env + envs: + - config.env + +vars: +- name: SERVER + objref: + kind: ConfigMap + name: argocd-env + apiVersion: v1 + fieldref: + fieldpath: data.SERVER +- name: TARGET_REVISION + objref: + kind: ConfigMap + name: argocd-env + apiVersion: v1 + fieldref: + fieldpath: data.TARGET_REVISION +- name: PROJECT + objref: + kind: ConfigMap + name: argocd-env + apiVersion: v1 + fieldref: + fieldpath: data.PROJECT +- name: REPO_URL + objref: + kind: ConfigMap + name: argocd-env + apiVersion: v1 + fieldref: + fieldpath: data.REPO_URL diff --git a/app-of-apps-kustomize/base/kustomize-argocd-config.yaml b/app-of-apps-kustomize/base/kustomize-argocd-config.yaml new file mode 100644 index 0000000..7539090 --- /dev/null +++ b/app-of-apps-kustomize/base/kustomize-argocd-config.yaml @@ -0,0 +1,13 @@ +varReference: +- path: spec/destination/namespace + kind: Application + apiVersion: argoproj.io/v1alpha1 +- path: spec/destination/server + kind: Application + apiVersion: argoproj.io/v1alpha1 +- path: spec/project + kind: Application + apiVersion: argoproj.io/v1alpha1 +- path: spec/source/targetRevision + kind: Application + apiVersion: argoproj.io/v1alpha1 diff --git a/app-of-apps-kustomize/base/kustomize-guestbook.yaml b/app-of-apps-kustomize/base/kustomize-guestbook.yaml new file mode 100644 index 0000000..589eb56 --- /dev/null +++ b/app-of-apps-kustomize/base/kustomize-guestbook.yaml @@ -0,0 +1,16 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: kustomize-guestbook + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + destination: + namespace: kustomize-guestbook + server: $(SERVER) + project: $(PROJECT) + source: + path: kustomize-guestbook + repoURL: $(REPO_URL) + targetRevision: $(TARGET_REVISION) diff --git a/app-of-apps-kustomize/base/namespaces.yaml b/app-of-apps-kustomize/base/namespaces.yaml new file mode 100644 index 0000000..435e4ba --- /dev/null +++ b/app-of-apps-kustomize/base/namespaces.yaml @@ -0,0 +1,27 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: helm-guestbook + annotations: + argocd.argoproj.io/sync-wave: "-1" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: helm-hooks + annotations: + argocd.argoproj.io/sync-wave: "-1" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: kustomize-guestbook + annotations: + argocd.argoproj.io/sync-wave: "-1" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: sync-waves + annotations: + argocd.argoproj.io/sync-wave: "-1" diff --git a/app-of-apps-kustomize/base/sync-waves.yaml b/app-of-apps-kustomize/base/sync-waves.yaml new file mode 100644 index 0000000..f483d8f --- /dev/null +++ b/app-of-apps-kustomize/base/sync-waves.yaml @@ -0,0 +1,16 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: sync-waves + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + destination: + namespace: sync-waves + server: $(SERVER) + project: $(PROJECT) + source: + path: sync-waves + repoURL: $(REPO_URL) + targetRevision: $(TARGET_REVISION)