1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-01 06:56:29 +00:00

Refactor kubectl

Export pki utlitity functions
This commit is contained in:
moelsayed
2017-11-08 19:45:51 +02:00
parent 7172f6ec46
commit d58fc84de9
5 changed files with 112 additions and 100 deletions

View File

@@ -4,8 +4,6 @@ import (
"fmt"
"github.com/Sirupsen/logrus"
"github.com/rancher/rke/k8s"
"github.com/rancher/rke/pki"
)
const (
@@ -14,14 +12,12 @@ const (
func (c *Cluster) DeployNetworkPlugin() error {
logrus.Infof("[network] Setting up network plugin: %s", c.NetworkPlugin)
deployerHost := c.ControlPlaneHosts[0]
kubectlCmd := []string{"apply -f /network/" + c.NetworkPlugin + ".yaml"}
env := []string{
fmt.Sprintf("%s=%s", pki.KubeAdminConfigENVName, c.Certificates[pki.KubeAdminCommonName].Config),
fmt.Sprintf("%s=%s", ClusterCIDREnvName, c.ClusterCIDR),
kubectlCmd := &KubectlCommand{
Cmd: []string{"apply -f /network/" + c.NetworkPlugin + ".yaml"},
}
logrus.Infof("[network] Executing the deploy command..")
err := k8s.RunKubectlCmd(deployerHost.DClient, deployerHost.Hostname, kubectlCmd, env)
err := c.RunKubectlCmd(kubectlCmd)
if err != nil {
return fmt.Errorf("Failed to run kubectl command: %v", err)
}