open-nomad/nomad/deploymentwatcher
Seth Hoenig ba728f8f97
api: enable support for setting original job source (#16763)
* api: enable support for setting original source alongside job

This PR adds support for setting job source material along with
the registration of a job.

This includes a new HTTP endpoint and a new RPC endpoint for
making queries for the original source of a job. The
HTTP endpoint is /v1/job/<id>/submission?version=<version> and
the RPC method is Job.GetJobSubmission.

The job source (if submitted, and doing so is always optional), is
stored in the job_submission memdb table, separately from the
actual job. This way we do not incur overhead of reading the large
string field throughout normal job operations.

The server config now includes job_max_source_size for configuring
the maximum size the job source may be, before the server simply
drops the source material. This should help prevent Bad Things from
happening when huge jobs are submitted. If the value is set to 0,
all job source material will be dropped.

* api: avoid writing var content to disk for parsing

* api: move submission validation into RPC layer

* api: return an error if updating a job submission without namespace or job id

* api: be exact about the job index we associate a submission with (modify)

* api: reword api docs scheduling

* api: prune all but the last 6 job submissions

* api: protect against nil job submission in job validation

* api: set max job source size in test server

* api: fixups from pr
2023-04-11 08:45:08 -05:00
..
batcher.go [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
deployment_watcher.go [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
deployments_watcher.go [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
deployments_watcher_test.go api: enable support for setting original job source (#16763) 2023-04-11 08:45:08 -05:00
doc.go [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
multiregion_oss.go [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
testutil_test.go api: enable support for setting original job source (#16763) 2023-04-11 08:45:08 -05:00