func (rm *Manager) CreateRenewCSR(name, outdir string) error {
	handler, ok := rm.certificates[name]
	if !ok {
		return errors.Errorf("%s is not a known certificate", name)
	}

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

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

	// generates the CSR request and save it
	csr, key, err := pkiutil.NewCSRAndKey(cfg)
	if err != nil {
		return errors.Wrapf(err, "failure while generating %s CSR and key", name)
	}
	if err := pkiutil.WriteKey(outdir, name, key); err != nil {
		return errors.Wrapf(err, "failure while saving %s key", name)
	}

	if err := pkiutil.WriteCSR(outdir, name, csr); err != nil {
		return errors.Wrapf(err, "failure while saving %s CSR", name)
	}

	return nil
}
// CreateRenewCSR generates CSR request for certificate renewal.
// 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.
CreateRenewCSR generates CSR request for certificate renewal.
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.
// CreateRenewCSR generates CSR request for certificate renewal . // 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) CreateRenewCSR(name, outdir string) error {
	handler, ok := rm.certificates[name]
	if !ok {
		return errors.Errorf("%s is not a known certificate", name)
	}
	cert, err := handler.readwriter.Read()
	if err != nil {
		return err
	}
	cfg := &pkiutil.CertConfig{
		Config:             certToConfig(cert),
		PublicKeyAlgorithm: rm.cfg.PublicKeyAlgorithm(),
	}
	csr, key, err := pkiutil.NewCSRAndKey(cfg)
	if err != nil {
		return errors.Wrapf(err, "failure while generating %s CSR and key", name)
	}
	if err := pkiutil.WriteKey(outdir, name, key); err != nil {
		return errors.Wrapf(err, "failure while saving %s key", name)
	}
	if err := pkiutil.WriteCSR(outdir, name, csr); err != nil {
		return errors.Wrapf(err, "failure while saving %s CSR", name)
	}
	return nil
}
func ( rm * Manager ) CreateRenewCSR ( name , outdir string ) error { handler , ok := rm . certificates [ name ] if ! ok { return errors . Errorf ( " " , name ) } cert , err := handler . readwriter . Read ( ) if err != nil { return err } cfg := & pkiutil . CertConfig { Config : certToConfig ( cert ) , PublicKeyAlgorithm : rm . cfg . PublicKeyAlgorithm ( ) , } csr , key , err := pkiutil . NewCSRAndKey ( cfg ) if err != nil { return errors . Wrapf ( err , " " , name ) } if err := pkiutil . WriteKey ( outdir , name , key ) ; err != nil { return errors . Wrapf ( err , " " , name ) } if err := pkiutil . WriteCSR ( outdir , name , csr ) ; err != nil { return errors . Wrapf ( err , " " , name ) } return nil }
CreateRenewCSR generates CSR request for certificate renewal.
CreateRenewCSR generates CSR request for certificate renewal .
// reads the current certificate // extracts the certificate config // generates the CSR request and save it