func (rm *Manager) RenewUsingLocalCA(name string) (bool, error) {
	handler, ok := rm.certificates[name]
	if !ok {
		return false, errors.Errorf("%s is not a valid certificate for this cluster", name)
	}

	// checks if the certificate is externally managed (CA certificate provided without the certificate key)
	externallyManaged, err := rm.IsExternallyManaged(handler.CABaseName)
	if err != nil {
		return false, err
	}

	// in case of external CA it is not possible to renew certificates, then return early
	if externallyManaged {
		return false, nil
	}

	// reads the current certificate
	cert, err := handler.readwriter.Read()
	if err != nil {
		return false, err
	}

	// extract the certificate config
	cfg := &pkiutil.CertConfig{
		Config:             certToConfig(cert),
		PublicKeyAlgorithm: rm.cfg.PublicKeyAlgorithm(),
	}

	// reads the CA
	caCert, caKey, err := certsphase.LoadCertificateAuthority(rm.cfg.CertificatesDir, handler.CABaseName)
	if err != nil {
		return false, err
	}

	// create a new certificate with the same config
	newCert, newKey, err := NewFileRenewer(caCert, caKey).Renew(cfg)
	if err != nil {
		return false, errors.Wrapf(err, "failed to renew certificate %s", name)
	}

	// writes the new certificate to disk
	err = handler.readwriter.Write(newCert, newKey)
	if err != nil {
		return false, err
	}

	return true, nil
}
// RenewUsingLocalCA executes certificate renewal using local certificate authorities for generating new certs.
// For PKI certificates, use the name defined in the certsphase package, while for certificates
// embedded in the kubeConfig files, use the kubeConfig file name defined in the kubeadm constants package.
// If you use the CertificateRenewHandler returned by Certificates func, handler.Name already contains the right value.
RenewUsingLocalCA executes certificate renewal using local certificate authorities for generating new certs.
For PKI certificates, use the name defined in the certsphase package, while for certificates
embedded in the kubeConfig files, use the kubeConfig file name defined in the kubeadm constants package.
If you use the CertificateRenewHandler returned by Certificates func, handler.Name already contains the right value.
// RenewUsingLocalCA executes certificate renewal using local certificate authorities for generating new certs . // For PKI certificates use the name defined in the certsphase package while for certificates // embedded in the kubeConfig files use the kubeConfig file name defined in the kubeadm constants package . // If you use the CertificateRenewHandler returned by Certificates func handler . Name already contains the right value .
func (rm *Manager) RenewUsingLocalCA(name string) (bool, error) {
	handler, ok := rm.certificates[name]
	if !ok {
		return false, errors.Errorf("%s is not a valid certificate for this cluster", name)
	}
	externallyManaged, err := rm.IsExternallyManaged(handler.CABaseName)
	if err != nil {
		return false, err
	}
	if externallyManaged {
		return false, nil
	}
	cert, err := handler.readwriter.Read()
	if err != nil {
		return false, err
	}
	cfg := &pkiutil.CertConfig{
		Config:             certToConfig(cert),
		PublicKeyAlgorithm: rm.cfg.PublicKeyAlgorithm(),
	}
	caCert, caKey, err := certsphase.LoadCertificateAuthority(rm.cfg.CertificatesDir, handler.CABaseName)
	if err != nil {
		return false, err
	}
	newCert, newKey, err := NewFileRenewer(caCert, caKey).Renew(cfg)
	if err != nil {
		return false, errors.Wrapf(err, "failed to renew certificate %s", name)
	}
	err = handler.readwriter.Write(newCert, newKey)
	if err != nil {
		return false, err
	}
	return true, nil
}
func ( rm * Manager ) RenewUsingLocalCA ( name string ) ( bool , error ) { handler , ok := rm . certificates [ name ] if ! ok { return false , errors . Errorf ( " " , name ) } externallyManaged , err := rm . IsExternallyManaged ( handler . CABaseName ) if err != nil { return false , err } if externallyManaged { return false , nil } cert , err := handler . readwriter . Read ( ) if err != nil { return false , err } cfg := & pkiutil . CertConfig { Config : certToConfig ( cert ) , PublicKeyAlgorithm : rm . cfg . PublicKeyAlgorithm ( ) , } caCert , caKey , err := certsphase . LoadCertificateAuthority ( rm . cfg . CertificatesDir , handler . CABaseName ) if err != nil { return false , err } newCert , newKey , err := NewFileRenewer ( caCert , caKey ) . Renew ( cfg ) if err != nil { return false , errors . Wrapf ( err , " " , name ) } err = handler . readwriter . Write ( newCert , newKey ) if err != nil { return false , err } return true , nil }
RenewUsingLocalCA executes certificate renewal using local certificate authorities for generating new certs.
RenewUsingLocalCA executes certificate renewal using local certificate authorities for generating new certs .
// checks if the certificate is externally managed (CA certificate provided without the certificate key) // in case of external CA it is not possible to renew certificates, then return early // reads the current certificate // extract the certificate config // reads the CA // create a new certificate with the same config // writes the new certificate to disk