func WaitTimeoutForVCNotFoundInNamespace(c vcclient.Interface, vcName, namespace string, timeout time.Duration) error {
	return wait.PollImmediate(poll, timeout, vcNotFound(c, vcName, namespace))
}
WaitTimeoutForVCRunningInNamespace waits the given timeout duration for the specified vc to become running.
package virtualcluster
import (
	"fmt"
	"time"
	apierrs "k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/util/wait"
	"sigs.k8s.io/cluster-api-provider-nested/virtualcluster/pkg/apis/tenancy/v1alpha1"
	vcclient "sigs.k8s.io/cluster-api-provider-nested/virtualcluster/pkg/client/clientset/versioned"
)
const (
	vcStartTimeout = 10 * time.Minute
	vcDeletionTimeout = 5 * time.Minute
	poll = 2 * time.Second
)
func WaitForVCRunningInNamespace(c vcclient.Interface, vcName, namespace string) error {
	return WaitTimeoutForVCRunningInNamespace(c, vcName, namespace, vcStartTimeout)
}
func WaitTimeoutForVCRunningInNamespace(c vcclient.Interface, vcName, namespace string, timeout time.Duration) error {
	return wait.PollImmediate(poll, timeout, vcRunning(c, vcName, namespace))
}
func vcRunning(c vcclient.Interface, vcName, namespace string) wait.ConditionFunc {
	return func() (bool, error) {
		pod, err := c.TenancyV1alpha1().VirtualClusters(namespace).Get(vcName, metav1.GetOptions{})
		if err != nil {
			return false, err
		}
		switch pod.Status.Phase {
		case v1alpha1.ClusterRunning:
			return true, nil
		case v1alpha1.ClusterError:
			return false, fmt.Errorf("vc ran to error")
		}
		return false, nil
	}
}
func WaitForVCNotFoundInNamespace(c vcclient.Interface, vcName, namespace string) error {
	return WaitTimeoutForVCNotFoundInNamespace(c, vcName, namespace, vcDeletionTimeout)
}