2017-11-06 20:50:41 +00:00
|
|
|
package cluster
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2017-11-13 21:28:38 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2017-11-06 20:50:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
ClusterCIDREnvName = "RKE_CLUSTER_CIDR"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (c *Cluster) DeployNetworkPlugin() error {
|
2017-11-14 18:11:21 +00:00
|
|
|
logrus.Infof("[network] Setting up network plugin: %s", c.Network.Plugin)
|
2017-11-08 17:45:51 +00:00
|
|
|
|
|
|
|
kubectlCmd := &KubectlCommand{
|
2017-11-14 18:11:21 +00:00
|
|
|
Cmd: []string{"apply -f /network/" + c.Network.Plugin + ".yaml"},
|
2017-11-06 20:50:41 +00:00
|
|
|
}
|
|
|
|
logrus.Infof("[network] Executing the deploy command..")
|
2017-11-08 17:45:51 +00:00
|
|
|
err := c.RunKubectlCmd(kubectlCmd)
|
2017-11-06 20:50:41 +00:00
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("Failed to run kubectl command: %v", err)
|
|
|
|
}
|
|
|
|
logrus.Infof("[network] Network plugin deployed successfully..")
|
|
|
|
return nil
|
|
|
|
}
|