Skip to content

CI/CD Task Automation and Real-Time Monitoring Based on Argo Workflows

Interactive Diagram

새 탭 ↗

On a GitOps-based platform, every intermediate step, from the moment a developer clicks the build or deploy button until the actual Pod is running and receiving traffic, must be automated and shown in real time. This article covers an architecture that standardizes Tasks with Argo Workflows and streams progress through Server-Sent Events.

Tasks handled by the platform are broadly divided into two categories.

TypeDetailsDescription
CIBuildSource checkout, image build, registry push
CDDeployNamespace, Deployment, Service, Ingress, HPA
CDResourceResource changes after deployment (replicas, resource limits)
CDHelmHelm chart deployment and upgrade
CDJobOne-time Jobs and CronJob schedule changes
CDStoragePVC creation

All Tasks are defined as Argo WorkflowTemplates. CD manifests are managed in a Git repository and synchronized with the cluster through ArgoCD Applications. This ensures that both Task execution history and deployment status remain declarative.

RunnerArgo TypeCreated ResourcesRole
Project CDApplicationNamespace, ServiceAccount, RoleBinding, SecretCreates project boundaries
App Service CIWorkflow-Builds source and pushes images
App Service CDApplicationDeployment, Service, Ingress, HPADeploys and modifies applications
Helm CDApplicationHelm manifest, valuesDeploys and upgrades Helm charts
Job CDApplicationJobCreates one-time Jobs
CronJob CDApplicationCronJobCreates scheduled Jobs and changes schedules
Volume CDApplicationPVCProvisions storage
Application ManagementWorkflowApplicationDeletes resources based on ArgoCD Apps

Real-Time Status Streaming with Server-Sent Events

Section titled “Real-Time Status Streaming with Server-Sent Events”

When a user starts a build, Workflow logs, Pod status, and Events must be displayed on screen in real time. To achieve this, the SSE (Server-Sent Events) pattern is used.

PlantUML Diagram
  • The Router API is deployed in the internal cluster (IC) and calls the SSE Service.
  • The SSE API is deployed in the CQ (Control/Query) cluster and converts Kubernetes/Argo streams into SSE responses.
  • The browser maintains a connection through an EventSource object and receives server-sent events in real time.
APITargetPurpose
Pipeline LogArgo Workflow log streamCI/CD process logs (Workflow main logs)
Pod Listk8s pod list watchRetrieves the application Pod list
Pod Metrick8s pod status streamRetrieves Pod CPU/Memory and status in real time
Pod Logk8s pod log streamStreams logs for an individual Pod
Pod Eventk8s event watchPod creation, restart, and error events (for future use)

Service Architecture: Separating Task, Monitoring, and Summary

Section titled “Service Architecture: Separating Task, Monitoring, and Summary”

The platform API is divided into three responsibilities.

Task Service: Workflow Execution and Control

Section titled “Task Service: Workflow Execution and Control”
PlantUML Diagram

Argo Workflows UI showing the split, map and reduce steps of a map-reduce workflow as a DAG Source: Argo Workflows documentation, The Argo Authors, Apache-2.0

  • Create Workflows (submit_workflow)
  • Retrieve the Workflow list (list_workflows)
  • Retrieve the archived Workflow list (logs for each step)
  • Cancel Workflows (stop_workflow)
PlantUML Diagram
  • Workflow log streams
  • Archived Workflow log files
  • Workflow status streams
  • Pod list watch
  • Pod metric streams
  • Pod log streams
PlantUML Diagram
  • Watches Workflow events and stores the final CI/CD status in Redis.
  • Watches Pod status and stores the running status in Redis.
  • For views that must display a large amount of data at once, such as the application list page, individual REST APIs cannot provide sufficient performance; instead, pre-aggregated data is served from Redis.

The actual Platform API design built on this Task automation architecture is covered next in GitOps Platform API Design Patterns. Repository structure and deployment strategy are covered in GitOps Repository Structure Design.