Initial monorepo scaffold
Turborepo + pnpm monorepo for k3s homelab cluster on Intel NUCs. - Apps: Next.js web frontend, Express API (TypeScript, Dockerfiles, k8s manifests) - Packages: shared UI, ESLint config, TypeScript config, Drizzle DB schemas - Infra/Ansible: bare-metal provisioning with roles for common, k3s-server, k3s-agent, hardening - Infra/Kubernetes: ArgoCD GitOps (app-of-apps + ApplicationSets), platform components (cert-manager, Traefik, CloudNativePG, Valkey, Longhorn, Sealed Secrets), namespaces - Observability: kube-prometheus-stack, Loki, Promtail as ArgoCD Applications - CI/CD: GitHub Actions for PR builds, preview deploys, production deploys - DX: Taskfile, utility scripts, copier templates, Ubiquiti network docs
This commit is contained in:
22
infra/kubernetes/argocd/app-of-apps.yaml
Normal file
22
infra/kubernetes/argocd/app-of-apps.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: app-of-apps
|
||||
namespace: argocd
|
||||
finalizers:
|
||||
- resources-finalizer.argocd.argoproj.io
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: https://github.com/OWNER/homelab.git
|
||||
targetRevision: main
|
||||
path: infra/kubernetes/argocd
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: argocd
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
30
infra/kubernetes/argocd/appsets/apps.yaml
Normal file
30
infra/kubernetes/argocd/appsets/apps.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: ApplicationSet
|
||||
metadata:
|
||||
name: apps-production
|
||||
namespace: argocd
|
||||
spec:
|
||||
goTemplate: true
|
||||
goTemplateOptions: ["missingkey=error"]
|
||||
generators:
|
||||
- git:
|
||||
repoURL: https://github.com/OWNER/homelab.git
|
||||
revision: main
|
||||
directories:
|
||||
- path: apps/*/k8s/overlays/production
|
||||
template:
|
||||
metadata:
|
||||
name: "{{ index .path.segments 1 }}-production"
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: https://github.com/OWNER/homelab.git
|
||||
targetRevision: main
|
||||
path: "{{ .path.path }}"
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: apps
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
32
infra/kubernetes/argocd/appsets/platform.yaml
Normal file
32
infra/kubernetes/argocd/appsets/platform.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: ApplicationSet
|
||||
metadata:
|
||||
name: platform
|
||||
namespace: argocd
|
||||
spec:
|
||||
goTemplate: true
|
||||
goTemplateOptions: ["missingkey=error"]
|
||||
generators:
|
||||
- git:
|
||||
repoURL: https://github.com/OWNER/homelab.git
|
||||
revision: main
|
||||
directories:
|
||||
- path: infra/kubernetes/platform/*
|
||||
template:
|
||||
metadata:
|
||||
name: "platform-{{ .path.basename }}"
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: https://github.com/OWNER/homelab.git
|
||||
targetRevision: main
|
||||
path: "{{ .path.path }}"
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: platform
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
34
infra/kubernetes/argocd/appsets/previews.yaml
Normal file
34
infra/kubernetes/argocd/appsets/previews.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: ApplicationSet
|
||||
metadata:
|
||||
name: apps-preview
|
||||
namespace: argocd
|
||||
spec:
|
||||
goTemplate: true
|
||||
goTemplateOptions: ["missingkey=error"]
|
||||
generators:
|
||||
- pullRequest:
|
||||
github:
|
||||
owner: OWNER
|
||||
repo: homelab
|
||||
requeueAfterSeconds: 60
|
||||
template:
|
||||
metadata:
|
||||
name: "preview-{{ .number }}"
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: https://github.com/OWNER/homelab.git
|
||||
targetRevision: "{{ .branch }}"
|
||||
path: apps/*/k8s/overlays/preview
|
||||
kustomize:
|
||||
nameSuffix: "-pr{{ .number }}"
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: "preview-{{ .number }}"
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
2
infra/kubernetes/argocd/install.yaml
Normal file
2
infra/kubernetes/argocd/install.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
# ArgoCD is installed via Kustomize remote base.
|
||||
# See kustomization.yaml for the version-pinned reference.
|
||||
22
infra/kubernetes/argocd/kustomization.yaml
Normal file
22
infra/kubernetes/argocd/kustomization.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: argocd
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- https://raw.githubusercontent.com/argoproj/argo-cd/v2.13.3/manifests/install.yaml
|
||||
- app-of-apps.yaml
|
||||
- appsets/platform.yaml
|
||||
- appsets/apps.yaml
|
||||
- appsets/previews.yaml
|
||||
patches:
|
||||
- target:
|
||||
kind: ConfigMap
|
||||
name: argocd-cm
|
||||
patch: |
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: argocd-cm
|
||||
data:
|
||||
url: https://argocd.homelab.local
|
||||
application.resourceTrackingMethod: annotation
|
||||
4
infra/kubernetes/argocd/namespace.yaml
Normal file
4
infra/kubernetes/argocd/namespace.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: argocd
|
||||
Reference in New Issue
Block a user