Skip to content

GitOps Platform API Design: Task, Monitoring, and Summary Separation Pattern

Interactive Diagram

새 탭 ↗

A GitOps platform API is not merely a proxy that manipulates Kubernetes resources. It must run asynchronous Workflows, track their progress in real time, and aggregate and present statuses from multiple sources. This article covers a design that separates Task execution, monitoring, and aggregation into three independent services, along with the reasons for doing so.

Deployment Architecture: Separating Roles Across Clusters

Section titled “Deployment Architecture: Separating Roles Across Clusters”
PlantUML Diagram

Core principles:

  • Manage endpoints with Kubernetes Ingress instead of a separate Gateway: Adding a Gateway component only increases failure points and complexity.
  • Use Ingress consistently for cross-cluster endpoints: Using Ingress even when crossing cluster boundaries allows TLS and routing policies to be managed in one place.
  • Run every cluster-change operation through Argo Workflow: Do not use kubectl apply directly. Executing through Workflows leaves a history and enables re-execution and rollback.
  • Run Workflows primarily through the CLI: The CLI is more stable and easier to keep version-compatible than the REST API. Use the REST API only for features without a CLI.

Task Process: Application Creation, Build, and Deployment Flow

Section titled “Task Process: Application Creation, Build, and Deployment Flow”
PlantUML Diagram

What asynchronous execution means:

  • Workflows and Argo CD execute asynchronously. The o at the end of an arrow denotes an asynchronous invocation.
  • A separate API is needed to query the status and results of asynchronous jobs; that is the role of the Monitoring Service.

Monitoring Process: Tracking Asynchronous Job Status

Section titled “Monitoring Process: Tracking Asynchronous Job Status”
PlantUML Diagram

The Monitoring Service receives status updates from Argo Workflows and Argo CD via Server-Sent Events (SSE). On the Kubernetes side there are two kinds of streams. The service uses follow on the Pod log subresource to stream container logs. It uses the Kubernetes API’s watch to track changes to resources such as Events and Pods. The service can relay both over SSE, but it does not read them from Kubernetes in the same way.

Summary Process: Aggregating Large Volumes of Data

Section titled “Summary Process: Aggregating Large Volumes of Data”
PlantUML Diagram

Why a Summary Service is necessary:

  • The application list screen displays deployment status and execution status at the same time.
  • Querying the status of every application through individual REST APIs makes response times too long.
  • Pre-aggregating the required data and storing it in Redis makes list queries fast and reliable.

Aggregation targets:

  • Watch Workflow events and store final CI/CD statuses.
  • Watch Pod statuses and store Run statuses.
ServiceRoleResponse MethodExample API
Task ServiceWorkflow execution and controlJSONPOST /workflows, PUT /workflows/{name}/stop
Monitoring ServiceReal-time status and log streamingSSE (text/event-stream)GET /sse/workflow-log, GET /sse/pod-metric
Summary ServiceAggregated data storage(The Portal queries Redis directly)-

This separation pattern clearly divides concerns, isolating both the responsibility and failure scope of each service. Even if the Task Service stops, the Monitoring Service can still stream logs from existing Workflows.