Merge pull request #2661 from akerouanton/fix-service-formatter

Pretty service inspect fails when TaskTemplate.Resources is nil
This commit is contained in:
Sebastiaan van Stijn 2020-07-30 21:21:26 +02:00 committed by GitHub
commit 5f979eeac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -502,6 +502,9 @@ func (ctx *serviceInspectContext) ResourceLimitMemory() string {
}
func (ctx *serviceInspectContext) ResourceLimitPids() int64 {
if ctx.Service.Spec.TaskTemplate.Resources == nil || ctx.Service.Spec.TaskTemplate.Resources.Limits == nil {
return 0
}
return ctx.Service.Spec.TaskTemplate.Resources.Limits.Pids
}