Skip to main content

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

charts/<app-name>/
├── Chart.yaml
├── values.yaml
└── templates/

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
spec:
project: playground
source:
repoURL: {{ .Values.repoURL }}
targetRevision: {{ .Values.targetRevision }}
path: charts/{{ $appName }}
helm:
valueFiles:
- $values/config/{{ $env }}/application/{{ $appName }}.yaml
destination:
server: https://kubernetes.default.svc
namespace: {{ $app.destinationNamespace | default "default" }}
syncPolicy:
automated:
prune: true
selfHeal: true
---
{{- end }}
{{- end }}

For User Apps

Create charts/applications/templates/<app-name>.yaml with the same structure.

Step 3: Enable in Cluster Config

Edit cluster/dev/config.yaml:

apps:
my-app:
enabled: true
destinationNamespace: default

Step 4: 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