Submission API
The Submission API is Armada's server-side entry point for placing Kubernetes-style jobs into a queue. It authenticates the caller, checks queue access and request safety rules, assigns or reuses job IDs, and publishes accepted jobs as events for the scheduling system.
API boundary
Submission endpoint
The Submit service exposes SubmitJobs over gRPC and through the HTTP gateway at POST /v1/job/submit. One request names a queue and a job set, then carries one or more job items. Each item describes the workload's pod specification and scheduling metadata.
The response contains one result for each input item. A result normally contains a new job ID. When Armada recognizes the item's client ID as an earlier submission, it returns the original job ID instead of creating another job.
References: pkg/…/submit.proto• L14-32 pkg/…/submit.proto• L59-64 pkg/…/submit.proto• L168-176 pkg/…/submit.proto• L439-445
Request shape
The request groups jobs by queue and job_set_id. A job item supplies its namespace, pod specification, priority, labels, annotations, optional scheduler name, and optional service or ingress settings. The client_id is an application-supplied idempotency key for that job within the queue.
Armada accepts either the legacy single pod_spec field or the newer pod_specs field, but not both. The current validation path supports only one pod specification. The server also resolves an external job URI from the explicit field or from its documented annotation fallback.
References: pkg/…/submit.proto• L14-32 pkg/…/submit.proto• L60-64 internal/…/submit_request.go• L136-150 internal/…/conversions.go• L33-58
Request acceptance
Authentication boundary
Authentication happens before the submission handler runs. The server can be configured with more than one authentication service, such as basic authentication, Kubernetes-native authentication, OpenID, or anonymous access. A successful service creates a principal in the request context; the principal supplies the caller name and group membership used by later checks.
Authentication proves who made the request. It does not by itself grant permission to submit to a queue.
References: internal/…/server.go• L62-73 internal/…/grpc.go• L35-76 internal/…/setup.go• L11-40 internal/…/common.go• L106-129
Queue authorization
Before request validation, SubmitJobs loads the named queue from the server's queue cache and checks the principal against the submission boundary. The caller passes if it has the global submit_any_jobs permission or if the queue grants the submit verb to the user or one of the user's groups.
This check makes queue access a separate boundary from request validity. A well-formed job is still rejected when the queue is missing or the principal lacks the required global or queue-level permission. The user name and groups that pass this boundary are carried with the published event sequence for downstream ownership and audit context.
References: internal/…/submit.go• L72-84 internal/…/submit.go• L430-448 internal/…/authorization.go• L40-84 internal/…/permissions.go• L5-22
Request validation
Validation checks the request as a whole and then checks each job item. It rejects missing queue or job-set data and rejects job items that lack a namespace or usable pod specification. It also protects later services from unsupported or unsafe workload settings.
The main validation groups are:
- Pod structure and serialized size.
- Resource requests and limits, including server minimums and allowed limit-to-request ratios.
- Supported priority classes and node affinity.
- Container ports, ingress definitions, tolerations, and termination grace periods.
- Client ID length and supported price-band metadata.
- Gang consistency across jobs in the same request.
The validator returns the first failure. The server maps a validation failure to gRPC InvalidArgument, so the request does not publish any job event.
References: internal/…/submit_request.go• L18-69 internal/…/submit_request.go• L72-83 internal/…/submit_request.go• L136-224 internal/…/submit_request.go• L229-308 internal/…/submit_request.go• L331-387
Server defaults
After validation, the server converts each new item into an internal SubmitJob event. During this step it applies configured defaults that make the job complete for downstream systems. These defaults can set pod deadlines, priority class, resource values, tolerations, termination grace periods, and gang metadata.
The conversion also creates the additional Kubernetes objects described by service and ingress settings. Labels and annotations can contain a job ID template, which the server resolves after it creates the ID. These changes are part of the accepted event and therefore become the view used by scheduling and execution.
References: internal/…/conversions.go• L21-61 internal/…/post_process.go• L25-38 internal/…/post_process.go• L61-75 internal/…/post_process.go• L77-184 internal/…/post_process.go• L222-252
Submission flow
Batch processing
The handler processes all items in one request after the queue and request checks pass. It first looks up prior client IDs, then returns existing IDs for duplicates and builds new events for the remaining items. If every item is a duplicate, it returns the collected IDs without publishing a new event sequence.
For a request with new jobs, the server publishes one event sequence containing the queue, job set, submitting user, user groups, and the new job events. It stores new client-ID mappings only after publication succeeds. A lookup or storage failure is logged as a warning because deduplication is best effort.
The following flow shows the acceptance order and the two outcomes for duplicate items.
flowchart LR
A[Authenticated request] --> B[Load queue]
B --> C[Check submit access]
C --> D[Validate batch and job items]
D --> E[Look up client IDs]
E --> F{New jobs?}
F -->|No| G[Return existing job IDs]
F -->|Yes| H[Create job events and apply defaults]
H --> I[Publish job-set event sequence]
I --> J[Store client-ID mappings]
J --> K[Return job IDs]
References: internal/…/submit.go• L64-152 internal/…/deduplicaton.go• L13-17 internal/…/deduplicaton.go• L28-67
Duplicate handling
A client ID is a caller-controlled deduplication key scoped by queue. When the database contains a mapping for that queue and client ID, the server returns the mapped job ID and skips event creation for that item.
Deduplication is not a transaction with event publication. If publication fails after only part of the event batch reaches the event system, the server does not store the new mappings. A retry can therefore create duplicates even when the first call returned an error. Clients that need retry-safe submission should provide stable client IDs and reconcile the returned job IDs.
References: internal/…/deduplicaton.go• L28-67 internal/…/submit.go• L86-105 internal/…/submit.go• L122-152
Scheduling handoff
Job-set event sequence
The server does not schedule a job or start a pod. It publishes a EventSequence to Armada's job-set event topic. This message is the durable handoff between API acceptance and the services that build scheduler and execution state.
The sequence carries queue and job-set scope plus the submitting principal's identity and groups. Each new job appears as a timestamped SubmitJob event. The event contains the job ID, deduplication ID, priority, workload objects, scheduler choice, and external job URI needed by later services.
References: pkg/…/events.proto• L64-109 pkg/…/events.proto• L123-164 internal/…/submit.go• L132-145 internal/…/server.go• L138-163
Scheduler ingestion
The scheduler ingester consumes the job-set event topic and applies each sequence to scheduler state. For a submission, it stores the full job data for later executor use and derives a smaller scheduling view so the scheduler can make placement decisions without loading the full workload specification.
The scheduling view includes the job's priority, lifetime, retry-related run flags, submit time, priority class, pod resource needs, and scheduling annotations. The scheduler then considers that queued work during its normal scheduling cycle. The queue and job lifecycle page describes the later queue, run, retry, and query state changes.
References: internal/…/ingester.go• L24-26 internal/…/ingester.go• L51-65 internal/…/instructions.go• L81-148 internal/…/instructions.go• L151-176 internal/…/instructions.go• L633-684
Publication contract
Publication success means that the server handed the accepted event sequence to the event transport. It does not mean that the job has started or that a scheduler has found capacity. Scheduling and execution happen after ingestion.
The publisher prepares event sequences for transport, serializes them, assigns their transport key, and waits for send callbacks. If one or more sends fail, SubmitJobs returns gRPC Internal and does not record new deduplication mappings. This boundary is why callers must distinguish API acceptance from later scheduling progress.
References: internal/…/publisher.go• L51-95 internal/…/submit.go• L141-152 pkg/…/events.proto• L64-109
Related pages
Parent and lifecycle pages
The Job submission and queue management page gives the wider server view, including queue definitions, retry policy control, and query-facing state. The Queue and job lifecycle page follows an accepted job through scheduling, executor reports, retries, terminal states, and queries.
References: internal/…/server.go• L183-220 internal/…/schedulerapp.go• L367-385 internal/…/query_api.go• L17-42
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the HTTP and gRPC submission contract aligned with generated gateway bindings and all client SDKs.
- Keep validation rules aligned with the fields consumed by conversion, scheduler ingestion, and executor job startup.
- Preserve the queue-scoped meaning of client IDs when changing deduplication storage or retry behavior.
- Keep the event sequence metadata aligned with authorization identity and group propagation into scheduler and Kubernetes-facing state.
- When changing
SubmitJob, update both full job storage and the reduced scheduling view so the scheduler and executor do not receive different job meaning. - Treat publication and deduplication storage as separate failure boundaries when changing acknowledgement or retry behavior.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Authentication cannot create a principal | The request does not reach submission authorization | Keep at least one configured authentication service usable for the client path |
| Queue is absent from the queue cache | Authorization cannot complete and the job is not published | Create the queue and allow its cache to refresh before submission |
Principal lacks submit_any_jobs and the queue submit verb | The server returns PermissionDenied | Grant a global submit permission or queue access to the user or group |
| Job item fails a validation rule | The whole request returns InvalidArgument and publishes no new job events | Correct the queue, job-set, pod, resource, placement, or gang data |
| Job-set event publication fails | The server returns Internal; new deduplication mappings are not stored | Restore event transport and use stable client IDs when retrying |
| Deduplication lookup or storage fails | Submission can continue without duplicate protection, or a retry can create another job | Treat deduplication as best effort and reconcile client IDs with returned job IDs |
| Event ingestion cannot derive scheduling information | The accepted event cannot become scheduler state | Keep the SubmitJob event shape compatible with scheduler ingestion |
Key files
| File | Why to read it |
|---|---|
| pkg/…/submit.proto | Defines the public job submission request, response, and endpoint contract. |
| internal/…/submit.go | Shows the server acceptance order and event publication boundary. |
| internal/…/submit_request.go | Defines the request and workload safety rules. |
| internal/…/conversions.go | Shows how an accepted API item becomes a job event. |
| internal/…/post_process.go | Shows the server policy defaults applied before publication. |
| internal/…/deduplicaton.go | Defines queue-scoped client-ID deduplication. |
| internal/…/grpc.go | Shows the authentication boundary applied to gRPC requests. |
| internal/…/authorization.go | Defines global and queue-level authorization checks. |
| pkg/…/events.proto | Defines the event sequence that carries accepted jobs to downstream services. |
| internal/…/instructions.go | Shows how submission events become stored job data and scheduler input. |
| internal/…/ingester.go | Shows the event-topic ingestion path for scheduler state. |
| internal/…/publisher.go | Defines the publication success and failure boundary. |