Skip to content

Commit 0c30d57

Browse files
committed
tweak
1 parent 396682f commit 0c30d57

3 files changed

Lines changed: 38 additions & 38 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ graph TD;
4343
ArgoCD -- "1. Syncs" --> RootApp;
4444
RootApp -- "2. Points to<br/>.../argocd/apps/" --> ArgoConfigDir["ArgoCD Config<br/>(Projects & AppSets)"];
4545
ArgoCD -- "3. Deploys" --> AppSets["ApplicationSets"];
46-
AppSets -- "4. Scan Repo for<br/>argo-app.yaml" --> AppManifests["Application Manifests<br/>(e.g., my-apps/nginx/*)"];
46+
AppSets -- "4. Scans Repo for<br/>Application Directories" --> AppManifests["Application Manifests<br/>(e.g., my-apps/nginx/)"];
4747
ArgoCD -- "5. Deploys" --> ClusterResources["Cluster Resources<br/>(Nginx, Prometheus, etc.)"];
4848
end
4949
@@ -56,7 +56,7 @@ graph TD;
5656
### Key Features
5757
- **Enterprise GitOps Pattern**: ApplicationSets provide clean separation of concerns.
5858
- **Self-Managing ArgoCD**: ArgoCD manages its own installation, upgrades, and ApplicationSets from a co-located `apps` directory.
59-
- **Simple Metadata Discovery**: Applications are discovered via a simple `argo-app.yaml` marker file. No complex pathing needed.
59+
- **Simple Directory Discovery**: Applications are discovered automatically based on their directory path. No extra files needed.
6060
- **Production Ready**: Proper error handling, retries, and monitoring integration.
6161
- **GPU Integration**: Full NVIDIA GPU support via Talos system extensions and GPU Operator
6262
- **Zero SSH**: All node management via Talosctl API
@@ -175,7 +175,7 @@ kubectl apply -f infrastructure/controllers/argocd/root.yaml
175175
176176
1. **ArgoCD Syncs Itself**: The `root` Application tells ArgoCD to sync the contents of `infrastructure/controllers/argocd/apps/`.
177177
2. **Projects & AppSets Created**: ArgoCD creates the `AppProject`s and the three `ApplicationSet`s (`infrastructure`, `monitoring`, `my-apps`).
178-
3. **Applications Discovered**: The `ApplicationSet`s scan the repository for any directory containing an `argo-app.yaml` file and create the corresponding ArgoCD `Application` resources.
178+
3. **Applications Discovered**: The `ApplicationSet`s scan the repository for any directories matching their defined paths (e.g., `my-apps/*/*`) and create the corresponding ArgoCD `Application` resources.
179179
4. **Cluster Reconciliation**: ArgoCD syncs all discovered applications, building the entire cluster state declaratively from Git.
180180
181181
## 🔍 Verification

