mirror of
https://github.com/rancher/rke.git
synced 2025-08-23 00:56:13 +00:00
security: don't pass arbitrary configuration data to format string
This could just use concatenation, but consistency is key.
This commit is contained in:
parent
1cb850d7cf
commit
9873b5f57a
@ -155,7 +155,7 @@ func rebuildClusterWithRotatedCertificates(ctx context.Context,
|
|||||||
if err := cluster.SetUpAuthentication(ctx, kubeCluster, nil, clusterState); err != nil {
|
if err := cluster.SetUpAuthentication(ctx, kubeCluster, nil, clusterState); err != nil {
|
||||||
return APIURL, caCrt, clientCert, clientKey, nil, err
|
return APIURL, caCrt, clientCert, clientKey, nil, err
|
||||||
}
|
}
|
||||||
APIURL = fmt.Sprintf("https://" + 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))
|
||||||
caCrt = string(cert.EncodeCertPEM(kubeCluster.Certificates[pki.CACertName].Certificate))
|
caCrt = string(cert.EncodeCertPEM(kubeCluster.Certificates[pki.CACertName].Certificate))
|
||||||
|
@ -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://" + kubeCluster.ControlPlaneHosts[0].Address + ":6443")
|
APIURL = fmt.Sprintf("https://%v:%v", kubeCluster.ControlPlaneHosts[0].Address, "6443")
|
||||||
}
|
}
|
||||||
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://" + kubeCluster.ControlPlaneHosts[0].Address + ":6443")
|
APIURL = fmt.Sprintf("https://%v:%v", kubeCluster.ControlPlaneHosts[0].Address, "6443")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := kubeCluster.PrePullK8sImages(ctx); err != nil {
|
if err := kubeCluster.PrePullK8sImages(ctx); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user