From cb2802ed752148e2015e3de248e7de573f4d9006 Mon Sep 17 00:00:00 2001 From: Kevin Stroud Date: Tue, 29 Jan 2019 15:07:19 +0200 Subject: [PATCH] Cleanup --- controller/pc-docker/service.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controller/pc-docker/service.go b/controller/pc-docker/service.go index 8f301d7..c8b0df9 100644 --- a/controller/pc-docker/service.go +++ b/controller/pc-docker/service.go @@ -149,7 +149,10 @@ func TotalReplicas(services []swarm.Service, nodes []swarm.Node, tasks []swarm.T for _, service := range services { if service.Spec.Mode.Replicated != nil && service.Spec.Mode.Replicated.Replicas != nil { //TODO Check if this is a valid way of getting the memory limits. Should probably be a pointer. - memLimit := int(service.Spec.TaskTemplate.Resources.Limits.MemoryBytes) + memLimit := 0 + if service.Spec.TaskTemplate.Resources.Limits != nil { + memLimit = int(service.Spec.TaskTemplate.Resources.Limits.MemoryBytes) + } replicaState[service.ID] = pcmodel.ServiceState{ ID: service.ID, Name: service.Spec.Name,