From 235470d006557ee91cee4dee10b7e9e257bd5b63 Mon Sep 17 00:00:00 2001 From: Justin Tamblyn Date: Tue, 30 Apr 2019 10:44:11 +0200 Subject: [PATCH] Upgraded network creation to support an array --- controller/pc-docker/service.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/controller/pc-docker/service.go b/controller/pc-docker/service.go index 2a827d6..2706af8 100644 --- a/controller/pc-docker/service.go +++ b/controller/pc-docker/service.go @@ -24,15 +24,16 @@ func CreateService(service *model.Service) (err error) { replicas := uint64(service.Replicas) - networkName := service.Network - if networkName != "" { - err = createNetwork(networkName) - } else { - networkName = DefaultNetwork - err = createNetwork(networkName) - } - if err != nil { - log.Printf("Error occurred while creating the network %s: %s", networkName, err) + for _, networkName := range service.Networks { + if networkName != "" { + err = createNetwork(networkName) + } else { + networkName = DefaultNetwork + err = createNetwork(networkName) + } + if err != nil { + log.Printf("Error occurred while creating the network %s: %s", networkName, err) + } } var nets []swarm.NetworkAttachmentConfig