mirror of
https://github.com/rancher/rke.git
synced 2025-09-16 15:10:12 +00:00
Add generic generation for pki objects and etcd TLS
This commit is contained in:
@@ -72,22 +72,18 @@ func (c *Cluster) InvertIndexHosts() error {
|
||||
func (c *Cluster) SetUpHosts(ctx context.Context) error {
|
||||
if c.Authentication.Strategy == X509AuthenticationProvider {
|
||||
log.Infof(ctx, "[certificates] Deploying kubernetes certificates to Cluster nodes")
|
||||
err := pki.DeployCertificatesOnMasters(ctx, c.ControlPlaneHosts, c.Certificates, c.SystemImages[CertDownloaderImage])
|
||||
if err != nil {
|
||||
if err := pki.DeployCertificatesOnMasters(ctx, c.ControlPlaneHosts, c.Certificates, c.SystemImages[CertDownloaderImage]); err != nil {
|
||||
return err
|
||||
}
|
||||
err = pki.DeployCertificatesOnWorkers(ctx, c.WorkerHosts, c.Certificates, c.SystemImages[CertDownloaderImage])
|
||||
if err != nil {
|
||||
if err := pki.DeployCertificatesOnWorkers(ctx, c.WorkerHosts, c.Certificates, c.SystemImages[CertDownloaderImage]); err != nil {
|
||||
return err
|
||||
}
|
||||
// Deploying worker certs on etcd hosts as well
|
||||
err = pki.DeployCertificatesOnWorkers(ctx, c.EtcdHosts, c.Certificates, c.SystemImages[CertDownloaderImage])
|
||||
if err != nil {
|
||||
// Deploying etcd certificates
|
||||
if err := pki.DeployCertificatesOnEtcd(ctx, c.EtcdHosts, c.Certificates, c.SystemImages[CertDownloaderImage]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = pki.DeployAdminConfig(ctx, c.Certificates[pki.KubeAdminCommonName].Config, c.LocalKubeConfigPath)
|
||||
if err != nil {
|
||||
if err := pki.DeployAdminConfig(ctx, c.Certificates[pki.KubeAdminCertName].Config, c.LocalKubeConfigPath); err != nil {
|
||||
return err
|
||||
}
|
||||
log.Infof(ctx, "[certificates] Successfully deployed kubernetes certificates to Cluster nodes")
|
||||
|
Reference in New Issue
Block a user