Merge pull request #26916 from aaronlehmann/sanity-check-replicatedreplicas
cli: Add more nil checking to service pretty-printer Upstream-commit: 64af86e74d4ed4a8f5adce88212e9c69020ae986 Component: engine
This commit is contained in:
@ -21,7 +21,7 @@ Labels:
|
||||
{{- end }}{{ end }}
|
||||
Mode:
|
||||
{{- if .IsModeGlobal }} Global
|
||||
{{- else }} Replicated
|
||||
{{- else if .IsModeReplicated }} Replicated
|
||||
{{- if .ModeReplicatedReplicas }}
|
||||
Replicas: {{ .ModeReplicatedReplicas }}
|
||||
{{- end }}{{ end }}
|
||||
@ -73,22 +73,20 @@ Mounts:
|
||||
Resources:
|
||||
{{- if .HasResourceReservations }}
|
||||
Reservations:
|
||||
{{- end }}
|
||||
{{- if gt .ResourceReservationNanoCPUs 0.0 }}
|
||||
CPU: {{ .ResourceReservationNanoCPUs }}
|
||||
{{- end }}
|
||||
{{- if .ResourceReservationMemory }}
|
||||
Memory: {{ .ResourceReservationMemory }}
|
||||
{{- end }}
|
||||
{{- end }}{{ end }}
|
||||
{{- if .HasResourceLimits }}
|
||||
Limits:
|
||||
{{- end }}
|
||||
{{- if gt .ResourceLimitsNanoCPUs 0.0 }}
|
||||
CPU: {{ .ResourceLimitsNanoCPUs }}
|
||||
{{- end }}
|
||||
{{- if .ResourceLimitMemory }}
|
||||
Memory: {{ .ResourceLimitMemory }}
|
||||
{{- end }}{{ end }}
|
||||
{{- end }}{{ end }}{{ end }}
|
||||
{{- if .Networks }}
|
||||
Networks:
|
||||
{{- range $network := .Networks }} {{ $network }}{{ end }} {{ end }}
|
||||
@ -156,6 +154,10 @@ func (ctx *serviceInspectContext) IsModeGlobal() bool {
|
||||
return ctx.Service.Spec.Mode.Global != nil
|
||||
}
|
||||
|
||||
func (ctx *serviceInspectContext) IsModeReplicated() bool {
|
||||
return ctx.Service.Spec.Mode.Replicated != nil
|
||||
}
|
||||
|
||||
func (ctx *serviceInspectContext) ModeReplicatedReplicas() *uint64 {
|
||||
return ctx.Service.Spec.Mode.Replicated.Replicas
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user