Signed-off-by: allencloud <allen.sun@daocloud.io>
| ... | ... |
@@ -19,9 +19,9 @@ Labels: |
| 19 | 19 |
{{- range $k, $v := .Labels }}
|
| 20 | 20 |
{{ $k }}{{if $v }}={{ $v }}{{ end }}
|
| 21 | 21 |
{{- end }}{{ end }}
|
| 22 |
-Mode: |
|
| 23 |
-{{- if .IsModeGlobal }} Global
|
|
| 24 |
-{{- else if .IsModeReplicated }} Replicated
|
|
| 22 |
+Service Mode: |
|
| 23 |
+{{- if .IsModeGlobal }} Global
|
|
| 24 |
+{{- else if .IsModeReplicated }} Replicated
|
|
| 25 | 25 |
{{- if .ModeReplicatedReplicas }}
|
| 26 | 26 |
Replicas: {{ .ModeReplicatedReplicas }}
|
| 27 | 27 |
{{- end }}{{ end }}
|
| ... | ... |
@@ -90,6 +90,7 @@ Resources: |
| 90 | 90 |
{{- if .Networks }}
|
| 91 | 91 |
Networks: |
| 92 | 92 |
{{- range $network := .Networks }} {{ $network }}{{ end }} {{ end }}
|
| 93 |
+Endpoint Mode: {{ .EndpointMode }}
|
|
| 93 | 94 |
{{- if .Ports }}
|
| 94 | 95 |
Ports: |
| 95 | 96 |
{{- range $port := .Ports }}
|
| ... | ... |
@@ -282,6 +283,14 @@ func (ctx *serviceInspectContext) Networks() []string {
|
| 282 | 282 |
return out |
| 283 | 283 |
} |
| 284 | 284 |
|
| 285 |
+func (ctx *serviceInspectContext) EndpointMode() string {
|
|
| 286 |
+ if ctx.Service.Spec.EndpointSpec == nil {
|
|
| 287 |
+ return "" |
|
| 288 |
+ } |
|
| 289 |
+ |
|
| 290 |
+ return string(ctx.Service.Spec.EndpointSpec.Mode) |
|
| 291 |
+} |
|
| 292 |
+ |
|
| 285 | 293 |
func (ctx *serviceInspectContext) Ports() []swarm.PortConfig {
|
| 286 | 294 |
return ctx.Service.Endpoint.Ports |
| 287 | 295 |
} |
| ... | ... |
@@ -122,7 +122,7 @@ func (i *TemplateInspector) tryRawInspectFallback(rawElement []byte) error {
|
| 122 | 122 |
return nil |
| 123 | 123 |
} |
| 124 | 124 |
|
| 125 |
-// Flush write the result of inspecting all elements into the output stream. |
|
| 125 |
+// Flush writes the result of inspecting all elements into the output stream. |
|
| 126 | 126 |
func (i *TemplateInspector) Flush() error {
|
| 127 | 127 |
if i.buffer.Len() == 0 {
|
| 128 | 128 |
_, err := io.WriteString(i.outputStream, "\n") |
| ... | ... |
@@ -156,7 +156,7 @@ func (i *IndentedInspector) Inspect(typedElement interface{}, rawElement []byte)
|
| 156 | 156 |
return nil |
| 157 | 157 |
} |
| 158 | 158 |
|
| 159 |
-// Flush write the result of inspecting all elements into the output stream. |
|
| 159 |
+// Flush writes the result of inspecting all elements into the output stream. |
|
| 160 | 160 |
func (i *IndentedInspector) Flush() error {
|
| 161 | 161 |
if len(i.elements) == 0 && len(i.rawElements) == 0 {
|
| 162 | 162 |
_, err := io.WriteString(i.outputStream, "[]\n") |
| ... | ... |
@@ -115,7 +115,7 @@ ID: c8wgl7q4ndfd52ni6qftkvnnp |
| 115 | 115 |
Name: frontend |
| 116 | 116 |
Labels: |
| 117 | 117 |
- org.example.projectname=demo-app |
| 118 |
-Mode: REPLICATED |
|
| 118 |
+Service Mode: REPLICATED |
|
| 119 | 119 |
Replicas: 5 |
| 120 | 120 |
Placement: |
| 121 | 121 |
UpdateConfig: |
| ... | ... |
@@ -123,6 +123,7 @@ UpdateConfig: |
| 123 | 123 |
ContainerSpec: |
| 124 | 124 |
Image: nginx:alpine |
| 125 | 125 |
Resources: |
| 126 |
+Endpoint Mode: vip |
|
| 126 | 127 |
Ports: |
| 127 | 128 |
Name = |
| 128 | 129 |
Protocol = tcp |
| ... | ... |
@@ -29,7 +29,7 @@ about a service in an easily readable format. |
| 29 | 29 |
|
| 30 | 30 |
ID: 9uk4639qpg7npwf3fn2aasksr |
| 31 | 31 |
Name: helloworld |
| 32 |
- Mode: REPLICATED |
|
| 32 |
+ Service Mode: REPLICATED |
|
| 33 | 33 |
Replicas: 1 |
| 34 | 34 |
Placement: |
| 35 | 35 |
UpdateConfig: |
| ... | ... |
@@ -37,6 +37,8 @@ about a service in an easily readable format. |
| 37 | 37 |
ContainerSpec: |
| 38 | 38 |
Image: alpine |
| 39 | 39 |
Args: ping docker.com |
| 40 |
+ Resources: |
|
| 41 |
+ Endpoint Mode: vip |
|
| 40 | 42 |
``` |
| 41 | 43 |
|
| 42 | 44 |
>**Tip**: To return the service details in json format, run the same command |
| ... | ... |
@@ -59,7 +59,7 @@ update delay: |
| 59 | 59 |
|
| 60 | 60 |
ID: 0u6a4s31ybk7yw2wyvtikmu50 |
| 61 | 61 |
Name: redis |
| 62 |
- Mode: Replicated |
|
| 62 |
+ Service Mode: Replicated |
|
| 63 | 63 |
Replicas: 3 |
| 64 | 64 |
Placement: |
| 65 | 65 |
Strategy: Spread |
| ... | ... |
@@ -69,6 +69,7 @@ update delay: |
| 69 | 69 |
ContainerSpec: |
| 70 | 70 |
Image: redis:3.0.6 |
| 71 | 71 |
Resources: |
| 72 |
+ Endpoint Mode: vip |
|
| 72 | 73 |
``` |
| 73 | 74 |
|
| 74 | 75 |
4. Now you can update the container image for `redis`. The swarm manager |
| ... | ... |
@@ -97,7 +98,7 @@ desired state: |
| 97 | 97 |
|
| 98 | 98 |
ID: 0u6a4s31ybk7yw2wyvtikmu50 |
| 99 | 99 |
Name: redis |
| 100 |
- Mode: Replicated |
|
| 100 |
+ Service Mode: Replicated |
|
| 101 | 101 |
Replicas: 3 |
| 102 | 102 |
Placement: |
| 103 | 103 |
Strategy: Spread |
| ... | ... |
@@ -107,6 +108,7 @@ desired state: |
| 107 | 107 |
ContainerSpec: |
| 108 | 108 |
Image: redis:3.0.7 |
| 109 | 109 |
Resources: |
| 110 |
+ Endpoint Mode: vip |
|
| 110 | 111 |
``` |
| 111 | 112 |
|
| 112 | 113 |
The output of `service inspect` shows if your update paused due to failure: |