mirror of
https://github.com/rancher/rke.git
synced 2025-09-19 10:26:20 +00:00
Set cluster config as early as possible
This commit is contained in:
committed by
Alena Prokharchyk
parent
9c85b5b451
commit
8a808c4cc5
17
cmd/up.go
17
cmd/up.go
@@ -90,12 +90,21 @@ func ClusterUp(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return APIURL, caCrt, clientCert, clientKey, nil, err
|
return APIURL, caCrt, clientCert, clientKey, nil, err
|
||||||
}
|
}
|
||||||
|
if len(kubeCluster.ControlPlaneHosts) > 0 {
|
||||||
|
APIURL = fmt.Sprintf("https://" + kubeCluster.ControlPlaneHosts[0].Address + ":6443")
|
||||||
|
}
|
||||||
|
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))
|
||||||
|
|
||||||
err = cluster.ReconcileCluster(ctx, kubeCluster, currentCluster, updateOnly)
|
err = cluster.ReconcileCluster(ctx, kubeCluster, currentCluster, updateOnly)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return APIURL, caCrt, clientCert, clientKey, nil, err
|
return APIURL, caCrt, clientCert, clientKey, nil, err
|
||||||
}
|
}
|
||||||
|
// update APIURL after reconcile
|
||||||
|
if len(kubeCluster.ControlPlaneHosts) > 0 {
|
||||||
|
APIURL = fmt.Sprintf("https://" + kubeCluster.ControlPlaneHosts[0].Address + ":6443")
|
||||||
|
}
|
||||||
err = kubeCluster.SetUpHosts(ctx)
|
err = kubeCluster.SetUpHosts(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return APIURL, caCrt, clientCert, clientKey, nil, err
|
return APIURL, caCrt, clientCert, clientKey, nil, err
|
||||||
@@ -139,12 +148,6 @@ func ClusterUp(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return APIURL, caCrt, clientCert, clientKey, nil, err
|
return APIURL, caCrt, clientCert, clientKey, nil, err
|
||||||
}
|
}
|
||||||
if len(kubeCluster.ControlPlaneHosts) > 0 {
|
|
||||||
APIURL = fmt.Sprintf("https://" + kubeCluster.ControlPlaneHosts[0].Address + ":6443")
|
|
||||||
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))
|
|
||||||
|
|
||||||
if err := checkAllIncluded(kubeCluster); err != nil {
|
if err := checkAllIncluded(kubeCluster); err != nil {
|
||||||
return APIURL, caCrt, clientCert, clientKey, nil, err
|
return APIURL, caCrt, clientCert, clientKey, nil, err
|
||||||
|
Reference in New Issue
Block a user