JK
JustKalm
Release Engineering

Change Management

GitOps-driven deployments with progressive rollouts, feature flags, and automated rollback achieving 99.7% deployment success rate.

47/day

Deploy Frequency

18 min

Lead Time

99.7%

Success Rate

4 min

MTTR

ArgoCD GitOps

Declarative, Git-centric continuous deployment with automatic sync and drift detection.

# argocd/application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: justkalm-api
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: production
  
  source:
    repoURL: https://github.com/justkalm/infra
    targetRevision: main
    path: k8s/overlays/production
    
    kustomize:
      images:
        - name: justkalm/api
          newTag: ${ARGOCD_APP_REVISION}
  
  destination:
    server: https://kubernetes.default.svc
    namespace: production
  
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
      allowEmpty: false
    syncOptions:
      - CreateNamespace=true
      - PrunePropagationPolicy=foreground
      - PruneLast=true
    retry:
      limit: 5
      backoff:
        duration: 5s
        factor: 2
        maxDuration: 3m
  
  # Health checks
  ignoreDifferences:
    - group: apps
      kind: Deployment
      jsonPointers:
        - /spec/replicas
  
  # Notifications
  annotations:
    notifications.argoproj.io/subscribe.on-sync-succeeded.slack: deployments
    notifications.argoproj.io/subscribe.on-sync-failed.pagerduty: critical

Deployment Pipeline

PR Opened0s
CI Tests4m 32s
Security Scan1m 15s
Build Image2m 48s
Deploy Staging3m 12s
E2E Tests5m 45s
Canary (5%)2m
Canary (25%)-
Full Rollout-

GitOps Workflow

# change_management/gitops.py
from dataclasses import dataclass
from typing import List, Dict, Optional
from enum import Enum
import subprocess
import yaml

class DeploymentStrategy(Enum):
    ROLLING = "rolling"
    BLUE_GREEN = "blue_green"
    CANARY = "canary"
    RECREATE = "recreate"

@dataclass
class DeploymentConfig:
    service: str
    environment: str
    strategy: DeploymentStrategy
    image_tag: str
    replicas: int
    canary_steps: List[int] = None  # [5, 25, 50, 100]
    health_check_duration: int = 300  # seconds

class GitOpsDeployer:
    """
    GitOps-based deployment automation
    with ArgoCD integration.
    """
    
    def __init__(self, repo_path: str, argocd_server: str):
        self.repo_path = repo_path
        self.argocd_server = argocd_server
    
    async def deploy(
        self,
        config: DeploymentConfig,
        dry_run: bool = False
    ) -> Dict:
        """
        Execute GitOps deployment by updating
        manifests and triggering sync.
        """
        
        # 1. Update image tag in kustomization
        kustomization_path = f"{self.repo_path}/k8s/overlays/{config.environment}/kustomization.yaml"
        
        await self._update_image_tag(
            kustomization_path,
            config.service,
            config.image_tag
        )
        
        # 2. Update deployment strategy if canary
        if config.strategy == DeploymentStrategy.CANARY:
            await self._configure_canary(config)
        
        # 3. Commit and push changes
        if not dry_run:
            await self._git_commit_push(
                f"Deploy {config.service}:{config.image_tag} to {config.environment}"
            )
        
        # 4. Trigger ArgoCD sync
        sync_result = await self._trigger_sync(
            app_name=f"{config.service}-{config.environment}",
            dry_run=dry_run
        )
        
        return {
            "status": "initiated" if not dry_run else "dry_run",
            "service": config.service,
            "environment": config.environment,
            "image_tag": config.image_tag,
            "strategy": config.strategy.value,
            "sync_result": sync_result
        }
    
    async def _trigger_sync(
        self,
        app_name: str,
        dry_run: bool = False
    ) -> Dict:
        """Trigger ArgoCD application sync."""
        
        cmd = [
            "argocd", "app", "sync", app_name,
            "--server", self.argocd_server,
            "--async",
            "--prune"
        ]
        
        if dry_run:
            cmd.append("--dry-run")
        
        result = subprocess.run(cmd, capture_output=True, text=True)
        
        return {
            "success": result.returncode == 0,
            "output": result.stdout,
            "error": result.stderr if result.returncode != 0 else None
        }

Ship with Confidence

Progressive rollouts and instant rollbacks keep your systems stable.

47 Deploys/Day99.7% Success Rate4 min MTTR