Skip to content

Commit

Permalink
Always set (empty) UpdateStatus
Browse files Browse the repository at this point in the history
When deploying a service the `UpdateStatus.State` field is not present
during `docker service create`. This complicates creating scripts that
check for `UpdateStatus.State` to reach a certain state, as they have to take
into account that the `UpdateStatus` as a whole is missing.

This patch always sets the `UpdateStatus.State` to make it easier to consume.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Jan 4, 2021
1 parent d6592dd commit 96f1b6e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions manager/controlapi/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,9 +730,10 @@ func (s *Server) CreateService(ctx context.Context, request *api.CreateServiceRe
// TODO(aluzzardi): Consider using `Name` as a primary key to handle
// duplicate creations. See #65
service := &api.Service{
ID: identity.NewID(),
Spec: *request.Spec,
SpecVersion: &api.Version{},
ID: identity.NewID(),
Spec: *request.Spec,
SpecVersion: &api.Version{},
UpdateStatus: &api.UpdateStatus{},
}

if isJobSpec(request.Spec) {
Expand Down

0 comments on commit 96f1b6e

Please sign in to comment.