code: func ValidateKubeconfigsForExternalCA(outDir string, cfg *kubeadmapi.InitConfiguration) error {
  	kubeConfigFileNames := []string{
  		kubeadmconstants.AdminKubeConfigFileName,
  		kubeadmconstants.KubeletKubeConfigFileName,
  		kubeadmconstants.ControllerManagerKubeConfigFileName,
  		kubeadmconstants.SchedulerKubeConfigFileName,
  	}
  
  	// Creates a kubeconfig file with the target CA and server URL
  	// to be used as a input for validating user provided kubeconfig files
  	caCert, err := pkiutil.TryLoadCertFromDisk(cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName)
  	if err != nil {
  		return errors.Wrapf(err, "the CA file couldn't be loaded")
  	}
  
  	controlPlaneEndpoint, err := kubeadmutil.GetControlPlaneEndpoint(cfg.ControlPlaneEndpoint, &cfg.LocalAPIEndpoint)
  	if err != nil {
  		return err
  	}
  
  	validationConfig := kubeconfigutil.CreateBasic(controlPlaneEndpoint, "dummy", "dummy", pkiutil.EncodeCertPEM(caCert))
  
  	// validate user provided kubeconfig files
  	for _, kubeConfigFileName := range kubeConfigFileNames {
  		if err = validateKubeConfig(outDir, kubeConfigFileName, validationConfig); err != nil {
  			return errors.Wrapf(err, "the %s file does not exists or it is not valid", kubeConfigFileName)
  		}
  	}
  	return nil
  }
docs: // ValidateKubeconfigsForExternalCA check if the kubeconfig file exist and has the expected CA and server URL using kubeadmapi.InitConfiguration.