1
0
mirror of https://github.com/rancher/rke.git synced 2025-04-27 19:25:44 +00:00

Address panic in cert rotation code

This commit is contained in:
Alena Prokharchyk 2019-12-04 11:22:23 -08:00
parent 2bc68c7118
commit 34c63f5e45

View File

@ -152,7 +152,9 @@ func rebuildClusterWithRotatedCertificates(ctx context.Context,
if err := cluster.SetUpAuthentication(ctx, kubeCluster, nil, clusterState); err != nil {
return APIURL, caCrt, clientCert, clientKey, nil, err
}
APIURL = fmt.Sprintf("https://%s:6443", kubeCluster.ControlPlaneHosts[0].Address)
if len(kubeCluster.ControlPlaneHosts) > 0 {
APIURL = fmt.Sprintf("https://%s:6443", kubeCluster.ControlPlaneHosts[0].Address)
}
clientCert = string(cert.EncodeCertPEM(kubeCluster.Certificates[pki.KubeAdminCertName].Certificate))
clientKey = string(cert.EncodePrivateKeyPEM(kubeCluster.Certificates[pki.KubeAdminCertName].Key))
caCrt = string(cert.EncodeCertPEM(kubeCluster.Certificates[pki.CACertName].Certificate))