code: func DiscoverValidatedKubeConfig(cfg *kubeadmapi.JoinConfiguration) (*clientcmdapi.Config, error) {
  	switch {
  	case cfg.Discovery.File != nil:
  		kubeConfigPath := cfg.Discovery.File.KubeConfigPath
  		if isHTTPSURL(kubeConfigPath) {
  			return https.RetrieveValidatedConfigInfo(kubeConfigPath, kubeadmapiv1beta2.DefaultClusterName)
  		}
  		return file.RetrieveValidatedConfigInfo(kubeConfigPath, kubeadmapiv1beta2.DefaultClusterName)
  	case cfg.Discovery.BootstrapToken != nil:
  		return token.RetrieveValidatedConfigInfo(cfg)
  	default:
  		return nil, errors.New("couldn't find a valid discovery configuration")
  	}
  }
docs: // DiscoverValidatedKubeConfig returns a validated Config object that specifies where the cluster is and the CA cert to trust