Commit 8bc0447d authored by Lubomir I. Ivanov's avatar Lubomir I. Ivanov

kubeadm: use client-go's MakeCSRFromTemplate() in 'renew'

Create CSR using the mentioned function which also encodes the type CertificateRequestBlockType. Without that 'certs renew' is failing with: 'PEM block type must be CERTIFICATE REQUEST'
parent 224448b8
...@@ -17,7 +17,6 @@ limitations under the License. ...@@ -17,7 +17,6 @@ limitations under the License.
package renewal package renewal
import ( import (
"crypto/rand"
"crypto/rsa" "crypto/rsa"
"crypto/x509" "crypto/x509"
"crypto/x509/pkix" "crypto/x509/pkix"
...@@ -70,7 +69,7 @@ func (r *CertsAPIRenewal) Renew(cfg *certutil.Config) (*x509.Certificate, *rsa.P ...@@ -70,7 +69,7 @@ func (r *CertsAPIRenewal) Renew(cfg *certutil.Config) (*x509.Certificate, *rsa.P
return nil, nil, errors.Wrap(err, "couldn't create new private key") return nil, nil, errors.Wrap(err, "couldn't create new private key")
} }
csr, err := x509.CreateCertificateRequest(rand.Reader, reqTmp, key) csr, err := certutil.MakeCSRFromTemplate(key, reqTmp)
if err != nil { if err != nil {
return nil, nil, errors.Wrap(err, "couldn't create certificate signing request") return nil, nil, errors.Wrap(err, "couldn't create certificate signing request")
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment