Recommendation HTTP API
The /recommendation
endpoints are used to query and interact with Dynamic
Application Sizing recommendations.
This API endpoint and functionality only exists in Nomad Enterprise. This is not present in the open source version of Nomad.
List Recommendations
This endpoint lists all the currently available recommendations and provides optional filtering of that list.
Method | Path | Produces |
---|---|---|
GET | /v1/recommendations | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
YES | namespace:read-job or namespace:submit-recommendation or namespace:submit-job |
Parameters
group
(string: "")
- Specifies the task group name to filter within a job. If specified, thejob
parameter must also be specified.job
(string: "")
- Specifies the job ID to filter the recommendations list by.namespace
(string: "default")
- Specifies the namespace to search. Specifying*
would return all recommendations across all the authorized namespaces.task
(string: "")
- Specifies the task name to filter within a job and task group. If specified, thejob
andgroup
query parameters must also be specified.
Sample Request
Sample Response
Read Recommendation
This endpoint reads information about a specific recommendation.
Method | Path | Produces |
---|---|---|
GET | /v1/recommendation/:recommendation_id | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
YES | namespace:read-job |
Parameters
:recommendation_id
(string: <required>)
- Specifies the recommendation ID to query. This is specified as part of the path.
Sample Request
Sample Response
Apply and Dismiss Recommendations
This endpoint is used to apply and dismiss recommendations.
Method | Path | Produces |
---|---|---|
POST | /v1/recommendations/apply | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:submit-job with namespace:sentinel-override if PolicyOverride set |
Parameters
Apply
(array<string>: nil)
- Specifies a set of recommendation IDs to be applied. This results in Nomad applying the recommendation to the job specification and performing a job register.Dismiss
(array<string>: nil)
- Specifies a set of recommendation IDs to be dismissed. This results in Nomad deleting them from the state store.PolicyOverride
(bool: false)
- If set, any soft mandatory Sentinel policies will be overridden. This allows a recommendation to be applied when it would be denied by a policy.
Sample Payload
Sample Request
Sample Response
Create or Update a Recommendation
This endpoint is used to create or update a recommendation.
Method | Path | Produces |
---|---|---|
POST | /v1/recommendation | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:submit-recommendation or namespace:submit-job |
Parameters
ID
(string: "")
- The ID of an existing recommendation to update.Region
(string: "")
- The Nomad region identifier which contains the job that the recommendation is for. If omitted, this defaults to that of the Nomad agent.Namespace
(string: "")
- The namespace within which the target job is running within. If omitted, this defaults todefault
.JobID
(string: <required>)
- The job ID which this recommendation is for.Group
(string: <required>)
- The task group name within the job which this recommendation is for.Task
(string: <required>)
- The task name within the task group which this recommendation is for.Resource
(string: <required>)
- The resource that the recommendation is for. Possible values areCPU
andMemoryMB
.Value
(int: <required>)
- The value recommendation for the resource. This must met the minimum requirements which are1
forCPU
and10
forMemoryMB
.Meta
(map<string|...>: nil)
- JSON block that is persisted as part of the recommendation providing arbitrary, useful information.Stats
(map<string|float64>: nil)
- A mapping of statistics that are persisted as part of the recommendation providing insight into the recommendation calculation.EnforceVersion
(bool: false)
- Indicates that the recommendation is only valid for the current version of the job. Subsequent job updates will automatically dismiss this recommendation.
Sample Payload
Sample Request
Sample Response