INNER CODE UNIT · Go
AddToLocal
sunny0826/kubecm · cmd/add.go:105
func AddToLocal(newConfig *clientcmdapi.Config, path, contextPrefix string, cover bool, selectContext bool, contextTemplate []string, context []string, insecureSkipTLSVerify bool) error {
kubeconfig, err := SelectKubeconfigFile("Select The kubeconfig file to add to")
if err != nil {
return err
}
oldConfig, err := clientcmd.LoadFromFile(kubeconfig)
if err != nil {
return err
}
kco := &KubeConfigOption{
config: newConfig,
fileName: getFileName(path),
insecureSkipTLSVerify: insecureSkipTLSVerify,
}
// merge context loop
outConfig, err := kco.handleContexts(oldConfig, contextPrefix, selectContext, contextTemplate, context)
if err != nil {
return err