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:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user