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

Deploy kube config file locally for admin

This commit is contained in:
galal-hussein
2017-11-01 23:46:43 +02:00
parent 03a7ef7c4b
commit 1bb4ab98c3
5 changed files with 67 additions and 0 deletions

View File

@@ -5,6 +5,8 @@ import (
"crypto/rsa"
"crypto/x509"
"fmt"
"io/ioutil"
"os"
"time"
"github.com/Sirupsen/logrus"
@@ -127,3 +129,14 @@ func doRunDeployer(host *hosts.Host, containerEnv []string) error {
return nil
}
}
func deployAdminConfig(kubeConfig string, forceDeploy bool) error {
logrus.Debugf("Deploying admin Kubeconfig locally: %s", kubeConfig)
if _, err := os.Stat(KubeAdminConfigPath); os.IsNotExist(err) || forceDeploy {
err := ioutil.WriteFile(KubeAdminConfigPath, []byte(kubeConfig), 0644)
if err != nil {
return fmt.Errorf("Failed to create local admin kubeconfig file: %v", err)
}
}
return nil
}