Introducing a new way to review your PRs.

Read the announcement

armadaproject / armada

A multi-cluster batch queuing system for high-throughput workloads on Kubernetes.

View on GitHub

20 documents · Updated Nov 23, 2026

docs / protobuf-apis-and-events

Protobuf APIs and event contracts

Armada uses Protocol Buffers as shared contracts for job requests, job state, executor work, health checks, scheduler views, and event history. These contracts let public clients, control-plane services, executors, and event consumers exchange the same job identity and lifecycle facts. For the wider contract map, see Platform contracts and clients; for client use, see Client SDKs; for event storage and replay, see Event ingestion and history.

Contract landscape

The contract families divide public use from internal coordination. A client can submit or inspect a job without taking a dependency on scheduler state, while the scheduler and executor exchange only the facts needed to place and run work.

Contract familyPurposeBoundary
Public APISubmit, query, control, and observe jobs and platform resources.pkg/api
Executor APIExchange leases, capacity facts, and run results.pkg/executorapi
Armada eventsShare job and run state changes with downstream consumers.pkg/armadaevents
Control-plane eventsShare operator actions for executors, queues, and nodes.pkg/controlplaneevents
Scheduler objectsHold internal placement state.internal/scheduler/schedulerobjects
Scheduler reportsExpose selected scheduling views to public callers.pkg/api/schedulerobjects

The product path joins these boundaries. A client submits work through the public API. The scheduler places a run through the executor API. Executors run it in a Kubernetes cluster. Armada events then carry the resulting facts to stream clients and other consumers.

This diagram shows the main contract boundaries and the direction of job flow.

flowchart LR
    Client[Client] --> Public[Public API]
    Public --> Scheduler[Scheduler]
    Scheduler --> Executor[Executor API]
    Executor --> Cluster[Kubernetes cluster]
    Cluster --> Events[Armada events]
    Events --> Stream[Public event stream]
    Events --> Consumers[Event consumers]
    Scheduler --> Reports[Scheduler reports]

References: pkg/…/submit.pb.go• L448-452 pkg/…/job.pb.go• L81-92 pkg/…/event.pb.go• L2279-2338 pkg/…/scheduler_reporting.pb.go• L506-516

Public API contracts

The public API groups commands and queries by the view that a caller needs. Generated gRPC clients provide the typed calls. Generated HTTP descriptions provide the JSON and REST form for clients that do not use gRPC.

Submission contracts

Submission accepts a batch of jobs under one queue and job-set name. Each job carries its workload and scheduling choices. The response gives one result per item so a caller can handle accepted and rejected jobs separately.

The job model is the durable user-facing form of the request. It links the job to its queue and job set, records the selected scheduler and resource needs, and can carry an external job URI. If the explicit URI is absent, the established annotation can supply it. A job can also include Armada-specific or native Kubernetes service and ingress forms, but the two representation families are exclusive.

References: pkg/…/submit.proto• L14-32 pkg/…/submit.proto• L111-155 pkg/…/submit.pb.go• L164-181 pkg/…/submit.pb.go• L448-452 pkg/…/submit.pb.go• L768-808

Job and run contracts

Job queries separate the overall job from each execution attempt. A job can have several runs because a failed, preempted, or expired attempt can be followed by another attempt.

ViewMain information
Job statusThe current state for each requested job.
Job detailsJob identity, queue, job set, state, timing, cancellation data, and optional specification and runs.
Run detailsRun identity, job link, state, cluster, node, pod, timing, and ingress addresses.
Job errorsError text keyed by job ID.
Active queuesActive queue names grouped by pool.

The job state answers what the work means as a whole. The run state answers what happened during one attempt. This distinction lets clients show a recoverable run error without treating the job as terminal.

References: pkg/…/job.proto• L22-35 pkg/…/job.proto• L38-52 pkg/…/submit.proto• L111-155 pkg/…/job.pb.go• L81-94

Control contracts

Control requests express intent to change work or the resources that run it. Job requests can target one job or a job set. Executor and node requests apply that intent to a worker scope and can filter by queues or priority classes.

The executor boundary supports settings changes, deletion, preemption, and cancellation. Node control narrows the same actions to one node. These calls do not by themselves describe the final job state; later job queries and events report the result.

