1
0
mirror of https://github.com/rancher/rke.git synced 2025-07-01 01:32:37 +00:00

fix upgrade path for clusters created before 0.1.10

This commit is contained in:
galal-hussein 2019-05-29 23:56:24 +02:00 committed by Alena Prokharchyk
parent 8816a75b93
commit 22f261daf7

View File

@ -180,23 +180,23 @@ func fetchAndUpdateStateFromLegacyCluster(ctx context.Context, kubeCluster *clus
recoveredCluster = cluster.GetStateFromNodes(ctx, kubeCluster)
}
// if we found a recovered cluster, we will need override the current state
if recoveredCluster != nil {
recoveredCerts, err := cluster.GetClusterCertsFromKubernetes(ctx, kubeCluster)
recoveredCerts, err := cluster.GetClusterCertsFromKubernetes(ctx, kubeCluster)
if err != nil {
log.Warnf(ctx, "Failed to fetch certs from kubernetes: %v", err)
// try to fetch certs from nodes
recoveredCerts, err = cluster.GetClusterCertsFromNodes(ctx, kubeCluster)
if err != nil {
log.Warnf(ctx, "Failed to fetch certs from kubernetes: %v", err)
// try to fetch certs from nodes
recoveredCerts, err = cluster.GetClusterCertsFromNodes(ctx, kubeCluster)
if err != nil {
return err
}
return err
}
}
fullState.CurrentState.RancherKubernetesEngineConfig = kubeCluster.RancherKubernetesEngineConfig.DeepCopy()
if recoveredCluster != nil {
fullState.CurrentState.RancherKubernetesEngineConfig = recoveredCluster.RancherKubernetesEngineConfig.DeepCopy()
fullState.CurrentState.CertificatesBundle = recoveredCerts
// we don't want to regenerate certificates
fullState.DesiredState.CertificatesBundle = recoveredCerts
return fullState.WriteStateFile(ctx, kubeCluster.StateFilePath)
}
return nil
fullState.CurrentState.CertificatesBundle = recoveredCerts
// we don't want to regenerate certificates
fullState.DesiredState.CertificatesBundle = recoveredCerts
return fullState.WriteStateFile(ctx, kubeCluster.StateFilePath)
}