docs/argocd.md

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ graph TD;
2020
ArgoCD -- "1. Syncs" --> RootApp;
2121
RootApp -- "2. Points to<br/>.../argocd/apps/" --> ArgoConfigDir["ArgoCD Config<br/>(Projects & AppSets)"];
2222
ArgoCD -- "3. Deploys" --> AppSets["ApplicationSets"];
23-
AppSets -- "4. Scan Repo for<br/>argo-app.yaml" --> AppManifests["Application Manifests<br/>(e.g., my-apps/nginx/*)"];
23+
AppSets -- "4. Scans Repo for<br/>Application Directories" --> AppManifests["Application Manifests<br/>(e.g., my-apps/nginx/)"];
2424
ArgoCD -- "5. Deploys" --> ClusterResources["Cluster Resources<br/>(Nginx, Prometheus, etc.)"];
2525
end
2626
@@ -65,18 +65,14 @@ These `AppProject` resources are defined in `infrastructure/controllers/argocd/a
6565

6666
## 📱 ApplicationSet Management
6767

68-
We use **three simple ApplicationSets** that discover applications based on a metadata file.
68+
We use **three simple ApplicationSets** that discover applications based on their directory structure. This follows a "convention over configuration" approach, eliminating the need for metadata files.
6969

70-
### 1. The "Application as Metadata" Pattern
71-
Instead of relying on directory paths, our `ApplicationSet`s discover applications by looking for a marker file named `argo-app.yaml`.
70+
### 1. The "Directory as Application" Pattern
71+
Instead of relying on marker files, our `ApplicationSet`s discover applications by looking for directories that match a predefined path pattern. The application's name and target namespace are derived directly from this path.
7272

73-
An example `argo-app.yaml` for `my-apps/development/nginx`:
74-
```yaml
75-
# This file provides the metadata for the ApplicationSet generator.
76-
# It tells ArgoCD how to create the Application for this component.
77-
name: my-app-nginx
78-
namespace: nginx
79-
```
73+
For an application at `my-apps/development/nginx`, the `ApplicationSet` will automatically:
74+
- Create an ArgoCD Application named `my-apps-development-nginx`.
75+
- Deploy the application into the `nginx` namespace.
8076

8177
### 2. ApplicationSet Configuration
8278
All `ApplicationSet`s live in `infrastructure/controllers/argocd/apps/appsets/` and follow the same pattern. Here is the `my-apps-appset.yaml` as an example:
@@ -93,25 +89,28 @@ spec:
9389
- git:
9490
repoURL: https://github.com/mitchross/k3s-argocd-proxmox.git
9591
revision: HEAD
96-
# Discover any 'argo-app.yaml' file within the my-apps directory.
97-
files:
98-
- path: "my-apps/**/argo-app.yaml"
92+
# Discover any directory matching the pattern.
93+
directories:
94+
- path: "my-apps/*/*"
9995
template:
10096
metadata:
101-
# Name comes from the 'name' field in argo-app.yaml
102-
name: '{{name}}'
97+
# Name is derived from the directory path.
98+
name: 'my-apps-{{path.basenameNormalized}}-{{path[2]}}'
10399
namespace: argocd
104100
spec:
105101
project: my-apps
106102
source:
107103
repoURL: https://github.com/mitchross/k3s-argocd-proxmox.git
108104
targetRevision: HEAD
109-
# Path points to the directory where the argo-app.yaml was found
110-
path: '{{path.directory}}'
105+
# Path points to the discovered directory.
106+
path: '{{path}}'
107+
# Enable Helm charts for Kustomize
108+
kustomize:
109+
buildOptions: "--enable-helm"
111110
destination:
112111
server: https://kubernetes.default.svc
113-
# Namespace comes from the 'namespace' field in argo-app.yaml
114-
namespace: '{{namespace}}'
112+
# Namespace is the last part of the path (e.g., "nginx").
113+
namespace: '{{path.basenameNormalized}}'
115114
syncPolicy:
116115
automated:
117116
prune: true
@@ -135,20 +134,17 @@ The repository structure is designed for clarity and co-location of configuratio
135134
│ │ │ └── my-apps-appset.yaml
136135
│ │ ├── projects.yaml
137136
│ │ └── kustomization.yaml
138-
│ ├── argo-app.yaml # <-- Marker for ArgoCD itself
139137
│ ├── http-route.yaml
140138
│ ├── ns.yaml
141139
│ ├── root.yaml # <-- The "root" app (App of Apps)
142140
│ ├── values.yaml
143141
│ └── kustomization.yaml # <-- The BOOTSTRAP kustomization
144142
├── monitoring/
145-
│ └── prometheus-stack/
146-
│ ├── argo-app.yaml # <-- Example marker file
143+
│ └── prometheus-stack/ # <-- Example discovered application
147144
│ └── ...
148145
└── my-apps/
149146
└── development/
150-
└── nginx/
151-
├── argo-app.yaml # <-- Example marker file
147+
└── nginx/ # <-- Example discovered application
152148
└── ...
153149
```
154150

@@ -162,8 +158,8 @@ The repository structure is designed for clarity and co-location of configuratio
162158
- Clear separation of concerns with three `ApplicationSet`s.
163159
- Follows GitOps best practices used in production.
164160

