From 95ba4ea61f709b10aa3a5ba29e5d0df68e1d9c97 Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Thu, 20 Sep 2018 18:55:20 +0200 Subject: [PATCH] Fix cluster state network port check issue --- cluster/network.go | 18 +++--------------- cluster/state.go | 1 + 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/cluster/network.go b/cluster/network.go index 87f4d22b..01b0e5a1 100644 --- a/cluster/network.go +++ b/cluster/network.go @@ -262,30 +262,18 @@ func (c *Cluster) checkKubeAPIPort(ctx context.Context) error { func (c *Cluster) deployTCPPortListeners(ctx context.Context, currentCluster *Cluster) error { log.Infof(ctx, "[network] Deploying port listener containers") - etcdHosts := []*hosts.Host{} - cpHosts := []*hosts.Host{} - workerHosts := []*hosts.Host{} - if currentCluster != nil { - etcdHosts = hosts.GetToAddHosts(currentCluster.EtcdHosts, c.EtcdHosts) - cpHosts = hosts.GetToAddHosts(currentCluster.ControlPlaneHosts, c.ControlPlaneHosts) - workerHosts = hosts.GetToAddHosts(currentCluster.WorkerHosts, c.WorkerHosts) - } else { - etcdHosts = c.EtcdHosts - cpHosts = c.ControlPlaneHosts - workerHosts = c.WorkerHosts - } // deploy ectd listeners - if err := c.deployListenerOnPlane(ctx, EtcdPortList, etcdHosts, EtcdPortListenContainer); err != nil { + if err := c.deployListenerOnPlane(ctx, EtcdPortList, c.EtcdHosts, EtcdPortListenContainer); err != nil { return err } // deploy controlplane listeners - if err := c.deployListenerOnPlane(ctx, ControlPlanePortList, cpHosts, CPPortListenContainer); err != nil { + if err := c.deployListenerOnPlane(ctx, ControlPlanePortList, c.ControlPlaneHosts, CPPortListenContainer); err != nil { return err } // deploy worker listeners - if err := c.deployListenerOnPlane(ctx, WorkerPortList, workerHosts, WorkerPortListenContainer); err != nil { + if err := c.deployListenerOnPlane(ctx, WorkerPortList, c.WorkerHosts, WorkerPortListenContainer); err != nil { return err } log.Infof(ctx, "[network] Port listener containers deployed successfully") diff --git a/cluster/state.go b/cluster/state.go index 4be174a1..d459570e 100644 --- a/cluster/state.go +++ b/cluster/state.go @@ -216,6 +216,7 @@ func getStateFromNodes(ctx context.Context, uniqueHosts []*hosts.Host, alpineIma logrus.Debugf("[state] Failed to unmarshal the cluster file fetched from nodes: %v", err) return nil } + log.Infof(ctx, "[state] Successfully fetched cluster state from Nodes") return ¤tCluster }