mirror of
https://github.com/rancher/rke.git
synced 2025-09-03 16:04:26 +00:00
Print original error regarding kubeconfig
This commit is contained in:
committed by
Alena Prokharchyk
parent
6f7f25cbcb
commit
c3e9492716
@@ -252,7 +252,7 @@ func rebuildLocalAdminConfig(ctx context.Context, kubeCluster *Cluster) error {
|
|||||||
newConfig = pki.GetKubeConfigX509WithData(kubeURL, kubeCluster.ClusterName, pki.KubeAdminCertName, caData, crtData, keyData)
|
newConfig = pki.GetKubeConfigX509WithData(kubeURL, kubeCluster.ClusterName, pki.KubeAdminCertName, caData, crtData, keyData)
|
||||||
}
|
}
|
||||||
if err := pki.DeployAdminConfig(ctx, newConfig, kubeCluster.LocalKubeConfigPath); err != nil {
|
if err := pki.DeployAdminConfig(ctx, newConfig, kubeCluster.LocalKubeConfigPath); err != nil {
|
||||||
return fmt.Errorf("Failed to redeploy local admin config with new host")
|
return fmt.Errorf("Failed to redeploy local admin config with new host: %v", err)
|
||||||
}
|
}
|
||||||
workingConfig = newConfig
|
workingConfig = newConfig
|
||||||
if _, err := GetK8sVersion(kubeCluster.LocalKubeConfigPath, kubeCluster.K8sWrapTransport); err == nil {
|
if _, err := GetK8sVersion(kubeCluster.LocalKubeConfigPath, kubeCluster.K8sWrapTransport); err == nil {
|
||||||
@@ -267,7 +267,7 @@ func rebuildLocalAdminConfig(ctx context.Context, kubeCluster *Cluster) error {
|
|||||||
|
|
||||||
func isLocalConfigWorking(ctx context.Context, localKubeConfigPath string, k8sWrapTransport transport.WrapperFunc) bool {
|
func isLocalConfigWorking(ctx context.Context, localKubeConfigPath string, k8sWrapTransport transport.WrapperFunc) bool {
|
||||||
if _, err := GetK8sVersion(localKubeConfigPath, k8sWrapTransport); err != nil {
|
if _, err := GetK8sVersion(localKubeConfigPath, k8sWrapTransport); err != nil {
|
||||||
log.Infof(ctx, "[reconcile] Local config is not valid, rebuilding admin config")
|
log.Infof(ctx, "[reconcile] Local config is not valid (error: %v), rebuilding admin config", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
Reference in New Issue
Block a user