6.0 KiB
6.0 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Quick Commands
Building & Validation
# Build manifests (with Helm support)
kustomize build --enable-helm <path> > output.yaml
# Validate without applying
kustomize build --enable-helm <path> | kubectl apply --dry-run=client -f -
# Apply manifests to cluster
kustomize build --enable-helm <path> | kubectl apply -f -
# Apply single manifest
kubectl apply -f <file.yaml>
Monitoring & Inspection
# Watch Argo CD applications
kubectl -n argocd get applications -w
argocd app list
# Check component status
kubectl -n <namespace> get pods
kubectl -n <namespace> logs -f deployment/<name>
# Describe resource
kubectl -n <namespace> describe <resource-type> <name>
# Check application sync status
argocd app get <app-name>
kubectl -n argocd describe application <app-name>
Common Operations
# Port forward to Argo CD UI
kubectl port-forward -n argocd svc/argocd-server 8080:443
# Get Argo CD admin password
kubectl -n argocd get secret argocd-initial-admin-secret \
-o jsonpath="{.data.password}" | base64 --decode
# Port forward to Kargo API
kubectl port-forward -n kargo svc/kargo-api 8443:443
# Check certificate status
kubectl get certificate -A
kubectl describe certificate -n <namespace> <cert-name>
Architecture Overview
Component Structure
The repo has three parallel hierarchies for components, regions, and deployments:
-
Components (
argocd/,cert-manager/,kargo/,argo-rollouts/):base/- core Kustomization and Helm values<region>/(e.g.,eu-central-1/) - region-specific overrides and values
-
Regions (
eu-central-1/):root-apps-app.yaml- root Argo CD application that syncs all other appsargo-apps/- Argo Application resources for each component
-
Projects (
kargo-projects/orchestration-stack/):- Defines Kargo Warehouse, Stages, Promotions for progressive delivery
Key Components
- Argo CD: Declarative GitOps CD tool - watches this repo and syncs manifests
- Cert-Manager: Automates certificate lifecycle (self-signed CA, can add Let's Encrypt)
- Kargo: Progressive delivery platform - multi-stage promotions with health checks
- Argo Rollouts: Advanced deployment strategies (canary, blue-green)
How It Works
- Git commit → Webhook fires → Argo CD fetches latest manifests → Kustomize builds → kubectl applies
- Sealed Secrets in Git are encrypted at rest, decrypted only in cluster
- Kargo watches Warehouse for new Freight → auto-promotes or waits for approval → updates Argo CD apps
Important Patterns
Kustomization Pattern
Each component follows base/ + <region>/ pattern:
base/has shared config, disabled Helm charts (kustomization.yaml)<region>/enables Helm and overrides values with regional specifics- To add a new region: copy
eu-central-1/to new region dir, update domain/values
Sealed Secrets
- Store encrypted secrets in
secrets/directory - Use
kubesealCLI to encrypt before committing - Never commit plaintext credentials
- Sealing keys are NOT in Git (stored in cluster)
Build with --enable-helm
All Kustomize builds must use --enable-helm flag because components use Helm charts. Forgetting this is a common mistake.
Namespace & Labels
Components deploy to dedicated namespaces:
argocd- Argo CDcert-manager- Cert-Managerkargo- Kargo Avoid cross-namespace resource references; use Argo CD Applications for composition.
File Locations Reference
argocd/base/values.yaml # Argo CD Helm values (base)
argocd/eu-central-1/values.yaml # Argo CD regional overrides
cert-manager/eu-central-1/cert-issuer.yaml # CA issuer config
kargo/base/values.yaml # Kargo Helm values
kargo-projects/orchestration-stack/ # Kargo project definitions
eu-central-1/root-apps-app.yaml # Root Argo CD app (entry point)
secrets/ # Sealed secrets storage
scripts/deploy-to-cluster.sh # One-shot cluster bootstrap
Common Tasks
Add a New Region
- Create
eu-west-1/directory structure mirroringeu-central-1/ - Copy component overlays and update domain/version values
- Create
eu-west-1/root-apps-app.yamlpointing to regional resources - Test:
kustomize build --enable-helm eu-west-1/
Update Component Versions
- Edit Helm chart version in
<component>/<region>/kustomization.yaml - Validate:
kustomize build --enable-helm <component>/<region>/ - Apply:
kustomize build --enable-helm <component>/<region>/ | kubectl apply -f -
Create a New Secret
- Create plaintext secret:
kubectl -n <ns> create secret generic my-secret --from-literal=key=value --dry-run=client -o yaml > secret.yaml - Encrypt:
kubeseal -f secret.yaml -w sealed-secret.yaml - Move to
secrets/directory and commit - Cluster controller auto-decrypts when applied
Sync Application Manually
argocd app sync <app-name>
# or force sync if stuck
argocd app sync <app-name> --force
Debugging Tips
- Use
--dry-run=clientto validate before applying - Check
kubectl -n <ns> describe pod <name>for startup errors - Use
kubectl -n <ns> logs <pod>for runtime issues - Verify Git repository credentials:
kubectl -n argocd get secret repo-credentials -o yaml - For Argo CD sync failures:
kubectl -n argocd describe application <app-name> - Use
kustomize build . -vfor verbose Kustomize output
Documentation Index
- README.md - Overview, prerequisites, quick start, installation steps
- ARCHITECTURE.md - Detailed system design, data flows, security layers
- DEPLOYMENT_GUIDE.md - Step-by-step installation for different scenarios
- CONFIGURATION.md - Configuration customization guide
- CONTRIBUTING.md - Commit message conventions, testing guidelines, release process
- TROUBLESHOOTING.md - Common issues and solutions