2017-10-31 13:55:35 +00:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/Sirupsen/logrus"
|
2017-11-09 19:50:49 +00:00
|
|
|
"github.com/alena1108/cluster-controller/client/v1"
|
2017-10-31 13:55:35 +00:00
|
|
|
"github.com/rancher/rke/hosts"
|
|
|
|
)
|
|
|
|
|
2017-11-09 19:50:49 +00:00
|
|
|
func RunWorkerPlane(controlHosts []hosts.Host, workerHosts []hosts.Host, workerServices v1.RKEConfigServices) error {
|
2017-10-31 13:55:35 +00:00
|
|
|
logrus.Infof("[%s] Building up Worker Plane..", WorkerRole)
|
|
|
|
for _, host := range controlHosts {
|
|
|
|
// only one master for now
|
|
|
|
err := runKubelet(host, workerServices.Kubelet, true)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
err = runKubeproxy(host, workerServices.Kubeproxy)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, host := range workerHosts {
|
|
|
|
// run kubelet
|
|
|
|
err := runKubelet(host, workerServices.Kubelet, false)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
// run kubeproxy
|
|
|
|
err = runKubeproxy(host, workerServices.Kubeproxy)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logrus.Infof("[%s] Successfully started Worker Plane..", WorkerRole)
|
|
|
|
return nil
|
|
|
|
}
|