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 CalFileHashInPod(ctx context.Context, namespace, podName, containerName, filePath string) (string, error)
- func CleanupClusterRole(ctx context.Context, client TestClient, CaseBaseName string) error
- func CleanupClusterRoleBinding(ctx context.Context, client TestClient, CaseBaseName string) error
- func CleanupNamespaces(ctx context.Context, client TestClient, CaseBaseName string) error
- func CleanupNamespacesFiterdByExcludes(ctx context.Context, client TestClient, excludeNS []string) error
- func CleanupNamespacesWithPoll(ctx context.Context, client TestClient, CaseBaseName string) error
- func ClearClaimRefForFailedPVs(ctx context.Context, client TestClient) error
- func CollectClusterEvents(key string, pods []string)
- func CreateConfigMap(c clientset.Interface, ns, name string, labels, data map[string]string) (*v1.ConfigMap, error)
- func CreateConfigMapFromYAMLData(c clientset.Interface, yamlData, cmName, namespace string) error
- func CreateDeploy(c clientset.Interface, ns string, deployment *apps.Deployment) error
- func CreateDeployment(c clientset.Interface, ns string, deployment *apps.Deployment) (*apps.Deployment, error)
- func CreateFileToPod(ctx context.Context, ...) 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, ann map[string]string) (*corev1.PersistentVolumeClaim, error)
- func CreatePersistentVolume(client TestClient, name string) (*corev1.PersistentVolume, error)
- func CreatePod(client TestClient, ns, name, sc, pvcName string, volumeNameList []string, ...) (*corev1.Pod, error)
- func CreatePvc(client TestClient, pvcBulder *PVCBuilder) 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 CreateService(ctx context.Context, client TestClient, namespace string, service string, ...) error
- func CreateServiceAccount(ctx context.Context, client TestClient, namespace string, ...) error
- func CreateVolumes(pvcName string, volumeNameList []string) (vols []*corev1.Volume)
- func DeleteCRD(ctx context.Context, yaml string) error
- func DeleteCRDByName(ctx context.Context, name string) error
- func DeleteConfigmap(c clientset.Interface, ns, name string) error
- func DeleteNamespace(ctx context.Context, client TestClient, namespace string, wait bool) error
- func DeleteStorageClass(ctx context.Context, client TestClient, name string) error
- func DeleteVeleroDs(ctx context.Context) error
- func EnsureClusterExists(ctx context.Context) error
- func FileExistInPV(ctx context.Context, ...) (bool, error)
- func GetAPIVersions(client *TestClient, name string) ([]string, error)
- func GetAllPVNames(ctx context.Context, client TestClient) ([]string, error)
- func GetAllService(ctx context.Context) (string, error)
- func GetBackupNamespaces(ctx context.Context, client TestClient, excludeNS []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 GetMappingNamespaces(ctx context.Context, client TestClient, excludeNS []string) (string, error)
- func GetNamespace(ctx context.Context, client TestClient, namespace string) (*corev1api.Namespace, error)
- func GetPVByPVCName(client TestClient, namespace, pvcName string) (string, error)
- func GetPVC(ctx context.Context, client TestClient, namespace string, pvcName string) (*corev1.PersistentVolumeClaim, 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 GetPvcByPVCName(ctx context.Context, namespace, pvcName string) ([]string, error)
- func GetSecret(c clientset.Interface, ns, secretName string) (*v1.Secret, error)
- func GetService(ctx context.Context, client TestClient, namespace string, service string) (*corev1.Service, error)
- func GetServiceAccount(ctx context.Context, client TestClient, namespace string, ...) (*corev1.ServiceAccount, error)
- func GetWorkerNodes(ctx context.Context) ([]string, error)
- func InstallCR(ctx context.Context, crFile, ns string) error
- func InstallCRD(ctx context.Context, yaml string) error
- func InstallStorageClass(ctx context.Context, yaml string) error
- func KubectlApplyByFile(ctx context.Context, file string) error
- func KubectlConfigUseContext(ctx context.Context, kubectlContext string) error
- func KubectlCreateClusterRoleBinding(ctx context.Context, name, clusterrole, namespace, serviceaccount string) error
- func KubectlCreateNamespace(ctx context.Context, name string) error
- func KubectlDeleteByFile(ctx context.Context, file string) error
- func KubectlDeleteClusterRoleBinding(ctx context.Context, name string) error
- func KubectlDeleteNamespace(ctx context.Context, namespace string) error
- func KubectlGetDsJson(veleroNamespace string) (string, error)
- func KubectlGetNS(ctx context.Context, name string) ([]string, error)
- func ListPods(ctx context.Context, client TestClient, namespace string) (*corev1.PodList, error)
- func NamespaceShouldNotExist(ctx context.Context, client TestClient, namespace string) error
- func PatchServiceAccountWithImagePullSecret(ctx context.Context, client TestClient, ...) error
- func PrepareVolumeList(volumeNameList []string) (vols []*corev1.Volume)
- func ReadFileFromPodVolume(ctx context.Context, ...) (string, string, error)
- func RunCommand(cmdName string, arg []string) string
- func ScaleStatefulSet(ctx context.Context, namespace, name string, replicas int) 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 WaitForServiceDelete(client TestClient, ns, name string, deleteFirst bool) error
- func WaitUntilServiceAccountCreated(ctx context.Context, client TestClient, namespace, serviceAccount string, ...) error
- func WriteRandomDataToFileInPod(ctx context.Context, ...) error
- type DeploymentBuilder
- type PVCBuilder
- type TestClient
Constants ¶
View Source
const ( JobSelectorKey = "job" // Poll is how often to Poll pods, nodes and claims. PollInterval = 2 * time.Second PollTimeout = 15 * time.Minute DefaultContainerName = "container-busybox" )
Variables ¶
This section is empty.
Functions ¶
func AddAnnotationToPersistentVolume ¶
func AddAnnotationToPersistentVolume(ctx context.Context, client TestClient, namespace string, persistentVolume, key string) (*corev1.PersistentVolume, error)
func AddAnnotationToPod ¶
func AddLabelToPod ¶
func CalFileHashInPod ¶ added in v1.14.0
func CleanupClusterRole ¶
func CleanupClusterRole(ctx context.Context, client TestClient, CaseBaseName string) error
func CleanupClusterRoleBinding ¶
func CleanupClusterRoleBinding(ctx context.Context, client TestClient, CaseBaseName string) error
func CleanupNamespaces ¶
func CleanupNamespaces(ctx context.Context, client TestClient, CaseBaseName string) error
func CleanupNamespacesFiterdByExcludes ¶
func CleanupNamespacesFiterdByExcludes(ctx context.Context, client TestClient, excludeNS []string) error
func CleanupNamespacesWithPoll ¶
func CleanupNamespacesWithPoll(ctx context.Context, client TestClient, CaseBaseName string) error
func ClearClaimRefForFailedPVs ¶
func ClearClaimRefForFailedPVs(ctx context.Context, client TestClient) error
func CollectClusterEvents ¶
func CreateConfigMap ¶
func CreateDeploy ¶
func CreateDeployment ¶
func CreateDeployment(c clientset.Interface, ns string, deployment *apps.Deployment) (*apps.Deployment, error)
func CreateFileToPod ¶
func CreateNamespace ¶
func CreateNamespace(ctx context.Context, client TestClient, namespace string) error
func CreatePVC ¶
func CreatePVC(client TestClient, ns, name, sc string, ann map[string]string) (*corev1.PersistentVolumeClaim, error)
func CreatePersistentVolume ¶
func CreatePersistentVolume(client TestClient, name string) (*corev1.PersistentVolume, error)
func CreatePvc ¶
func CreatePvc(client TestClient, pvcBulder *PVCBuilder) error
func CreateRBACWithBindingSA ¶
func CreateSecret ¶
func CreateSecretFromFiles ¶
func CreateService ¶
func CreateService(ctx context.Context, client TestClient, namespace string, service string, labels map[string]string, serviceSpec *corev1.ServiceSpec) error
func CreateServiceAccount ¶
func CreateVolumes ¶
func DeleteNamespace ¶
func DeleteStorageClass ¶
func DeleteStorageClass(ctx context.Context, client TestClient, name string) error
func DeleteVeleroDs ¶
func EnsureClusterExists ¶
ensureClusterExists returns whether or not a Kubernetes cluster exists for tests to be run on.
func FileExistInPV ¶ added in v1.13.0
func GetAPIVersions ¶
func GetAPIVersions(client *TestClient, name string) ([]string, error)
func GetAllPVNames ¶ added in v1.13.0
func GetAllPVNames(ctx context.Context, client TestClient) ([]string, error)
func GetBackupNamespaces ¶ added in v1.13.0
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 GetMappingNamespaces ¶ added in v1.13.0
func GetNamespace ¶
func GetPVByPVCName ¶
func GetPVByPVCName(client TestClient, namespace, pvcName string) (string, error)
func GetPVC ¶
func GetPVC(ctx context.Context, client TestClient, namespace string, pvcName string) (*corev1.PersistentVolumeClaim, error)
func GetPersistentVolume ¶
func GetPersistentVolume(ctx context.Context, client TestClient, namespace string, persistentVolume string) (*corev1.PersistentVolume, error)
func GetPvcByPVCName ¶
func GetService ¶
func GetServiceAccount ¶
func GetServiceAccount(ctx context.Context, client TestClient, namespace string, serviceAccount string) (*corev1.ServiceAccount, error)
func KubectlConfigUseContext ¶
func KubectlCreateClusterRoleBinding ¶ added in v1.14.0
func KubectlCreateNamespace ¶ added in v1.14.0
func KubectlDeleteByFile ¶ added in v1.14.0
func KubectlDeleteClusterRoleBinding ¶ added in v1.14.0
func KubectlDeleteNamespace ¶ added in v1.14.0
func KubectlGetDsJson ¶
func KubectlGetNS ¶ added in v1.14.0
func NamespaceShouldNotExist ¶
func NamespaceShouldNotExist(ctx context.Context, client TestClient, namespace string) error
func PatchServiceAccountWithImagePullSecret ¶
func PatchServiceAccountWithImagePullSecret(ctx context.Context, client TestClient, namespace, serviceAccount, dockerCredentialFile string) error
func PrepareVolumeList ¶
func ReadFileFromPodVolume ¶
func RunCommand ¶
func ScaleStatefulSet ¶
func WaitAllSelectedNSDeleted ¶
func WaitAllSelectedNSDeleted(ctx context.Context, client TestClient, label string) error
func WaitForCRDEstablished ¶
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.
func WaitForServiceDelete ¶
func WaitForServiceDelete(client TestClient, ns, name string, deleteFirst bool) error
Types ¶
type DeploymentBuilder ¶
type DeploymentBuilder struct {
*apps.Deployment
}
DeploymentBuilder builds Deployment objects.
func NewDeployment ¶
func NewDeployment(name, ns string, replicas int32, labels map[string]string, containers []v1.Container) *DeploymentBuilder
newDeployment returns a RollingUpdate Deployment with a fake container image
func (*DeploymentBuilder) Result ¶
func (d *DeploymentBuilder) Result() *apps.Deployment
func (*DeploymentBuilder) WithVolume ¶
func (d *DeploymentBuilder) WithVolume(volumes []*v1.Volume) *DeploymentBuilder
type PVCBuilder ¶
type PVCBuilder struct {
*corev1.PersistentVolumeClaim
}
PVCBuilder builds PVC objects.
func NewPVC ¶
func NewPVC(ns, name string) *PVCBuilder
func (*PVCBuilder) Result ¶
func (p *PVCBuilder) Result() *corev1.PersistentVolumeClaim
func (*PVCBuilder) WithAnnotation ¶
func (p *PVCBuilder) WithAnnotation(ann map[string]string) *PVCBuilder
func (*PVCBuilder) WithResourceStorage ¶
func (p *PVCBuilder) WithResourceStorage(q resource.Quantity) *PVCBuilder
func (*PVCBuilder) WithStorageClass ¶
func (p *PVCBuilder) WithStorageClass(sc string) *PVCBuilder
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 MetricsClient *metricsclientset.Clientset // 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.
Click to show internal directories.
Click to hide internal directories.