References: pkg/…/submit.pb.go• L509-514 pkg/…/submit.pb.go• L578-584 pkg/…/submit.pb.go• L654-660 pkg/…/executor.pb.go• L32-36 pkg/…/node.pb.go• L32-38

Health contracts

Health is a service-level gate for request serving. Its shared response reports whether the service is unknown, serving, or not serving.

The submit and event services expose this response. It does not describe a queue, job, or run, so callers must not use it as a lifecycle state.

References: pkg/…/health.pb.go• L26-56 pkg/…/event.pb.go• L2667-2671 pkg/…/event.pb.go• L2755-2760

Scheduler-object contracts

Scheduler objects represent the compact placement view used inside scheduling. Public scheduler reports expose selected views of that state without making the full placement model a public job contract.

Callers can request general, queue, or job reports. The report contract also retains older queue and job filters for compatibility. This boundary gives operators useful scheduling information while keeping internal placement state changeable.

References: pkg/…/scheduler_reporting.pb.go• L31-32 pkg/…/scheduler_reporting.pb.go• L76-77 pkg/…/scheduler_reporting.pb.go• L121-127 pkg/…/scheduler_reporting.pb.go• L506-516 internal/…/schedulerobjects.proto• L1-7

Armada event contracts

Armada events are durable facts about submission, scheduling, execution, control, validation, and resource use. An EventSequence groups related state-transition records under queue and job-set context. Each record selects one event kind through a oneof, which means consumers must handle the event choice rather than infer it from optional fields.

Event lifecycle

The event model separates a job from its runs. A job is the requested workload. A job run is one attempt to execute it. This allows lease, assignment, running, success, error, preemption, cancellation, and requeue facts to carry run-specific placement and Kubernetes data while job-level facts keep the common job identity.

Failure records include terminal status and a failure classification. failure_category is the single primary metric class. failure_subcategory adds detail. retry_policy_name records the policy that decided whether the run should retry or end. A recoverable run error therefore does not always make the job terminal.

The event set also carries validation, preemption requests, resource use, partition markers, and run-cancellation facts. JobRunTerminatedDebugInfo is diagnostic data for a torn-down run. It does not change the run state.

This diagram shows the main run path and the retry branch represented by the event messages.

stateDiagram-v2
    [*] --> Submitted
    Submitted --> Queued
    Queued --> Leased
    Leased --> Pending
    Pending --> Assigned
    Assigned --> Running
    Running --> Succeeded
    Running --> Failed
    Failed --> Queued: recoverable
    Running --> Preempted
    Preempted --> Queued: requeue
    Running --> Cancelled

References: pkg/…/events.proto• L14-64 pkg/…/events.proto• L66-111 pkg/…/events.proto• L491-525 pkg/…/events.proto• L620-681

Event stream contracts

The public event stream projects Armada events for live observation and catch-up. A stream message pairs a message ID with an event projection. A job-set request selects the job set and optional queue, chooses whether to watch, and can continue from a prior message ID.

The message ID is the resume point. Consumers should store it so a disconnect does not turn into a gap in history. The HTTP form exposes the same stream as newline-delimited JSON. The older watch method remains available for compatibility but is deprecated.

References: pkg/…/event.pb.go• L2279-2338 pkg/…/event.pb.go• L2664-2671 pkg/…/event.pb.go• L2696-2743 pkg/…/api.swagger.json• L117-171

Event detail contracts

Common event context links a change to a queue, job set, job, and time. Execution events add only the facts needed for placement, Kubernetes resources, ingress, errors, or resource use.

Run-start events can include PodStartUpInfo. It gives consumers a time view of pod creation, scheduling, kubelet acknowledgement, sandbox readiness, and container start. It also carries image-pull data and named extra steps so startup delay can be explained without a direct Kubernetes query.

Resource-use events report maximum, average, and cumulative quantities for a job run and its Kubernetes resource. Error details can identify the resource or container and can include Kubernetes reasons, debug text, and related errors.

References: pkg/…/events.proto• L113-122 pkg/…/events.proto• L340-418 pkg/…/events.proto• L466-525 pkg/…/events.proto• L527-616

Generated bindings and package boundaries

The .proto files define the contract authority. Generated Go files turn that authority into message types, enum values, serialization support, gRPC clients, server interfaces, registration helpers, and service descriptors. Generated HTTP descriptions carry the public JSON and REST projection.

Generated binding surfaces

