mirror of https://github.com/docker/cli.git
Merge pull request #26906 from allencloud/add-endpoint-mode-in-service-pretty
add endpoint mode in service pretty
This commit is contained in:
commit
b322c8e506
|
@ -19,9 +19,9 @@ Labels:
|
||||||
{{- range $k, $v := .Labels }}
|
{{- range $k, $v := .Labels }}
|
||||||
{{ $k }}{{if $v }}={{ $v }}{{ end }}
|
{{ $k }}{{if $v }}={{ $v }}{{ end }}
|
||||||
{{- end }}{{ end }}
|
{{- end }}{{ end }}
|
||||||
Mode:
|
Service Mode:
|
||||||
{{- if .IsModeGlobal }} Global
|
{{- if .IsModeGlobal }} Global
|
||||||
{{- else if .IsModeReplicated }} Replicated
|
{{- else if .IsModeReplicated }} Replicated
|
||||||
{{- if .ModeReplicatedReplicas }}
|
{{- if .ModeReplicatedReplicas }}
|
||||||
Replicas: {{ .ModeReplicatedReplicas }}
|
Replicas: {{ .ModeReplicatedReplicas }}
|
||||||
{{- end }}{{ end }}
|
{{- end }}{{ end }}
|
||||||
|
@ -90,6 +90,7 @@ Resources:
|
||||||
{{- if .Networks }}
|
{{- if .Networks }}
|
||||||
Networks:
|
Networks:
|
||||||
{{- range $network := .Networks }} {{ $network }}{{ end }} {{ end }}
|
{{- range $network := .Networks }} {{ $network }}{{ end }} {{ end }}
|
||||||
|
Endpoint Mode: {{ .EndpointMode }}
|
||||||
{{- if .Ports }}
|
{{- if .Ports }}
|
||||||
Ports:
|
Ports:
|
||||||
{{- range $port := .Ports }}
|
{{- range $port := .Ports }}
|
||||||
|
@ -282,6 +283,14 @@ func (ctx *serviceInspectContext) Networks() []string {
|
||||||
return out
|
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 {
|
func (ctx *serviceInspectContext) Ports() []swarm.PortConfig {
|
||||||
return ctx.Service.Endpoint.Ports
|
return ctx.Service.Endpoint.Ports
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ func (i *TemplateInspector) tryRawInspectFallback(rawElement []byte) error {
|
||||||
return nil
|
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 {
|
func (i *TemplateInspector) Flush() error {
|
||||||
if i.buffer.Len() == 0 {
|
if i.buffer.Len() == 0 {
|
||||||
_, err := io.WriteString(i.outputStream, "\n")
|
_, err := io.WriteString(i.outputStream, "\n")
|
||||||
|
@ -156,7 +156,7 @@ func (i *IndentedInspector) Inspect(typedElement interface{}, rawElement []byte)
|
||||||
return nil
|
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 {
|
func (i *IndentedInspector) Flush() error {
|
||||||
if len(i.elements) == 0 && len(i.rawElements) == 0 {
|
if len(i.elements) == 0 && len(i.rawElements) == 0 {
|
||||||
_, err := io.WriteString(i.outputStream, "[]\n")
|
_, err := io.WriteString(i.outputStream, "[]\n")
|
||||||
|
|
Loading…
Reference in New Issue