Address panic in cert rotation code
@@ -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
}
+ 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))
