diff --git a/cli/command/formatter/service.go b/cli/command/formatter/service.go index a1872e91b9..a92326e75d 100644 --- a/cli/command/formatter/service.go +++ b/cli/command/formatter/service.go @@ -19,9 +19,9 @@ Labels: {{- range $k, $v := .Labels }} {{ $k }}{{if $v }}={{ $v }}{{ end }} {{- end }}{{ end }} -Mode: -{{- if .IsModeGlobal }} Global -{{- else if .IsModeReplicated }} Replicated +Service Mode: +{{- if .IsModeGlobal }} Global +{{- else if .IsModeReplicated }} Replicated {{- if .ModeReplicatedReplicas }} Replicas: {{ .ModeReplicatedReplicas }} {{- end }}{{ end }} @@ -90,6 +90,7 @@ Resources: {{- if .Networks }} Networks: {{- range $network := .Networks }} {{ $network }}{{ end }} {{ end }} +Endpoint Mode: {{ .EndpointMode }} {{- if .Ports }} Ports: {{- range $port := .Ports }} @@ -282,6 +283,14 @@ func (ctx *serviceInspectContext) Networks() []string { return out } +func (ctx *serviceInspectContext) EndpointMode() string { + if ctx.Service.Spec.EndpointSpec == nil { + return "" + } + + return string(ctx.Service.Spec.EndpointSpec.Mode) +} + func (ctx *serviceInspectContext) Ports() []swarm.PortConfig { return ctx.Service.Endpoint.Ports } diff --git a/cli/command/inspect/inspector.go b/cli/command/inspect/inspector.go index b0537e8464..1d81643fb1 100644 --- a/cli/command/inspect/inspector.go +++ b/cli/command/inspect/inspector.go @@ -122,7 +122,7 @@ func (i *TemplateInspector) tryRawInspectFallback(rawElement []byte) error { return nil } -// Flush write the result of inspecting all elements into the output stream. +// Flush writes the result of inspecting all elements into the output stream. func (i *TemplateInspector) Flush() error { if i.buffer.Len() == 0 { _, err := io.WriteString(i.outputStream, "\n") @@ -156,7 +156,7 @@ func (i *IndentedInspector) Inspect(typedElement interface{}, rawElement []byte) return nil } -// Flush write the result of inspecting all elements into the output stream. +// Flush writes the result of inspecting all elements into the output stream. func (i *IndentedInspector) Flush() error { if len(i.elements) == 0 && len(i.rawElements) == 0 { _, err := io.WriteString(i.outputStream, "[]\n") diff --git a/docs/reference/commandline/service_inspect.md b/docs/reference/commandline/service_inspect.md index 4923d8e706..e24927f433 100644 --- a/docs/reference/commandline/service_inspect.md +++ b/docs/reference/commandline/service_inspect.md @@ -115,7 +115,7 @@ ID: c8wgl7q4ndfd52ni6qftkvnnp Name: frontend Labels: - org.example.projectname=demo-app -Mode: REPLICATED +Service Mode: REPLICATED Replicas: 5 Placement: UpdateConfig: @@ -123,6 +123,7 @@ UpdateConfig: ContainerSpec: Image: nginx:alpine Resources: +Endpoint Mode: vip Ports: Name = Protocol = tcp diff --git a/docs/swarm/swarm-tutorial/inspect-service.md b/docs/swarm/swarm-tutorial/inspect-service.md index 72e26daf6d..62d235815b 100644 --- a/docs/swarm/swarm-tutorial/inspect-service.md +++ b/docs/swarm/swarm-tutorial/inspect-service.md @@ -29,7 +29,7 @@ about a service in an easily readable format. ID: 9uk4639qpg7npwf3fn2aasksr Name: helloworld - Mode: REPLICATED + Service Mode: REPLICATED Replicas: 1 Placement: UpdateConfig: @@ -37,6 +37,8 @@ about a service in an easily readable format. ContainerSpec: Image: alpine Args: ping docker.com + Resources: + Endpoint Mode: vip ``` >**Tip**: To return the service details in json format, run the same command diff --git a/docs/swarm/swarm-tutorial/rolling-update.md b/docs/swarm/swarm-tutorial/rolling-update.md index 8594611399..77b379572a 100644 --- a/docs/swarm/swarm-tutorial/rolling-update.md +++ b/docs/swarm/swarm-tutorial/rolling-update.md @@ -59,7 +59,7 @@ update delay: ID: 0u6a4s31ybk7yw2wyvtikmu50 Name: redis - Mode: Replicated + Service Mode: Replicated Replicas: 3 Placement: Strategy: Spread @@ -69,6 +69,7 @@ update delay: ContainerSpec: Image: redis:3.0.6 Resources: + Endpoint Mode: vip ``` 4. Now you can update the container image for `redis`. The swarm manager @@ -97,7 +98,7 @@ desired state: ID: 0u6a4s31ybk7yw2wyvtikmu50 Name: redis - Mode: Replicated + Service Mode: Replicated Replicas: 3 Placement: Strategy: Spread @@ -107,6 +108,7 @@ desired state: ContainerSpec: Image: redis:3.0.7 Resources: + Endpoint Mode: vip ``` The output of `service inspect` shows if your update paused due to failure: