5db3a671db
* cli: add -json flag to support job commands
While the CLI has always supported running JSON jobs, its support has
been via HCLv2's JSON parsing. I have no idea what format it expects the
job to be in, but it's absolutely not in the same format as the API
expects.
So I ignored that and added a new -json flag to explicitly support *API*
style JSON jobspecs.
The jobspecs can even have the wrapping {"Job": {...}} envelope or not!
* docs: fix example for `nomad job validate`
We haven't been able to validate inside driver config stanzas ever since
the move to task driver plugins. 😭
128 lines
4.1 KiB
JSON
128 lines
4.1 KiB
JSON
{
|
|
"Job": {
|
|
"Region": null,
|
|
"Namespace": null,
|
|
"ID": "example",
|
|
"Name": "example",
|
|
"Type": null,
|
|
"Priority": null,
|
|
"AllAtOnce": null,
|
|
"Datacenters": [
|
|
"dc1"
|
|
],
|
|
"Constraints": null,
|
|
"Affinities": null,
|
|
"TaskGroups": [
|
|
{
|
|
"Name": "cache",
|
|
"Count": null,
|
|
"Constraints": null,
|
|
"Affinities": null,
|
|
"Tasks": [
|
|
{
|
|
"Name": "redis",
|
|
"Driver": "docker",
|
|
"User": "",
|
|
"Lifecycle": null,
|
|
"Config": {
|
|
"auth_soft_fail": true,
|
|
"image": "redis:3.2",
|
|
"ports": [
|
|
"db"
|
|
]
|
|
},
|
|
"Constraints": null,
|
|
"Affinities": null,
|
|
"Env": null,
|
|
"Services": null,
|
|
"Resources": {
|
|
"CPU": 500,
|
|
"Cores": null,
|
|
"MemoryMB": 256,
|
|
"MemoryMaxMB": null,
|
|
"DiskMB": null,
|
|
"Networks": null,
|
|
"Devices": null,
|
|
"IOPS": null
|
|
},
|
|
"RestartPolicy": null,
|
|
"Meta": null,
|
|
"KillTimeout": null,
|
|
"LogConfig": null,
|
|
"Artifacts": null,
|
|
"Vault": null,
|
|
"Templates": null,
|
|
"DispatchPayload": null,
|
|
"VolumeMounts": null,
|
|
"Leader": false,
|
|
"ShutdownDelay": 0,
|
|
"KillSignal": "",
|
|
"Kind": "",
|
|
"ScalingPolicies": null
|
|
}
|
|
],
|
|
"Spreads": null,
|
|
"Volumes": null,
|
|
"RestartPolicy": null,
|
|
"ReschedulePolicy": null,
|
|
"EphemeralDisk": null,
|
|
"Update": null,
|
|
"Migrate": null,
|
|
"Networks": [
|
|
{
|
|
"Mode": "",
|
|
"Device": "",
|
|
"CIDR": "",
|
|
"IP": "",
|
|
"DNS": null,
|
|
"ReservedPorts": null,
|
|
"DynamicPorts": [
|
|
{
|
|
"Label": "db",
|
|
"Value": 0,
|
|
"To": 6379,
|
|
"HostNetwork": ""
|
|
}
|
|
],
|
|
"Hostname": "",
|
|
"MBits": null
|
|
}
|
|
],
|
|
"Meta": null,
|
|
"Services": null,
|
|
"ShutdownDelay": null,
|
|
"StopAfterClientDisconnect": null,
|
|
"MaxClientDisconnect": null,
|
|
"Scaling": null,
|
|
"Consul": null
|
|
}
|
|
],
|
|
"Update": null,
|
|
"Multiregion": null,
|
|
"Spreads": null,
|
|
"Periodic": null,
|
|
"ParameterizedJob": null,
|
|
"Reschedule": null,
|
|
"Migrate": null,
|
|
"Meta": null,
|
|
"ConsulToken": null,
|
|
"VaultToken": null,
|
|
"Stop": null,
|
|
"ParentID": null,
|
|
"Dispatched": false,
|
|
"DispatchIdempotencyToken": null,
|
|
"Payload": null,
|
|
"ConsulNamespace": null,
|
|
"VaultNamespace": null,
|
|
"NomadTokenID": null,
|
|
"Status": null,
|
|
"StatusDescription": null,
|
|
"Stable": null,
|
|
"Version": null,
|
|
"SubmitTime": null,
|
|
"CreateIndex": null,
|
|
"ModifyIndex": null,
|
|
"JobModifyIndex": null
|
|
}
|
|
}
|