From 959c74c542e0e117cdc8ceac921c986fe60aef4b Mon Sep 17 00:00:00 2001 From: Khue Doan Date: Sun, 23 May 2021 02:56:21 +0700 Subject: [PATCH] Use kustomize for apps layer --- apps/Makefile | 10 +++------- apps/kustomization.yaml | 18 ++++++++++++++++++ apps/{ => resources}/cert-manager.yaml | 0 apps/{ => resources}/gitea.yaml | 0 apps/{ => resources}/longhorn.yaml | 0 apps/{ => resources}/metallb.yaml | 0 apps/resources/namespace.yaml | 4 ++++ apps/{ => resources}/nginx.yaml | 0 apps/{ => resources}/prometheus.yaml | 0 apps/{ => resources}/vault.yaml | 0 10 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 apps/kustomization.yaml rename apps/{ => resources}/cert-manager.yaml (100%) rename apps/{ => resources}/gitea.yaml (100%) rename apps/{ => resources}/longhorn.yaml (100%) rename apps/{ => resources}/metallb.yaml (100%) create mode 100644 apps/resources/namespace.yaml rename apps/{ => resources}/nginx.yaml (100%) rename apps/{ => resources}/prometheus.yaml (100%) rename apps/{ => resources}/vault.yaml (100%) diff --git a/apps/Makefile b/apps/Makefile index 6ab43808..d2875fe5 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -3,14 +3,10 @@ KUBECONFIG = ../infra/kube_config.yaml -default: init apply - -init: - kubectl create namespace argocd --dry-run=client -o yaml | kubectl apply -f - - kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml +default: apply apply: - kubectl --namespace argocd apply --filename . + kubectl apply --kustomize . delete: - kubectl --namespace argocd delete --filename . + kubectl delete --kustomize . diff --git a/apps/kustomization.yaml b/apps/kustomization.yaml new file mode 100644 index 00000000..83cdb8ca --- /dev/null +++ b/apps/kustomization.yaml @@ -0,0 +1,18 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +# Prerequisites +- resources/namespace.yaml +- github.com/argoproj/argo-cd//manifests/cluster-install?ref=v2.0.2 +# System +- resources/cert-manager.yaml +- resources/longhorn.yaml +- resources/metallb.yaml +- resources/nginx.yaml +- resources/prometheus.yaml +- resources/vault.yaml +# Applications +- resources/gitea.yaml + +namespace: argocd diff --git a/apps/cert-manager.yaml b/apps/resources/cert-manager.yaml similarity index 100% rename from apps/cert-manager.yaml rename to apps/resources/cert-manager.yaml diff --git a/apps/gitea.yaml b/apps/resources/gitea.yaml similarity index 100% rename from apps/gitea.yaml rename to apps/resources/gitea.yaml diff --git a/apps/longhorn.yaml b/apps/resources/longhorn.yaml similarity index 100% rename from apps/longhorn.yaml rename to apps/resources/longhorn.yaml diff --git a/apps/metallb.yaml b/apps/resources/metallb.yaml similarity index 100% rename from apps/metallb.yaml rename to apps/resources/metallb.yaml diff --git a/apps/resources/namespace.yaml b/apps/resources/namespace.yaml new file mode 100644 index 00000000..a040f2ba --- /dev/null +++ b/apps/resources/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: argocd diff --git a/apps/nginx.yaml b/apps/resources/nginx.yaml similarity index 100% rename from apps/nginx.yaml rename to apps/resources/nginx.yaml diff --git a/apps/prometheus.yaml b/apps/resources/prometheus.yaml similarity index 100% rename from apps/prometheus.yaml rename to apps/resources/prometheus.yaml diff --git a/apps/vault.yaml b/apps/resources/vault.yaml similarity index 100% rename from apps/vault.yaml rename to apps/resources/vault.yaml