mirror of
https://github.com/khuedoan/homelab.git
synced 2025-02-24 21:52:36 +07:00
refactor(bootstrap)!: split argocd and root
This commit is contained in:
parent
c3eaf7ee06
commit
f4b63c018f
@ -1,16 +1,24 @@
|
||||
.POSIX:
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
KUBECONFIG = ../metal/kubeconfig.yaml
|
||||
KUBECONFIG = $(shell pwd)/../metal/kubeconfig.yaml
|
||||
|
||||
default: namespace apply
|
||||
default: namespace argocd root
|
||||
|
||||
charts: Chart.yaml
|
||||
helm dependency update
|
||||
argocd/charts: argocd/Chart.yaml
|
||||
cd argocd \
|
||||
&& helm dependency update
|
||||
|
||||
namespace:
|
||||
kubectl create namespace argocd --dry-run=client --output=yaml \
|
||||
| kubectl apply -f -
|
||||
|
||||
apply: charts
|
||||
./apply.sh
|
||||
.PHONY: argocd
|
||||
argocd: argocd/charts
|
||||
cd argocd && \
|
||||
./apply.sh
|
||||
|
||||
.PHONY: root
|
||||
root:
|
||||
cd root && \
|
||||
./apply.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
apiVersion: v2
|
||||
name: bootstrap
|
||||
name: argocd
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
- name: argo-cd
|
11
bootstrap/argocd/apply.sh
Executable file
11
bootstrap/argocd/apply.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
helm template \
|
||||
--include-crds \
|
||||
--namespace argocd \
|
||||
argocd . \
|
||||
| kubectl apply -n argocd -f -
|
||||
|
||||
kubectl -n argocd wait --timeout=60s --for condition=Established \
|
||||
crd/applications.argoproj.io \
|
||||
crd/applicationsets.argoproj.io
|
@ -54,11 +54,3 @@ argo-cd:
|
||||
- secretName: argocd-tls-certificate
|
||||
hosts:
|
||||
- *host
|
||||
|
||||
gitops:
|
||||
repo: https://git.khuedoan.com/ops/homelab
|
||||
revision: master
|
||||
stacks:
|
||||
- system
|
||||
- platform
|
||||
- apps
|
3
bootstrap/root/Chart.yaml
Normal file
3
bootstrap/root/Chart.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
apiVersion: v2
|
||||
name: root
|
||||
version: 0.0.0
|
@ -3,7 +3,7 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: ApplicationSet
|
||||
metadata:
|
||||
name: {{ $stack }}
|
||||
name: {{ $stack.name }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
spec:
|
||||
generators:
|
||||
@ -11,14 +11,14 @@ spec:
|
||||
repoURL: {{ $.Values.gitops.repo }}
|
||||
revision: {{ $.Values.gitops.revision }}
|
||||
directories:
|
||||
- path: {{ $stack }}/*
|
||||
- path: {{ $stack.name }}/*
|
||||
template:
|
||||
metadata:
|
||||
name: '{{ `{{path.basename}}` }}'
|
||||
spec:
|
||||
destination:
|
||||
name: in-cluster
|
||||
namespace: '{{ `{{path.basename}}` }}'
|
||||
namespace: '{{ default `{{path.basename}}` $stack.namespace }}'
|
||||
project: default # TODO
|
||||
source:
|
||||
repoURL: {{ $.Values.gitops.repo }}
|
9
bootstrap/root/values.yaml
Normal file
9
bootstrap/root/values.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
gitops:
|
||||
repo: https://git.khuedoan.com/ops/homelab
|
||||
revision: master
|
||||
stacks:
|
||||
- name: bootstrap
|
||||
namespace: argocd # Override default value
|
||||
- name: system
|
||||
- name: platform
|
||||
- name: apps
|
@ -1,23 +0,0 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: argocd
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
destination:
|
||||
name: in-cluster
|
||||
namespace: {{ .Release.Namespace }}
|
||||
project: default
|
||||
source:
|
||||
repoURL: {{ .Values.gitops.repo }}
|
||||
targetRevision: {{ $.Values.gitops.revision }}
|
||||
path: bootstrap
|
||||
syncPolicy:
|
||||
automated:
|
||||
selfHeal: true
|
||||
retry:
|
||||
backoff:
|
||||
duration: 1m
|
||||
factor: 2
|
||||
maxDuration: 16m
|
||||
limit: 10
|
Loading…
Reference in New Issue
Block a user