mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #26916 from aaronlehmann/sanity-check-replicatedreplicas
cli: Add more nil checking to service pretty-printer
This commit is contained in:
commit
64af86e74d
1 changed files with 7 additions and 5 deletions
|
@ -21,7 +21,7 @@ Labels:
|
||||||
{{- end }}{{ end }}
|
{{- end }}{{ end }}
|
||||||
Mode:
|
Mode:
|
||||||
{{- if .IsModeGlobal }} Global
|
{{- if .IsModeGlobal }} Global
|
||||||
{{- else }} Replicated
|
{{- else if .IsModeReplicated }} Replicated
|
||||||
{{- if .ModeReplicatedReplicas }}
|
{{- if .ModeReplicatedReplicas }}
|
||||||
Replicas: {{ .ModeReplicatedReplicas }}
|
Replicas: {{ .ModeReplicatedReplicas }}
|
||||||
{{- end }}{{ end }}
|
{{- end }}{{ end }}
|
||||||
|
@ -73,22 +73,20 @@ Mounts:
|
||||||
Resources:
|
Resources:
|
||||||
{{- if .HasResourceReservations }}
|
{{- if .HasResourceReservations }}
|
||||||
Reservations:
|
Reservations:
|
||||||
{{- end }}
|
|
||||||
{{- if gt .ResourceReservationNanoCPUs 0.0 }}
|
{{- if gt .ResourceReservationNanoCPUs 0.0 }}
|
||||||
CPU: {{ .ResourceReservationNanoCPUs }}
|
CPU: {{ .ResourceReservationNanoCPUs }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .ResourceReservationMemory }}
|
{{- if .ResourceReservationMemory }}
|
||||||
Memory: {{ .ResourceReservationMemory }}
|
Memory: {{ .ResourceReservationMemory }}
|
||||||
{{- end }}
|
{{- end }}{{ end }}
|
||||||
{{- if .HasResourceLimits }}
|
{{- if .HasResourceLimits }}
|
||||||
Limits:
|
Limits:
|
||||||
{{- end }}
|
|
||||||
{{- if gt .ResourceLimitsNanoCPUs 0.0 }}
|
{{- if gt .ResourceLimitsNanoCPUs 0.0 }}
|
||||||
CPU: {{ .ResourceLimitsNanoCPUs }}
|
CPU: {{ .ResourceLimitsNanoCPUs }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .ResourceLimitMemory }}
|
{{- if .ResourceLimitMemory }}
|
||||||
Memory: {{ .ResourceLimitMemory }}
|
Memory: {{ .ResourceLimitMemory }}
|
||||||
{{- end }}{{ end }}
|
{{- end }}{{ end }}{{ end }}
|
||||||
{{- if .Networks }}
|
{{- if .Networks }}
|
||||||
Networks:
|
Networks:
|
||||||
{{- range $network := .Networks }} {{ $network }}{{ end }} {{ end }}
|
{{- range $network := .Networks }} {{ $network }}{{ end }} {{ end }}
|
||||||
|
@ -156,6 +154,10 @@ func (ctx *serviceInspectContext) IsModeGlobal() bool {
|
||||||
return ctx.Service.Spec.Mode.Global != nil
|
return ctx.Service.Spec.Mode.Global != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ctx *serviceInspectContext) IsModeReplicated() bool {
|
||||||
|
return ctx.Service.Spec.Mode.Replicated != nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ctx *serviceInspectContext) ModeReplicatedReplicas() *uint64 {
|
func (ctx *serviceInspectContext) ModeReplicatedReplicas() *uint64 {
|
||||||
return ctx.Service.Spec.Mode.Replicated.Replicas
|
return ctx.Service.Spec.Mode.Replicated.Replicas
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue