Skip to main content

GitOps vs CD Services

This topic explains the key differences between GitOps and CD services in Harness, helping you understand which approach best fits your deployment needs.

Overview

Harness supports two primary approaches for continuous delivery:

  1. CD Services: The Harness deployment approach that uses pipelines to define and execute deployment steps explicitly
  2. GitOps Services: A declarative approach that continuously synchronizes your deployments with Git repository manifests

While both approaches achieve the goal of deploying applications, they differ significantly in philosophy, workflow, and implementation.

Key Differences

Deployment Philosophy

CD ServicesGitOps Services
Push-based: Changes are actively pushed through the pipeline to target environmentsPull-based: The GitOps Agent continuously pulls the desired state from Git
Procedural: Defines a sequence of steps to perform the deploymentDeclarative: Defines the desired end-state in Git, letting the system figure out how to achieve it
Event-triggered: Deployments start when triggered by events (Git changes, webhooks, schedules)Continuously reconciled: Automatically ensures the cluster matches the state defined in Git

Service Definition

CD ServicesGitOps Services
Focused on artifact sources, manifests, and variable definitionsPrimarily focused on linking to Git repositories and manifests (Release Repo and Deployment Repo)
Requires explicit specification of deployment stepsUses a GitOps agent to sync with Git repositories automatically
Service definition specifies exactly how deployment happensService definition points to where the desired state is defined
Configuration changes require updating the service or pipelineConfiguration changes are made directly in the Git repository

Service Variables

CD ServicesGitOps Services
Variables defined directly in the serviceVariables can reference configuration files stored in Git
Variable overrides managed in pipeline executionsVariable overrides can be managed through PR pipelines
Fixed variable referencesDynamic variable resolution using expressions like <+env.name> and <+cluster.name>
Variables typically used for single environment deploymentsVariables designed to support multi-environment deployments through expressions

Implementation in Harness

CD ServicesGitOps Services
Uses Harness Delegates for deploymentsUses GitOps Agents (based on Argo CD) for deployments
Deployment executed through CD pipelines with explicit stepsDeployment continuously reconciled by the GitOps Agent
Service variables managed through HarnessService variables can reference configuration files in Git
Dashboard shows deployment executions and pipeline runsDashboard shows sync status, health, and resource utilization

Architecture Components

CD ServicesGitOps Services
Harness Delegate handles deployment operationsGitOps Agent (with Application Controller, Repo Server) handles deployments
Configuration stored primarily in HarnessConfiguration primarily stored in Git repositories
Pipelines define deployment flowGit commits drive deployment changes
Direct interaction with target environmentsGitOps Agent mediates interaction with target environments

When to Use Each Approach

Choose CD Services When You:

  • Need fine-grained control over deployment steps
  • Require complex deployment orchestration
  • Have approval processes that must gate deployments
  • Need to integrate with multiple systems during deployment
  • Want explicit control over when deployments occur

Choose GitOps Services When You:

  • Want Git to be the single source of truth for your deployments
  • Prefer a declarative approach to defining application state
  • Need continuous reconciliation between Git and your clusters
  • Have multiple teams working on the same deployments
  • Want automated drift detection and correction

Hybrid Approaches

You can also combine both approaches in Harness:

  1. GitOps for application deployments, CD for infrastructure: Use GitOps for application services while managing infrastructure with CD pipelines
  2. CD pipelines that trigger GitOps synchronization: Create pipelines that interact with your GitOps services through PR pipelines
  3. Mixed environment strategy: Use GitOps for some environments (e.g., development) and CD for others (e.g., production)

Next Steps