1
0
mirror of https://github.com/rancher/rke.git synced 2025-07-03 18:47:58 +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,7 +180,6 @@ func fetchAndUpdateStateFromLegacyCluster(ctx context.Context, kubeCluster *clus
recoveredCluster = cluster.GetStateFromNodes(ctx, kubeCluster) recoveredCluster = cluster.GetStateFromNodes(ctx, kubeCluster)
} }
// if we found a recovered cluster, we will need override the current state // 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 { if err != nil {
log.Warnf(ctx, "Failed to fetch certs from kubernetes: %v", err) log.Warnf(ctx, "Failed to fetch certs from kubernetes: %v", err)
@ -190,13 +189,14 @@ func fetchAndUpdateStateFromLegacyCluster(ctx context.Context, kubeCluster *clus
return err return err
} }
} }
fullState.CurrentState.RancherKubernetesEngineConfig = kubeCluster.RancherKubernetesEngineConfig.DeepCopy()
if recoveredCluster != nil {
fullState.CurrentState.RancherKubernetesEngineConfig = recoveredCluster.RancherKubernetesEngineConfig.DeepCopy() fullState.CurrentState.RancherKubernetesEngineConfig = recoveredCluster.RancherKubernetesEngineConfig.DeepCopy()
}
fullState.CurrentState.CertificatesBundle = recoveredCerts fullState.CurrentState.CertificatesBundle = recoveredCerts
// we don't want to regenerate certificates // we don't want to regenerate certificates
fullState.DesiredState.CertificatesBundle = recoveredCerts fullState.DesiredState.CertificatesBundle = recoveredCerts
return fullState.WriteStateFile(ctx, kubeCluster.StateFilePath) return fullState.WriteStateFile(ctx, kubeCluster.StateFilePath)
} }
return nil
}