mirror of
https://github.com/khuedoan/homelab.git
synced 2025-07-14 17:59:24 +07:00
refactor(bootstrap)!: split argocd and root
This commit is contained in:
@ -1,16 +1,24 @@
|
|||||||
.POSIX:
|
.POSIX:
|
||||||
.EXPORT_ALL_VARIABLES:
|
.EXPORT_ALL_VARIABLES:
|
||||||
|
|
||||||
KUBECONFIG = ../metal/kubeconfig.yaml
|
KUBECONFIG = $(shell pwd)/../metal/kubeconfig.yaml
|
||||||
|
|
||||||
default: namespace apply
|
default: namespace argocd root
|
||||||
|
|
||||||
charts: Chart.yaml
|
argocd/charts: argocd/Chart.yaml
|
||||||
helm dependency update
|
cd argocd \
|
||||||
|
&& helm dependency update
|
||||||
|
|
||||||
namespace:
|
namespace:
|
||||||
kubectl create namespace argocd --dry-run=client --output=yaml \
|
kubectl create namespace argocd --dry-run=client --output=yaml \
|
||||||
| kubectl apply -f -
|
| kubectl apply -f -
|
||||||
|
|
||||||
apply: charts
|
.PHONY: argocd
|
||||||
|
argocd: argocd/charts
|
||||||
|
cd argocd && \
|
||||||
|
./apply.sh
|
||||||
|
|
||||||
|
.PHONY: root
|
||||||
|
root:
|
||||||
|
cd root && \
|
||||||
./apply.sh
|
./apply.sh
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
apiVersion: v2
|
apiVersion: v2
|
||||||
name: bootstrap
|
name: argocd
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: argo-cd
|
- 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
|
- secretName: argocd-tls-certificate
|
||||||
hosts:
|
hosts:
|
||||||
- *host
|
- *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
|
apiVersion: argoproj.io/v1alpha1
|
||||||
kind: ApplicationSet
|
kind: ApplicationSet
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ $stack }}
|
name: {{ $stack.name }}
|
||||||
namespace: {{ $.Release.Namespace }}
|
namespace: {{ $.Release.Namespace }}
|
||||||
spec:
|
spec:
|
||||||
generators:
|
generators:
|
||||||
@ -11,14 +11,14 @@ spec:
|
|||||||
repoURL: {{ $.Values.gitops.repo }}
|
repoURL: {{ $.Values.gitops.repo }}
|
||||||
revision: {{ $.Values.gitops.revision }}
|
revision: {{ $.Values.gitops.revision }}
|
||||||
directories:
|
directories:
|
||||||
- path: {{ $stack }}/*
|
- path: {{ $stack.name }}/*
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
name: '{{ `{{path.basename}}` }}'
|
name: '{{ `{{path.basename}}` }}'
|
||||||
spec:
|
spec:
|
||||||
destination:
|
destination:
|
||||||
name: in-cluster
|
name: in-cluster
|
||||||
namespace: '{{ `{{path.basename}}` }}'
|
namespace: '{{ default `{{path.basename}}` $stack.namespace }}'
|
||||||
project: default # TODO
|
project: default # TODO
|
||||||
source:
|
source:
|
||||||
repoURL: {{ $.Values.gitops.repo }}
|
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
|
|
Reference in New Issue
Block a user