code: func writeCSRFilesIfNotExist(csrDir string, baseName string, csr *x509.CertificateRequest, key crypto.Signer) error {
  	if pkiutil.CSROrKeyExist(csrDir, baseName) {
  		_, _, err := pkiutil.TryLoadCSRAndKeyFromDisk(csrDir, baseName)
  		if err != nil {
  			return errors.Wrapf(err, "%s CSR existed but it could not be loaded properly", baseName)
  		}
  
  		fmt.Printf("[certs] Using the existing %q CSR\n", baseName)
  	} else {
  		// Write .key and .csr files to disk
  		fmt.Printf("[certs] Generating %q key and CSR\n", baseName)
  
  		if err := pkiutil.WriteKey(csrDir, baseName, key); err != nil {
  			return errors.Wrapf(err, "failure while saving %s key", baseName)
  		}
  
  		if err := pkiutil.WriteCSR(csrDir, baseName, csr); err != nil {
  			return errors.Wrapf(err, "failure while saving %s CSR", baseName)
  		}
  	}
  
  	return nil
  }
docs: // writeCSRFilesIfNotExist writes a new CSR to the given path.
  // If there already is a CSR file at the given path; kubeadm tries to load it and check if it's a valid certificate.
  // otherwise this function returns an error.