Documentation ¶
Index ¶
- Constants
- func AddAnnotationToPersistentVolume(ctx context.Context, client TestClient, namespace string, ...) (*corev1.PersistentVolume, error)
- func AddAnnotationToPod(ctx context.Context, client TestClient, namespace, podName string, ...) (*corev1.Pod, error)
- func AddLabelToCRD(ctx context.Context, crd, label string) error
- func AddLabelToPod(ctx context.Context, podName, namespace, label string) error
- func AddLabelToPv(ctx context.Context, pv, label string) error
- func AddLabelToPvc(ctx context.Context, pvc, namespace, label string) error
- func CRDCountShouldBe(ctx context.Context, name string, count int) error
- func CRDShouldExist(ctx context.Context, name string) error
- func CRDShouldNotExist(ctx context.Context, name string) error
- func CleanupClusterRole(ctx context.Context, client TestClient, nsBaseName string) error
- func CleanupClusterRoleBinding(ctx context.Context, client TestClient, nsBaseName string) error
- func CleanupNamespaces(ctx context.Context, client TestClient, nsBaseName string) error
- func CleanupNamespacesWithPoll(ctx context.Context, client TestClient, nsBaseName string) error
- func CreateConfigMap(c clientset.Interface, ns, name string, data map[string]string) (*v1.ConfigMap, error)
- func CreateDeployment(c clientset.Interface, ns string, deployment *apps.Deployment) (*apps.Deployment, error)
- func CreateFileToPod(ctx context.Context, namespace, podName, volume, filename, content string) error
- func CreateNamespace(ctx context.Context, client TestClient, namespace string) error
- func CreateNamespaceWithAnnotation(ctx context.Context, client TestClient, namespace string, ...) error
- func CreateNamespaceWithLabel(ctx context.Context, client TestClient, namespace string, ...) error
- func CreatePVC(client TestClient, ns, name, sc string) (*corev1.PersistentVolumeClaim, error)
- func CreatePersistentVolume(client TestClient, name string) (*corev1.PersistentVolume, error)
- func CreatePod(client TestClient, ns, name string, volumes []corev1.Volume) (*corev1.Pod, error)
- func CreatePodWithPVC(client TestClient, ns, podName, sc string, volumeNameList []string) (*corev1.Pod, error)
- func CreateRBACWithBindingSA(ctx context.Context, client TestClient, namespace string, ...) error
- func CreateSecret(c clientset.Interface, ns, name string, labels map[string]string) (*v1.Secret, error)
- func CreateSecretFromFiles(ctx context.Context, client TestClient, namespace string, name string, ...) error
- func CreateServiceAccount(ctx context.Context, client TestClient, namespace string, ...) error
- func CreateVCCredentialSecret(c clientset.Interface, veleroNamespace string) error
- func DeleteNamespace(ctx context.Context, client TestClient, namespace string, wait bool) error
- func DeleteVeleroDs(ctx context.Context) error
- func EnsureClusterExists(ctx context.Context) error
- func GetAPIVersions(client *TestClient, name string) ([]string, error)
- func GetCRD(ctx context.Context, name string) ([]string, error)
- func GetClusterRole(ctx context.Context, client TestClient, role string) (*v1.ClusterRole, error)
- func GetClusterRoleBinding(ctx context.Context, client TestClient, rolebinding string) (*v1.ClusterRoleBinding, error)
- func GetConfigmap(c clientset.Interface, ns, secretName string) (*v1.ConfigMap, error)
- func GetDeployment(c clientset.Interface, ns, name string) (*apps.Deployment, error)
- func GetNamespace(ctx context.Context, client TestClient, namespace string) (*corev1api.Namespace, error)
- func GetPVByPodName(client TestClient, namespace, podName string) (string, error)
- func GetPVC(ctx context.Context, client TestClient, namespace string, ...) (*corev1.PersistentVolume, error)
- func GetPersistentVolume(ctx context.Context, client TestClient, namespace string, ...) (*corev1.PersistentVolume, error)
- func GetPod(ctx context.Context, client TestClient, namespace string, pod string) (*corev1.Pod, error)
- func GetPvByPvc(ctx context.Context, namespace, pvc string) ([]string, error)
- func GetPvcByPodName(ctx context.Context, namespace, podName string) ([]string, error)
- func GetSecret(c clientset.Interface, ns, secretName string) (*v1.Secret, error)
- func GetServiceAccount(ctx context.Context, client TestClient, namespace string, ...) (*corev1.ServiceAccount, error)
- func KubectlApplyByFile(ctx context.Context, file string) error
- func KubectlConfigUseContext(ctx context.Context, kubectlContext string) error
- func KubectlGetDsJson(veleroNamespace string) (string, error)
- func KubectlGetInfo(cmdName string, arg []string)
- func NamespaceShouldNotExist(ctx context.Context, client TestClient, namespace string) error
- func NewDeployment(name, ns string, replicas int32, labels map[string]string) *apps.Deployment
- func PatchServiceAccountWithImagePullSecret(ctx context.Context, client TestClient, ...) error
- func ReadFileFromPodVolume(ctx context.Context, namespace, podName, volume, filename string) (string, error)
- func WaitAllSelectedNSDeleted(ctx context.Context, client TestClient, label string) error
- func WaitForCRDEstablished(crdName string) error
- func WaitForConfigMapComplete(c clientset.Interface, ns, configmapName string) error
- func WaitForConfigmapDelete(c clientset.Interface, ns, name string) error
- func WaitForPods(ctx context.Context, client TestClient, namespace string, pods []string) error
- func WaitForReadyDeployment(c clientset.Interface, ns, name string) error
- func WaitForSecretDelete(c clientset.Interface, ns, name string) error
- func WaitForSecretsComplete(c clientset.Interface, ns, secretName string) error
- func WaitUntilServiceAccountCreated(ctx context.Context, client TestClient, namespace, serviceAccount string, ...) error
- type TestClient
Constants ¶
const ( JobSelectorKey = "job" // Poll is how often to Poll pods, nodes and claims. PollInterval = 2 * time.Second PollTimeout = 15 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func AddAnnotationToPersistentVolume ¶ added in v1.10.0
func AddAnnotationToPersistentVolume(ctx context.Context, client TestClient, namespace string, persistentVolume, key string) (*corev1.PersistentVolume, error)
func AddAnnotationToPod ¶ added in v1.10.0
func AddLabelToCRD ¶ added in v1.10.0
func AddLabelToPod ¶ added in v1.9.0
func AddLabelToPvc ¶ added in v1.9.0
func CRDCountShouldBe ¶ added in v1.10.0
func CRDShouldNotExist ¶ added in v1.10.0
func CleanupClusterRole ¶
func CleanupClusterRole(ctx context.Context, client TestClient, nsBaseName string) error
func CleanupClusterRoleBinding ¶
func CleanupClusterRoleBinding(ctx context.Context, client TestClient, nsBaseName string) error
func CleanupNamespaces ¶
func CleanupNamespaces(ctx context.Context, client TestClient, nsBaseName string) error
func CleanupNamespacesWithPoll ¶
func CleanupNamespacesWithPoll(ctx context.Context, client TestClient, nsBaseName string) error
func CreateConfigMap ¶
func CreateDeployment ¶
func CreateDeployment(c clientset.Interface, ns string, deployment *apps.Deployment) (*apps.Deployment, error)
func CreateFileToPod ¶ added in v1.10.0
func CreateNamespace ¶
func CreateNamespace(ctx context.Context, client TestClient, namespace string) error
func CreatePVC ¶ added in v1.10.0
func CreatePVC(client TestClient, ns, name, sc string) (*corev1.PersistentVolumeClaim, error)
func CreatePersistentVolume ¶ added in v1.10.0
func CreatePersistentVolume(client TestClient, name string) (*corev1.PersistentVolume, error)
func CreatePodWithPVC ¶ added in v1.10.0
func CreateRBACWithBindingSA ¶
func CreateSecret ¶
func CreateSecretFromFiles ¶
func CreateServiceAccount ¶
func CreateVCCredentialSecret ¶
CreateVCCredentialSecret refer to https://github.com/vmware-tanzu/velero-plugin-for-vsphere/blob/v1.3.0/docs/vanilla.md
func DeleteNamespace ¶
func DeleteVeleroDs ¶ added in v1.10.0
func EnsureClusterExists ¶
ensureClusterExists returns whether or not a kubernetes cluster exists for tests to be run on.
func GetAPIVersions ¶ added in v1.10.0
func GetAPIVersions(client *TestClient, name string) ([]string, error)
func GetClusterRole ¶
func GetClusterRole(ctx context.Context, client TestClient, role string) (*v1.ClusterRole, error)
func GetClusterRoleBinding ¶
func GetClusterRoleBinding(ctx context.Context, client TestClient, rolebinding string) (*v1.ClusterRoleBinding, error)
func GetConfigmap ¶
func GetDeployment ¶
func GetNamespace ¶
func GetPVByPodName ¶ added in v1.10.0
func GetPVByPodName(client TestClient, namespace, podName string) (string, error)
func GetPVC ¶ added in v1.10.0
func GetPVC(ctx context.Context, client TestClient, namespace string, persistentVolume string) (*corev1.PersistentVolume, error)
func GetPersistentVolume ¶ added in v1.9.0
func GetPersistentVolume(ctx context.Context, client TestClient, namespace string, persistentVolume string) (*corev1.PersistentVolume, error)
func GetPvByPvc ¶ added in v1.9.0
func GetPvcByPodName ¶ added in v1.9.0
func GetServiceAccount ¶
func GetServiceAccount(ctx context.Context, client TestClient, namespace string, serviceAccount string) (*corev1.ServiceAccount, error)
func KubectlApplyByFile ¶ added in v1.9.0
func KubectlConfigUseContext ¶ added in v1.10.0
func KubectlGetDsJson ¶ added in v1.10.0
func KubectlGetInfo ¶ added in v1.10.0
func NamespaceShouldNotExist ¶ added in v1.10.0
func NamespaceShouldNotExist(ctx context.Context, client TestClient, namespace string) error
func NewDeployment ¶
newDeployment returns a RollingUpdate Deployment with a fake container image
func PatchServiceAccountWithImagePullSecret ¶
func PatchServiceAccountWithImagePullSecret(ctx context.Context, client TestClient, namespace, serviceAccount, dockerCredentialFile string) error
func ReadFileFromPodVolume ¶ added in v1.10.0
func WaitAllSelectedNSDeleted ¶
func WaitAllSelectedNSDeleted(ctx context.Context, client TestClient, label string) error
func WaitForCRDEstablished ¶ added in v1.10.0
func WaitForConfigMapComplete ¶
WaitForConfigMapComplete uses c to wait for completions to complete for the Job jobName in namespace ns.
func WaitForConfigmapDelete ¶
func WaitForPods ¶
WaitForPods waits until all of the pods have gone to PodRunning state
func WaitForReadyDeployment ¶
WaitForReadyDeployment waits for number of ready replicas to equal number of replicas.
func WaitForSecretsComplete ¶
WaitForSecretsComplete uses c to wait for completions to complete for the Job jobName in namespace ns.
Types ¶
type TestClient ¶
type TestClient struct { Kubebuilder kbclient.Client // clientGo returns a client-go API client. // // Deprecated, TODO(2.0): presuming all controllers and resources are converted to the // controller runtime framework by v2.0, it is the intent to remove all // client-go API clients. Please use the controller runtime to make API calls for tests. ClientGo kubernetes.Interface // contains filtered or unexported fields }
func InitTestClient ¶
func InitTestClient(kubecontext string) (TestClient, error)
func NewTestClient ¶
func NewTestClient(kubecontext string) (TestClient, error)
NewTestClient returns a set of ready-to-use API clients.