docs: Update sample JSON in Create Job API (#10108)

This is maybe a more realistic job that someone would actually submit
via the API; it more closely aligns with the example job from `nomad
job init`.

It's also been updated to use group network and service definitions.
This commit is contained in:
Kris Hicks 2021-03-08 10:06:28 -08:00 committed by GitHub
parent 4c4ea23e6f
commit 3a35521cf5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -126,108 +126,44 @@ The table below shows this endpoint's support for
```json ```json
{ {
"EnforceIndex": false,
"PreserveCounts": true,
"PolicyOverride": false,
"JobModifyIndex": 0,
"Job": { "Job": {
"ID": "example", "Datacenters": [
"Name": "example", "dc1"
"Type": "service", ],
"Priority": 50, "ID": "cache",
"Datacenters": ["dc1"],
"TaskGroups": [ "TaskGroups": [
{ {
"Name": "cache", "Name": "cache",
"Count": 1, "Networks": [
"Tasks": [
{ {
"Name": "redis", "DynamicPorts": [
"Driver": "docker",
"User": "",
"Config": {
"image": "redis:3.2",
"port_map": [
{
"db": 6379
}
]
},
"Services": [
{ {
"Id": "", "Label": "db",
"Name": "redis-cache", "To": 6379
"Tags": ["global", "cache"],
"Meta": {
"meta": "for my service"
},
"PortLabel": "db",
"AddressMode": "",
"Checks": [
{
"Id": "",
"Name": "alive",
"Type": "tcp",
"Command": "",
"Args": null,
"Path": "",
"Protocol": "",
"PortLabel": "",
"Interval": 10000000000,
"Timeout": 2000000000,
"InitialStatus": "",
"TLSSkipVerify": false
}
]
} }
], ]
"Resources": {
"CPU": 500,
"MemoryMB": 256,
"Networks": [
{
"Device": "",
"CIDR": "",
"IP": "",
"MBits": 10,
"DynamicPorts": [
{
"Label": "db",
"Value": 0
}
]
}
]
},
"Leader": false
} }
], ],
"RestartPolicy": { "Services": [
"Interval": 300000000000, {
"Attempts": 10, "Name": "redis-cache",
"Delay": 25000000000, "PortLabel": "db"
"Mode": "delay" }
}, ],
"ReschedulePolicy": { "Tasks": [
"Attempts": 10, {
"Delay": 30000000000, "Config": {
"DelayFunction": "exponential", "image": "redis:3.2",
"Interval": 36000000000000, "ports": [
"MaxDelay": 3600000000000, "db"
"Unlimited": false ]
}, },
"EphemeralDisk": { "Driver": "docker",
"SizeMB": 300 "Name": "redis"
} }
]
} }
], ]
"Update": {
"MaxParallel": 1,
"MinHealthyTime": 10000000000,
"HealthyDeadline": 180000000000,
"AutoRevert": false,
"Canary": 0
}
} }
} }
``` ```