Deployment adds JobSpecModifyIndex

Deployment tracks the Job.JobModifyIndex so that PUTS against /v1/jobs
can be more easily coorelated with the created deployment.

Fixes https://github.com/hashicorp/nomad/issues/4301
This commit is contained in:
Alex Dadgar
2018-05-30 11:33:56 -07:00
parent d633ce3ed5
commit b683439b0d
2 changed files with 53 additions and 20 deletions

View File

@@ -125,17 +125,44 @@ func (d *Deployments) SetAllocHealth(deploymentID string, healthy, unhealthy []s
// Deployment is used to serialize an deployment.
type Deployment struct {
ID string
Namespace string
JobID string
JobVersion uint64
JobModifyIndex uint64
JobCreateIndex uint64
TaskGroups map[string]*DeploymentState
Status string
// ID is a generated UUID for the deployment
ID string
// Namespace is the namespace the deployment is created in
Namespace string
// JobID is the job the deployment is created for
JobID string
// JobVersion is the version of the job at which the deployment is tracking
JobVersion uint64
// JobModifyIndex is the modify index of the job at which the deployment is
// tracking. This is the ModifyIndex field on the job.
JobModifyIndex uint64
// JobSpecModifyIndex is the modify index of the job spec at which the
// deployment is tracking. This is the JobModifyIndex field on the job.
JobSpecModifyIndex uint64
// JobCreateIndex is the create index of the job which the deployment is
// tracking. It is needed so that if the job gets stopped and reran we can
// present the correct list of deployments for the job and not old ones.
JobCreateIndex uint64
// TaskGroups is the set of task groups effected by the deployment and their
// current deployment status.
TaskGroups map[string]*DeploymentState
// The status of the deployment
Status string
// StatusDescription allows a human readable description of the deployment
// status.
StatusDescription string
CreateIndex uint64
ModifyIndex uint64
CreateIndex uint64
ModifyIndex uint64
}
// DeploymentState tracks the state of a deployment for a given task group.