mirror of
https://github.com/rancher/rke.git
synced 2025-08-31 14:36:32 +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 (
|
||||
@@ -20,17 +18,12 @@ func (c *Cluster) DeployK8sAddOns() error {
|
||||
|
||||
func (c *Cluster) deployKubeDNS() error {
|
||||
logrus.Infof("[plugins] Setting up KubeDNS")
|
||||
deployerHost := c.ControlPlaneHosts[0]
|
||||
kubectlCmd := []string{"apply -f /addons/kubedns*.yaml"}
|
||||
|
||||
env := []string{
|
||||
fmt.Sprintf("%s=%s", pki.KubeAdminConfigENVName, c.Certificates[pki.KubeAdminCommonName].Config),
|
||||
fmt.Sprintf("%s=%s", ClusterDNSServerIPEnvName, c.ClusterDNSServer),
|
||||
fmt.Sprintf("%s=%s", ClusterDomainEnvName, c.ClusterDomain),
|
||||
kubectlCmd := &KubectlCommand{
|
||||
Cmd: []string{"apply -f /addons/kubedns*.yaml"},
|
||||
}
|
||||
|
||||
logrus.Infof("[plugins] 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