1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-29 11:43:07 +00:00

Sprintf consistency when handling API URL

This commit is contained in:
Rowan James 2019-09-25 11:57:52 +10:00 committed by Alena Prokharchyk
parent 9873b5f57a
commit 3ac2ef216d

View File

@ -120,7 +120,7 @@ func ClusterUp(ctx context.Context, dialersOptions hosts.DialersOptions, flags c
return APIURL, caCrt, clientCert, clientKey, nil, err return APIURL, caCrt, clientCert, clientKey, nil, err
} }
if len(kubeCluster.ControlPlaneHosts) > 0 { if len(kubeCluster.ControlPlaneHosts) > 0 {
APIURL = fmt.Sprintf("https://%v:%v", kubeCluster.ControlPlaneHosts[0].Address, "6443") APIURL = fmt.Sprintf("https://%s:6443", kubeCluster.ControlPlaneHosts[0].Address)
} }
clientCert = string(cert.EncodeCertPEM(kubeCluster.Certificates[pki.KubeAdminCertName].Certificate)) clientCert = string(cert.EncodeCertPEM(kubeCluster.Certificates[pki.KubeAdminCertName].Certificate))
clientKey = string(cert.EncodePrivateKeyPEM(kubeCluster.Certificates[pki.KubeAdminCertName].Key)) clientKey = string(cert.EncodePrivateKeyPEM(kubeCluster.Certificates[pki.KubeAdminCertName].Key))
@ -138,7 +138,7 @@ func ClusterUp(ctx context.Context, dialersOptions hosts.DialersOptions, flags c
} }
// update APIURL after reconcile // update APIURL after reconcile
if len(kubeCluster.ControlPlaneHosts) > 0 { if len(kubeCluster.ControlPlaneHosts) > 0 {
APIURL = fmt.Sprintf("https://%v:%v", kubeCluster.ControlPlaneHosts[0].Address, "6443") APIURL = fmt.Sprintf("https://%s:6443", kubeCluster.ControlPlaneHosts[0].Address)
} }
if err := kubeCluster.PrePullK8sImages(ctx); err != nil { if err := kubeCluster.PrePullK8sImages(ctx); err != nil {