diff --git a/README.md b/README.md index 7f8e430..abb78c4 100644 --- a/README.md +++ b/README.md @@ -20,23 +20,19 @@ ``` gitops/ ├── bootstrap/ -│ └── root-app.yaml # the app-of-apps (only file you apply manually, once) +│ ├── namespaces.yaml # cluster namespaces +│ ├── argocd-install/ # Argo CD install manifests + ingress +│ └── root-app.yaml # root Application watching apps/root ├── apps/ -│ └── root/ -│ ├── kustomization.yaml # lists every child Application -│ ├── argocd.yaml # Argo CD managing itself (dogfood) -│ ├── notepad.yaml -│ └── ... -└── apps// # per-app dir - ├── kustomization.yaml - ├── deployment.yaml - ├── service.yaml - ├── ingress.yaml - └── pvc.yaml +│ ├── root/ +│ │ ├── kustomization.yaml # points to applicationset.yaml +│ │ └── applicationset.yaml# auto-discovers apps/*/*.yaml +│ └── / # e.g., default/, media/, monitoring/ +│ ├── .yaml # all-in-one manifest per app +│ └── .yaml ``` -`apps/root/kustomization.yaml` is the switchboard — adding a service = adding one -`Application` entry + one folder. +To add a new app: simply drop `.yaml` into the appropriate `apps//` folder. The ApplicationSet automatically generates an Argo CD Application for it. ## 3. Manual bootstrap (run once, by hand) @@ -83,10 +79,7 @@ spec: selfHeal: true ``` -**`apps/root/argocd.yaml`** — Argo CD managing itself (standard dogfood pattern). -**Each child app** follows the same shape with `path: apps/` and -`destination.namespace` matching where it runs today (`default` for most of your -internal apps). +**`apps/root/applicationset.yaml`** — Uses the Git Files generator to discover any `apps/*/*.yaml` file and automatically generate an Argo CD `Application` pointing directly to that app file within the respective namespace. ## 5. Ingress (internal-only, per Haven convention) diff --git a/apps/notepad/all-in-one.yaml b/apps/default/notepad.yaml similarity index 100% rename from apps/notepad/all-in-one.yaml rename to apps/default/notepad.yaml diff --git a/apps/root/applicationset.yaml b/apps/root/applicationset.yaml new file mode 100644 index 0000000..eab94ec --- /dev/null +++ b/apps/root/applicationset.yaml @@ -0,0 +1,33 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: haven-apps + namespace: argocd +spec: + generators: + - git: + repoURL: https://git.ivanch.me/ivanch/haven-ops.git + revision: main + files: + - path: "apps/*/*.yaml" + template: + metadata: + name: "{{path.filenameNormalized}}" + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io + spec: + project: default + source: + repoURL: https://git.ivanch.me/ivanch/haven-ops.git + targetRevision: main + path: "{{path}}" + directory: + include: "{{path.filename}}" + destination: + server: https://kubernetes.default.svc + namespace: "{{path[1]}}" + syncPolicy: + automated: + prune: true + selfHeal: true diff --git a/apps/root/kustomization.yaml b/apps/root/kustomization.yaml index 1aa528f..7a2dffe 100644 --- a/apps/root/kustomization.yaml +++ b/apps/root/kustomization.yaml @@ -1,7 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization + resources: - - notepad.yaml - # - argocd.yaml # enable once Argo CD itself is onboarded (self-managed) - # - openwebui.yaml # future apps: one Application file each, listed here - # - paperless.yaml + - applicationset.yaml diff --git a/apps/root/notepad.yaml b/apps/root/notepad.yaml deleted file mode 100644 index 259fc79..0000000 --- a/apps/root/notepad.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: notepad - namespace: argocd - finalizers: - - resources-finalizer.argocd.argoproj.io -spec: - project: default - source: - repoURL: https://git.ivanch.me/ivanch/haven-ops.git - targetRevision: main - path: apps/notepad - destination: - server: https://kubernetes.default.svc - namespace: default - syncPolicy: - automated: - prune: true - selfHeal: true diff --git a/bootstrap/argocd-install/kustomization.yaml b/bootstrap/argocd-install/kustomization.yaml index 66f9ed0..d9b6492 100644 --- a/bootstrap/argocd-install/kustomization.yaml +++ b/bootstrap/argocd-install/kustomization.yaml @@ -4,6 +4,7 @@ kind: Kustomization namespace: argocd resources: + - https://github.com/argoproj/argo-cd.git/manifests/crds?ref=stable - https://github.com/argoproj/argo-cd.git/manifests/cluster-install?ref=stable - ingress.yaml