Merge pull request #107982 from SataQiu/fix-duplicated-altnames

kubeadm: fix the bug that 'kubeadm certs generate-csr' command does not remove duplicated SANs
This commit is contained in:
Kubernetes Prow Robot 2022-02-07 05:25:44 -08:00 committed by GitHub
commit 9f791bbf5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -563,6 +563,8 @@ func CertificateRequestFromFile(file string) (*x509.CertificateRequest, error) {
// NewCSR creates a new CSR
func NewCSR(cfg CertConfig, key crypto.Signer) (*x509.CertificateRequest, error) {
RemoveDuplicateAltNames(&cfg.AltNames)
template := &x509.CertificateRequest{
Subject: pkix.Name{
CommonName: cfg.CommonName,