Using Git as the single source of truth for Helm-based deployments.
git revert instead of helm rollbackapiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-app
namespace: argocd
spec:
project: default
source:
repoURL: oci://registry.example.com/charts
chart: my-app
targetRevision: 1.4.0
helm:
releaseName: my-app
valueFiles:
- values-production.yaml
parameters:
- name: image.tag
value: "v2.3.1"
destination:
server: https://kubernetes.default.svc
namespace: production
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
selfHeal: true reverts manual kubectl changes automatically. prune: true deletes resources removed from Git.apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: cluster-apps
namespace: argocd
spec:
generators:
- git:
repoURL: https://github.com/org/gitops-repo.git
revision: main
directories:
- path: "apps/*"
- clusters:
selector:
matchLabels:
env: production
template:
metadata:
name: "{{path.basename}}-{{name}}"
spec:
project: default
source:
repoURL: https://github.com/org/gitops-repo.git
targetRevision: main
path: "{{path}}"
destination:
server: "{{server}}"
namespace: "{{path.basename}}"
The Git directory generator creates one Application per subdirectory. The cluster generator fans out across multiple clusters.
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: bitnami
namespace: flux-system
spec:
type: oci
url: oci://registry-1.docker.io/bitnamicharts
interval: 10m
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: redis
namespace: caching
spec:
interval: 30m
chart:
spec:
chart: redis
version: "18.x"
sourceRef:
kind: HelmRepository
name: bitnami
namespace: flux-system
valuesFrom:
- kind: ConfigMap
name: redis-values
values:
architecture: replication
replica:
replicaCount: 3
valuesFrom lets you pull values from ConfigMaps or Secrets, keeping sensitive data separate from the HelmRelease manifest.apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImageUpdateAutomation
metadata:
name: flux-system
namespace: flux-system
spec:
interval: 30m
sourceRef:
kind: GitRepository
name: flux-system
git:
checkout:
ref:
branch: main
commit:
author:
name: fluxcdbot
email: flux@example.com
messageTemplate: "chore: update images"
push:
branch: main
update:
path: ./clusters/production
strategy: Setters
<path:secret/data/db#password> placeholders at sync timehelm template in CI, commit plain YAML — simpler diff reviewgit revert over manual interventionNext: Lesson 20 →