Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --health-* flags to service create and update #27369

Merged
merged 2 commits into from
Oct 28, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
vendor: update swarmkit
Signed-off-by: Cezar Sa Espinola <cezarsa@gmail.com>
  • Loading branch information
cezarsa committed Oct 28, 2016
commit fd657a10d093d5dc838a07098054d0b855718f3b
2 changes: 1 addition & 1 deletion hack/vendor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ clone git github.com/docker/containerd 52ef1ceb4b660c42cf4ea9013180a5663968d4c7
clone git github.com/tonistiigi/fifo 8c56881ce5e63e19e2dfc495c8af0fb90916467d

# cluster
clone git github.com/docker/swarmkit 0ec7c6ee4b3185ec4e3d6bd65f8f5542b1761421
clone git github.com/docker/swarmkit 72981f443024da2c57d54b915eae0477be6dada5
clone git github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
clone git github.com/gogo/protobuf v0.3
clone git github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a
Expand Down
23 changes: 23 additions & 0 deletions vendor/src/github.com/docker/swarmkit/agent/exec/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ type ContainerStatuser interface {
ContainerStatus(ctx context.Context) (*api.ContainerStatus, error)
}

// PortStatuser reports status of ports which are allocated by the executor
type PortStatuser interface {
// PortStatus returns the status on a list of PortConfigs
// which are managed at the host level by the controller.
PortStatus(ctx context.Context) (*api.PortStatus, error)
}

// Resolve attempts to get a controller from the executor and reports the
// correct status depending on the tasks current state according to the result.
//
Expand Down Expand Up @@ -131,6 +138,7 @@ func Do(ctx context.Context, task *api.Task, ctlr Controller) (*api.TaskStatus,
// this particular method. Eventually, we assemble this as part of a defer.
var (
containerStatus *api.ContainerStatus
portStatus *api.PortStatus
exitCode int
)

Expand Down Expand Up @@ -230,6 +238,21 @@ func Do(ctx context.Context, task *api.Task, ctlr Controller) (*api.TaskStatus,
status.RuntimeStatus = &api.TaskStatus_Container{
Container: containerStatus,
}

if portStatus == nil {
pctlr, ok := ctlr.(PortStatuser)
if !ok {
return
}

var err error
portStatus, err = pctlr.PortStatus(ctx)
if err != nil && !contextDoneError(err) {
log.G(ctx).WithError(err).Error("container port status unavailable")
}
}

status.PortStatus = portStatus
}()

if task.DesiredState == api.TaskStateShutdown {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,35 @@ func (_m *MockContainerStatuser) ContainerStatus(ctx context.Context) (*api.Cont
func (_mr *_MockContainerStatuserRecorder) ContainerStatus(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ContainerStatus", arg0)
}

// Mock of PortStatuser interface
type MockPortStatuser struct {
ctrl *gomock.Controller
recorder *_MockPortStatuserRecorder
}

// Recorder for MockPortStatuser (not exported)
type _MockPortStatuserRecorder struct {
mock *MockPortStatuser
}

func NewMockPortStatuser(ctrl *gomock.Controller) *MockPortStatuser {
mock := &MockPortStatuser{ctrl: ctrl}
mock.recorder = &_MockPortStatuserRecorder{mock}
return mock
}

func (_m *MockPortStatuser) EXPECT() *_MockPortStatuserRecorder {
return _m.recorder
}

func (_m *MockPortStatuser) PortStatus(ctx context.Context) (*api.PortStatus, error) {
ret := _m.ctrl.Call(_m, "PortStatus", ctx)
ret0, _ := ret[0].(*api.PortStatus)
ret1, _ := ret[1].(error)
return ret0, ret1
}

func (_mr *_MockPortStatuserRecorder) PortStatus(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "PortStatus", arg0)
}
Loading