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 (
|
2017-11-08 00:32:55 +00:00
|
|
|
ClusterDNSServerIPEnvName = "RKE_DNS_SERVER"
|
2017-11-06 20:50:41 +00:00
|
|
|
ClusterDomainEnvName = "RKE_CLUSTER_DOMAIN"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (c *Cluster) DeployK8sAddOns() error {
|
2017-11-08 00:32:55 +00:00
|
|
|
err := c.deployKubeDNS()
|
|
|
|
return err
|
2017-11-06 20:50:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Cluster) deployKubeDNS() error {
|
|
|
|
logrus.Infof("[plugins] Setting up KubeDNS")
|
|
|
|
|
2017-11-08 17:45:51 +00:00
|
|
|
kubectlCmd := &KubectlCommand{
|
|
|
|
Cmd: []string{"apply -f /addons/kubedns*.yaml"},
|
2017-11-06 20:50:41 +00:00
|
|
|
}
|
|
|
|
logrus.Infof("[plugins] 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("[plugins] kubeDNS deployed successfully..")
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|