1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-12 21:24:00 +00:00

remove kubeconfig as part of cluster remove

This commit is contained in:
moelsayed
2017-11-29 22:33:08 +02:00
parent 6fafe7bddc
commit 63c7d5c5c1
2 changed files with 16 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io/ioutil"
"os"
"time"
"github.com/docker/docker/api/types"
@@ -110,3 +111,12 @@ func DeployAdminConfig(kubeConfig, localConfigPath string) error {
}
return nil
}
func RemoveAdminConfig(localConfigPath string) error {
logrus.Infof("Removing local admin Kubeconfig: %s", localConfigPath)
if err := os.Remove(localConfigPath); err != nil {
return fmt.Errorf("Failed to remove local admin Kubeconfig file: %v", err)
}
logrus.Infof("Local admin Kubeconfig removed successfully")
return nil
}