Adding Apps
Overview
There are two types of apps:
- System Apps: Infrastructure (ArgoCD, cert-manager, MetalLB, Ingress)
- User Apps: Applications (websites, services)
Step 1: Create Helm Chart
Create a new Helm chart in charts/<app-name>/:
charts/my-app/
├── Chart.yaml
├── values.yaml
└── templates/
├── deployment.yaml
├── service.yaml
└── ingress.yaml
Example Chart.yaml:
apiVersion: v2
name: my-app
description: My application
type: application
version: 0.1.0
appVersion: "1.0"
Step 2: Create ArgoCD Application Template
For System Apps
Create charts/system-apps/templates/<app-name>.yaml:
{{- $env := .Values.clusterEnv -}}
{{- $appName := "my-app" -}}
{{- if index .Values.apps $appName -}}
{{- $app := index .Values.apps $appName -}}
{{- if $app.enabled }}
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: {{ $appName }}
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
annotations:
argocd.argoproj.io/sync-wave: "4"
spec:
project: playground
source:
repoURL: {{ .Values.repoURL }}
targetRevision: {{ .Values.targetRevision }}
path: charts/{{ $appName }}
helm:
valueFiles:
- $values/config/{{ $env }}/applications/{{ $appName }}-values.yaml
destination:
server: https://kubernetes.default.svc
namespace: {{ $app.destinationNamespace | default "default" | quote }}
syncPolicy:
automated:
prune: true
selfHeal: true
---
{{- end }}
{{- end }}
note
The $values reference points to the values from the main repository (not the Helm chart).
Step 3: Enable in Cluster Config
Edit cluster/dev/config.yaml:
apps:
my-app:
enabled: true
destinationNamespace: default
Step 4: Create App-Specific Values (Optional)
Create config/dev/applications/my-app-values.yaml:
replicaCount: 2
image:
repository: myorg/my-app
tag: latest
ingress:
enabled: true
hosts:
- myapp.ssdk8s.xyz
Step 5: Deploy
# 1. Push changes
git add . && git commit -m "Add my-app" && git push
# 2. Create release
make prepare-release REPO_ARGS="--repo owner/repo --message 'Add my-app'"
# 3. Deploy
make deploy ENV=dev
Enabling/Disabling Apps
Edit cluster/<env>/config.yaml:
apps:
my-app:
enabled: true # or false to disable
After changing, commit and create a new release.
Sync Wave Order
When adding multiple apps, use sync waves to control deployment order:
| Wave | Component Type |
|---|---|
| -1 | ArgoCD itself |
| 0 | Core (cert-manager, MetalLB) |
| 1 | Networking (Ingress, External-DNS) |
| 2 | Storage (local-path-provisioner) |
| 3 | Monitoring (Prometheus, Loki) |
| 4 | User applications |