Skip to content

Architecture

Architecture of Tsuru's control plane

How can I improve the above diagram?

Feel free to help us by improving and keeping the above diagram up to date. It was created using Excalidraw's whiteboard. Click here to access the most updated version available. After changing anything, you should share the new export link with us.

Tsuru API server

This service is part of Tsuru's core services.

The web API where the Tsuru users interact with. It's responsible for almost everything since Tsuru workloads1 creation until deployment workflow and troubleshooting operations.

Source code: tsuru/tsuru
API specification (Swagger 2.0): Tsuru API

Besides serving the API, the same process emits an event for every write operation (the audit trail behind tsuru event list, see Events), keeps a small in-memory ring buffer of recent app logs for tsuru app log (pod logs remain the source of truth; see Observability), exposes Prometheus metrics on /metrics and exports traces over OpenTelemetry when OTEL_EXPORTER_OTLP_ENDPOINT is set. All specifications in this repository are written in Swagger 2.0, not OpenAPI 3.

MongoDB

The only datastore. Tsuru API server stores in it the expected state of Tsuru workloads1, users, teams, roles, tokens, clusters, pools, plans and the full event history. There is no queue or cache service (no Redis). It must be a MongoDB server.

Source code: mongodb/mongo

Container Registry

Service to store and distribute container images of Tsuru workloads1. It must be compliant with Docker Registry API or OCI distribution specification.

Source code: distribution/distribution

Deploy Agent

This service is part of Tsuru's core services.

The service is responsible for intermediating the build and push process of Tsuru workloads1 container images to the container registry. Tsuru API server calls it over gRPC (cluster setting build-service-address); it generates a Containerfile for source deploys, drives BuildKit, pushes the image and reports back the Procfile and tsuru.yaml it found. Platform images are built the same way.

Source code: tsuru/deploy-agent

BuildKit

Service to build and push container images from a container file recipe.

Source code: moby/buildkit

Tsuru Router API

This service is part of Tsuru's core services.

The web API service which Tsuru updates the app's service backend. Its reference implementation, kubernetes-router, creates a Kubernetes Service and, in ingress/ingress-nginx/istio-gateway/gateway-api modes, an Ingress or gateway route per app. See Managing routers.

Source code: tsuru/kubernetes-router
API specification (Swagger 2.0): Tsuru Router API

Ingress or Gateway API controller

The component that actually receives app traffic. kubernetes-router only writes the routing objects; a controller running in the cluster turns them into a reachable endpoint. Which controller you run depends on the router mode:

  • Ingress controller (ingress and ingress-nginx modes): the router writes Ingress objects. The Helm chart installs ingress-nginx with class tsuru-nginx.
  • Gateway API controller (gateway-api mode): the router writes HTTPRoute objects attached to a Gateway, so any Gateway API implementation (Envoy Gateway, Cilium, Istio, cloud load balancer controllers, ...) can replace the ingress controller.
  • Istio (istio-gateway mode): the router writes Istio Gateway and VirtualService objects.
Source code: kubernetes/ingress-nginx (default in the Helm chart)
Specification: Gateway API

Kubernetes cluster

The Kubernetes cluster where Tsuru API should run the Tsuru workloads1 on.

Source code: kubernetes/kubernetes

  1. Tsuru apps and jobs ↩↩↩↩↩