Documentation ¶
Index ¶
- Variables
- func MakeDaemonSet(source string) (*appsv1.DaemonSet, error)
- func MakeDeployment(source string) (*appsv1.Deployment, error)
- func MakeJob(source string) (*batchv1.Job, error)
- func PathToOSFile(relativePath string) (*os.File, error)
- func SourceToIOReader(source string) (io.Reader, error)
- func StartPortForward(ctx context.Context, config *rest.Config, scheme string, name string, ...) (func(), error)
- func URLToIOReader(url string) (io.Reader, error)
- type ExecOptions
- type FinalizerFn
- type Framework
- func (f *Framework) AddLabelsToNamespace(ctx context.Context, name string, additionalLabels map[string]string) error
- func (f *Framework) CreateDaemonSet(ctx context.Context, namespace string, daemonset *appsv1.DaemonSet) error
- func (f *Framework) CreateDeployment(ctx context.Context, namespace string, deployment *appsv1.Deployment) error
- func (f *Framework) CreateJob(ctx context.Context, namespace string, job *batchv1.Job) error
- func (f *Framework) CreateNamespace(ctx context.Context, t *testing.T, testCtx *TestCtx) string
- func (f *Framework) CreateOrUpdateCSIDriver(ctx context.Context, source string) (*storagev1.CSIDriver, error)
- func (f *Framework) CreateOrUpdateClusterRole(ctx context.Context, source string) (*rbacv1.ClusterRole, error)
- func (f *Framework) CreateOrUpdateDaemonSetAndWaitUntilReady(ctx context.Context, namespace string, daemonset *appsv1.DaemonSet) error
- func (f *Framework) CreateOrUpdateDeploymentAndWaitUntilReady(ctx context.Context, namespace string, deployment *appsv1.Deployment) error
- func (f *Framework) CreateOrUpdateJobAndWaitUntilReady(ctx context.Context, namespace string, job *batchv1.Job) error
- func (f *Framework) CreateOrUpdateStorageClass(ctx context.Context, source string) (*storagev1.StorageClass, error)
- func (f *Framework) DeleteCSIDriver(ctx context.Context, source string) error
- func (f *Framework) DeleteClusterRole(ctx context.Context, source string) error
- func (f *Framework) DeleteClusterRoleBinding(ctx context.Context, ns string, source string) error
- func (f *Framework) DeleteDaemonSet(ctx context.Context, namespace, name string) error
- func (f *Framework) DeleteDeployment(ctx context.Context, namespace, name string) error
- func (f *Framework) DeleteJob(ctx context.Context, namespace, name string) error
- func (f *Framework) DeleteNamespace(ctx context.Context, name string) error
- func (f *Framework) DeleteStorageClass(ctx context.Context, source string) error
- func (f *Framework) ExecWithOptions(ctx context.Context, options ExecOptions) (string, string, error)
- func (f *Framework) GetCSIDriver(ctx context.Context, name string) (*storagev1.CSIDriver, error)
- func (f *Framework) GetDaemonSet(ctx context.Context, ns, name string) (*appsv1.DaemonSet, error)
- func (f *Framework) GetDeployment(ctx context.Context, ns, name string) (*appsv1.Deployment, error)
- func (f *Framework) GetJob(ctx context.Context, ns, name string) (*batchv1.Job, error)
- func (f *Framework) GetPodRestartCount(ctx context.Context, ns, podName string) (map[string]int32, error)
- func (f *Framework) GetStorageClass(ctx context.Context, name string) (*storagev1.StorageClass, error)
- func (f *Framework) NewTestCtx(t *testing.T) *TestCtx
- func (f *Framework) PrintEvents(ctx context.Context) error
- func (f *Framework) PrintPodLogs(ctx context.Context, ns, p string) error
- func (f *Framework) RemoveLabelsFromNamespace(ctx context.Context, name string, labels ...string) error
- func (f *Framework) UpdateCSIDriver(ctx context.Context, csiDriver *storagev1.CSIDriver) error
- func (f *Framework) UpdateClusterRole(ctx context.Context, clusterRole *rbacv1.ClusterRole) error
- func (f *Framework) UpdateDaemonSet(ctx context.Context, daemonset *appsv1.DaemonSet) (*appsv1.DaemonSet, error)
- func (f *Framework) UpdateDeployment(ctx context.Context, deployment *appsv1.Deployment) (*appsv1.Deployment, error)
- func (f *Framework) UpdateJob(ctx context.Context, job *batchv1.Job) (*batchv1.Job, error)
- func (f *Framework) UpdateStorageClass(ctx context.Context, storageClass *storagev1.StorageClass) error
- func (f *Framework) WaitForDaemonSetReady(ctx context.Context, namespace, daemonsetName string, expectedGeneration int64) error
- func (f *Framework) WaitForDeploymentReady(ctx context.Context, namespace, deploymentName string, ...) error
- func (f *Framework) WaitForJobReady(ctx context.Context, namespace, jobName string, expectedGeneration int32) error
- func (f *Framework) WaitUntilDaemonSetGone(ctx context.Context, _ kubernetes.Interface, namespace, name string, ...) error
- func (f *Framework) WaitUntilDeploymentGone(ctx context.Context, _ kubernetes.Interface, namespace, name string, ...) error
- func (f *Framework) WaitUntilJobGone(ctx context.Context, _ kubernetes.Interface, namespace, name string, ...) error
- type TestCtx
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultCSIRule = rbacv1.PolicyRule{ APIGroups: []string{"csi.aliyun.com"}, Resources: []string{ "nodelocalstorages", "nodelocalstorages/status", "nodelocalstorageinitconfigs", }, Verbs: []string{ "create", "get", "list", "watch", "update", "delete", "patch", }, } DefaultEventsRule = rbacv1.PolicyRule{ APIGroups: []string{""}, Resources: []string{"events"}, Verbs: []string{"create", "update", "patch"}, } DefaultCoreRule = rbacv1.PolicyRule{ APIGroups: []string{""}, Resources: []string{ "nodes", "pods", "pods/binding", "pods/status", "bindings", "persistentvolumeclaims", "persistentvolumeclaims/status", "persistentvolumes", "persistentvolumes/status", "namespaces", "secrets", }, Verbs: []string{"create", "get", "list", "watch", "update", "delete", "patch"}, } DefaultStorageRule = rbacv1.PolicyRule{ APIGroups: []string{"storage.k8s.io"}, Resources: []string{ "storageclasses", "csinodes", "volumeattachments", }, Verbs: []string{"get", "list", "watch"}, } DefaultSnapshotRule = rbacv1.PolicyRule{ APIGroups: []string{"snapshot.storage.k8s.io"}, Resources: []string{ "volumesnapshotclasses", "volumesnapshots", "volumesnapshots/status", "volumesnapshotcontents", "volumesnapshotcontents/status", }, Verbs: []string{"create", "get", "list", "watch", "update", "delete", "patch"}, } DefaultCoordinationRule = rbacv1.PolicyRule{ APIGroups: []string{"coordination.k8s.io"}, Resources: []string{ "leases", }, Verbs: []string{"create", "get", "list", "watch", "update", "delete", "patch"}, } )
Functions ¶
func MakeDeployment ¶
func MakeDeployment(source string) (*appsv1.Deployment, error)
func StartPortForward ¶
Types ¶
type ExecOptions ¶
type ExecOptions struct { Command []string Namespace string PodName string ContainerName string Stdin io.Reader CaptureStdout bool CaptureStderr bool // If false, whitespace in std{err,out} will be removed. PreserveWhitespace bool }
ExecOptions passed to ExecWithOptions
type FinalizerFn ¶
type FinalizerFn func() error
type Framework ¶
type Framework struct { KubeClient kubernetes.Interface APIServerClient apiclient.Interface HTTPClient *http.Client MasterHost string DefaultTimeout time.Duration RestConfig *rest.Config Image string Version semver.Version // contains filtered or unexported fields }
func New ¶
func New(kubeconfig, image, exampleDir, resourcesDir string, version semver.Version) (*Framework, error)
New setups a test framework and returns it.
func (*Framework) AddLabelsToNamespace ¶
func (*Framework) CreateDaemonSet ¶
func (*Framework) CreateDeployment ¶
func (*Framework) CreateNamespace ¶
func (*Framework) CreateOrUpdateCSIDriver ¶
func (*Framework) CreateOrUpdateClusterRole ¶
func (*Framework) CreateOrUpdateDaemonSetAndWaitUntilReady ¶
func (*Framework) CreateOrUpdateDeploymentAndWaitUntilReady ¶
func (*Framework) CreateOrUpdateJobAndWaitUntilReady ¶
func (*Framework) CreateOrUpdateStorageClass ¶
func (*Framework) DeleteCSIDriver ¶
func (*Framework) DeleteClusterRole ¶
func (*Framework) DeleteClusterRoleBinding ¶
func (*Framework) DeleteDaemonSet ¶
func (*Framework) DeleteDeployment ¶
func (*Framework) DeleteNamespace ¶
func (*Framework) DeleteStorageClass ¶
func (*Framework) ExecWithOptions ¶
func (f *Framework) ExecWithOptions(ctx context.Context, options ExecOptions) (string, string, error)
ExecWithOptions executes a command in the specified container, returning stdout, stderr and error. `options` allowed for additional parameters to be passed. Inspired by https://github.com/kubernetes/kubernetes/blob/dde6e8e7465468c32642659cb708a5cc922add64/test/e2e/framework/exec_util.go#L36-L51
func (*Framework) GetCSIDriver ¶
func (*Framework) GetDaemonSet ¶
func (*Framework) GetDeployment ¶
func (*Framework) GetPodRestartCount ¶
func (f *Framework) GetPodRestartCount(ctx context.Context, ns, podName string) (map[string]int32, error)
GetPodRestartCount returns a map of container names and their restart counts for a given pod.
func (*Framework) GetStorageClass ¶
func (*Framework) PrintPodLogs ¶
func (*Framework) RemoveLabelsFromNamespace ¶
func (*Framework) UpdateCSIDriver ¶
func (*Framework) UpdateClusterRole ¶
func (*Framework) UpdateDaemonSet ¶
func (*Framework) UpdateDeployment ¶
func (f *Framework) UpdateDeployment(ctx context.Context, deployment *appsv1.Deployment) (*appsv1.Deployment, error)
func (*Framework) UpdateStorageClass ¶
func (*Framework) WaitForDaemonSetReady ¶
func (*Framework) WaitForDeploymentReady ¶
func (*Framework) WaitForJobReady ¶
func (*Framework) WaitUntilDaemonSetGone ¶
func (*Framework) WaitUntilDeploymentGone ¶
Click to show internal directories.
Click to hide internal directories.