The Armada event schema generates Go types for the event envelope and every event variant. The generated oneof wrappers preserve the rule that each event record has one selected event kind. The generated bindings also expose the new event and field shapes to producers and consumers without changing the source of truth.

Schema changes must preserve field numbers and reserved names so old messages and stored events keep their meaning. After a source change, every derived binding used by clients or services must match the source contract.

References: pkg/…/events.proto• L1-12 pkg/…/events.proto• L66-111 pkg/…/events.pb.go• L92-106 pkg/…/events.pb.go• L177-205 pkg/…/events.pb.go• L527-554

Shared package boundaries

Each package serves a distinct audience. Public clients use pkg/api. Executor services use pkg/executorapi. Event producers and consumers use the matching event package. Scheduler-only code uses internal scheduler objects rather than public job models.

PackageContract boundary
pkg/apiPublic commands, queries, job and run views, health, event streams, and administration.
pkg/api/binocularsOperational logs and node cordon access.
pkg/api/schedulerobjectsPublic scheduler report requests and responses.
pkg/executorapiScheduler-to-executor lease and event exchange.
pkg/armadaeventsShared workload state-transition events.
pkg/controlplaneeventsShared operator action events.
internal/scheduler/schedulerobjectsInternal cluster and placement state.

This separation limits compatibility pressure. Public job views can stay stable while scheduler placement data and executor coordination evolve behind their own boundaries.

References: pkg/…/submit.pb.go• L4-20 pkg/…/scheduler_reporting.pb.go• L4-18 pkg/…/executorapi.proto• L1-10 pkg/…/events.proto• L1-12 pkg/…/events.proto• L1-7 internal/…/schedulerobjects.proto• L1-7

Change checklist

When these files or sections are changed, remember to consider these:

  • Preserve protobuf field numbers and reserved names. Stored events and older clients depend on them.
  • Regenerate every binding surface that follows a changed source schema. This includes Go types and the public HTTP description.
  • Update every reader of an event oneof when a new event variant is added. An unknown variant can disappear from a projection without a transport error.
  • Keep job state, run state, terminal status, retry policy meaning, and event order aligned across submission, query, and stream contracts.
  • Trace submission fields through the job model and related run or event messages when they affect placement, retries, Kubernetes objects, or external job links.
  • Keep explicit external job URI precedence over the annotation fallback.
  • Keep Armada-specific and native Kubernetes service and ingress forms exclusive.
  • Preserve event-stream resume behavior when changing message IDs, filters, or stream wrappers.
  • Keep diagnostic run-termination events separate from state-changing run events.
  • Keep public scheduler reports separate from internal scheduler objects.

Important failure modes

TriggerConsequenceGuard
A field number is reused after removal.Old messages can decode into a new meaning.Reserve removed field numbers and names.
A new event variant has no consumer update.A state change can be ignored by a status view.Update oneof dispatch and projections with the schema.
A recoverable run error is treated as terminal.A client can show a failed job while Armada prepares another run.Read terminal status with retry policy and job outcome.
A diagnostic termination event is treated as a state change.A run can appear failed even though the event only carries debug data.Keep JobRunTerminatedDebugInfo diagnostic.
A consumer loses its stream message ID.It can miss events after a disconnect.Persist the ID and resume from it.
Both service or ingress representation families are sent.Submission cannot select one resource model.Use one representation family per job.
Generated bindings are stale.Clients and services can disagree about fields or event variants.Regenerate derived contract surfaces before publishing the schema change.
Internal scheduler objects become public models.Placement state becomes a long-term compatibility burden.Keep public and internal packages separate.

Key files

FileWhy to read it
pkg/…/submit.protoDefines job submission, control, queues, retry policy, and shared job models.
pkg/…/job.protoDefines job and run query views.
pkg/…/event.protoDefines the public event stream, resume request, and event projection.
pkg/…/health.protoDefines the shared service health response.
pkg/…/scheduler_reporting.protoDefines public scheduling, queue, and job reports.
pkg/…/executorapi.protoDefines the scheduler-to-executor exchange.
pkg/…/events.protoDefines the shared job and run event envelope and variants.
pkg/…/events.pb.goShows the generated Go event types and oneof binding surface.
pkg/…/events.protoDefines operator action events for platform control.
internal/…/schedulerobjects.protoDefines the scheduler's internal placement view.