165-
3. **Simple Metadata Discovery**:
166-
- Applications are discovered via `argo-app.yaml` files, not brittle directory pathing. This is flexible and clear.
161+
3. **Simple Directory Discovery**:
162+
- Applications are discovered automatically based on their directory structure. This is flexible, clear, and requires no boilerplate.
167163

168164
4. **Production Ready**:
169165
- The `ApplicationSet`s use `preserveResourcesOnDeletion: true` as a safety mechanism to prevent accidental mass-deletions.
@@ -197,14 +193,19 @@ kubectl get applications -n argocd -l argocd.argoproj.io/project=my-apps
197193

198194
## 🔍 Application Naming Conventions
199195

200-
The `ApplicationSet`s use the `name` field from each `argo-app.yaml` to name the application in ArgoCD, giving you full control.
196+
The `ApplicationSet`s use the directory `path` to automatically generate the application name and target namespace. This creates a consistent and predictable naming scheme.
197+
198+
- **Application Name**: Combines the project (`my-apps`, `infrastructure`, `monitoring`) with the directory path.
199+
- `my-apps/development/nginx` -> `my-apps-nginx-development`
200+
- **Target Namespace**: Uses the final directory in the path.
201+
- `my-apps/development/nginx` -> `nginx`
201202

202203
## Best Practices
203204

204205
- **All cluster state is managed in Git** - no manual changes are made via `kubectl`.
205206
- **ArgoCD manages itself** - including its projects and `ApplicationSet` configurations.
206207
- **Clear separation** - infrastructure, monitoring, and applications are separate projects.
207-
- **Simple metadata patterns** - `argo-app.yaml` provides a clear, declarative way to onboard applications.
208+
- **Simple directory patterns** - A new directory is all that's needed to onboard an application.
208209

209210
## Troubleshooting
210211

@@ -217,13 +218,13 @@ kubectl get applications -n argocd
217218
kubectl get applicationsets -n argocd
218219

219220
# Describe an application to see its sync status, resources, and health
220-
kubectl describe application my-app-nginx -n argocd
221+
kubectl describe application my-apps-nginx-development -n argocd
221222
```
222223

223224
### Common Issues
224225
| Issue | Solution |
225226
|-------|----------|
226-
| **ApplicationSet not generating apps** | Verify the `argo-app.yaml` file exists, is valid YAML, and is in a path the `ApplicationSet` is scanning. Check the `ApplicationSet` logs. |
227+
| **ApplicationSet not generating apps** | Verify the directory structure matches the `path` pattern in the `ApplicationSet`. Check the `ApplicationSet` controller logs in the `argocd` namespace. |
227228
| **Applications stuck in sync** | Review application logs (`argocd app logs <app-name>`) and check for sync errors in the UI. |
228229
| **ArgoCD UI not accessible** | Check the `http-route.yaml` and the status of the `istio-ingressgateway` service. |
229230

@@ -241,7 +242,7 @@ kubectl get applicationsets -n argocd
241242
This setup follows **enterprise GitOps patterns**:
242243

243244
1. **Infrastructure as Code**: Everything defined in Git.
244-
2. **Self-Service**: Developers can add applications by creating a directory and an `argo-app.yaml` file.
245+
2. **Self-Service**: Developers can add new applications simply by creating a new directory in the correct path.
245246
3. **Separation of Concerns**: Clear project boundaries for security and organization.
246247
4. **Automated Operations**: Zero-touch deployments after the initial bootstrap.
247248
5. **Observability**: Ready for a full monitoring and alerting stack.

infrastructure/controllers/argocd/apps/appsets/my-apps-appset.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ spec:
1313
revision: HEAD
1414
# Discover any application directory within the my-apps/*/* path.
1515
directories:
16-
- path: my-apps/*/*
16+
- path: "my-apps/*/*"
1717
template:
1818
metadata:
19-
# Name is derived from the path, e.g., 'ai-ollama'
20-
name: '{{path.elements[1]}}-{{path.basename}}'
19+
name: 'my-apps-{{path.elements[1]}}-{{path.basename}}'
2120
namespace: argocd
2221
spec:
2322
project: my-apps

0 commit comments

Comments
 (0)