1
0
mirror of https://github.com/rancher/rke.git synced 2025-07-16 00:15:51 +00:00

Fix cluster state network port check issue

This commit is contained in:
galal-hussein 2018-09-20 18:55:20 +02:00 committed by Alena Prokharchyk
parent 8e3bf48a94
commit 95ba4ea61f
2 changed files with 4 additions and 15 deletions

View File

@ -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")

View File

@ -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 &currentCluster
}