Release Strategy Documentation¶
This document provides a comprehensive guide to the release strategy implemented in this repository, including how to set up and use ArgoCD and k3d for local development and testing.
Table of Contents¶
- Overview
- Branch Strategy
- PR Automation
- Environment Setup
- ArgoCD Integration
- Local Development with k3d
- Troubleshooting
Overview¶
Our release strategy follows a streamlined approach with feature/fix branches that merge directly into the main branch. The process is automated using GitHub Actions workflows that handle PR creation, testing, and deployment preparation.
Key Components¶
- PR Automation: Automatically creates PRs when pushing to feature/fix branches
- Helm and ArgoCD Testing: Validates Helm charts and ArgoCD configurations
- ArgoCD Integration: Manages deployments to different environments
- Local Development: Uses k3d for local Kubernetes development and testing
Branch Strategy¶
We follow a simple branch strategy:
- Main Branch (
main): The primary branch that represents the production-ready code - Feature Branches (
feat/*): Used for developing new features - Fix Branches (
fix/*): Used for bug fixes
Workflow¶
- Create a feature or fix branch from
main - Develop and test your changes locally
- Push your branch to GitHub, which automatically creates a PR
- The PR triggers tests and validation workflows
- After review and approval, merge the PR to
main - Changes to
maintrigger deployment to staging - After validation in staging, promote to production
PR Automation¶
When you push a feature or fix branch to GitHub, our PR automation workflow automatically creates a PR if one doesn't exist.
How to Use¶
-
Create a feature or fix branch:
git checkout -b feat/your-feature-name # or git checkout -b fix/your-fix-name -
Make your changes and commit them:
git add . git commit -m "Your commit message" -
Push your branch to GitHub:
git push -u origin feat/your-feature-name -
The PR automation workflow will create a PR automatically
Environment Setup¶
We use two environments for our deployment pipeline:
- Staging: Pre-production environment for validation
- Production: Live environment
Configuration Files¶
- Staging:
config/helm/staging.yamlandconfig/argocd/staging.yaml - Production:
config/helm/production.yamlandconfig/argocd/production.yaml
ArgoCD Integration¶
ArgoCD is used for GitOps-based deployments to our Kubernetes clusters.
Setting Up ArgoCD¶
Prerequisites¶
- kubectl
- argocd CLI
- GitHub CLI (gh)
Installation¶
-
Set up a Kubernetes cluster (see Local Development with k3d for local setup)
-
Install ArgoCD:
./scripts/setup-local-k3d-argocd.sh -
Set up ArgoCD API key and GitHub secrets:
./scripts/setup-argocd-github.sh
Manual Deployment¶
To manually deploy using ArgoCD:
-
Login to ArgoCD:
argocd login <argocd-server> --username admin --password <password> -
Create an application:
argocd app create <app-name> \ --repo https://github.com/datascientest-fastapi-project-group-25/fastAPI-project-release.git \ --path charts/fastapi \ --dest-server https://kubernetes.default.svc \ --dest-namespace <namespace> \ --values ../../config/helm/<environment>.yaml -
Sync the application:
argocd app sync <app-name>
Local Development with k3d¶
k3d is a lightweight Kubernetes distribution that runs in Docker, perfect for local development and testing.
Setting Up k3d¶
-
Install k3d:
brew install k3d -
Create a k3d cluster with ArgoCD:
./scripts/setup-local-k3d-argocd.sh -
Verify the cluster is running:
k3d cluster list kubectl get nodes
Testing Locally¶
-
Port-forward ArgoCD server:
kubectl port-forward svc/argocd-server -n argocd 8080:443 -
Access ArgoCD UI at https://localhost:8080
- Username: admin
-
Password: (retrieved during setup)
-
Deploy your application:
argocd app create fastapi-test \ --repo https://github.com/datascientest-fastapi-project-group-25/fastAPI-project-release.git \ --path charts/fastapi \ --dest-server https://kubernetes.default.svc \ --dest-namespace fastapi-test \ --values ../../config/helm/playground.yaml
Troubleshooting¶
Common Issues¶
ArgoCD Login Issues¶
If you're having trouble logging in to ArgoCD:
# Reset admin password
kubectl -n argocd patch secret argocd-secret \
-p '{"stringData": {
"admin.password": "$2a$10$mivhwttXM0U5eBrZGtAG8.VSRL1l9cZNAmaSaqotIzXRBRwID1NT.",
"admin.passwordMtime": "'$(date +%FT%T%Z)'"
}}'
k3d Cluster Creation Issues¶
If you're having trouble creating a k3d cluster:
# Check if there are any existing clusters
k3d cluster list
# Delete existing cluster if needed
k3d cluster delete <cluster-name>
# Try creating with a different port
k3d cluster create argocd-cluster --servers 1 --agents 1 --port 8082:80@loadbalancer
GitHub Actions Workflow Failures¶
If GitHub Actions workflows are failing:
- Check the workflow logs for specific errors
- Verify that the required secrets are set up correctly
- Make sure your Helm charts are valid
- Ensure that the ArgoCD configuration is correct
For more help, please open an issue on the repository.