Documentation ¶
Overview ¶
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Copyright 2022 Authors of spidernet-io SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- type ClusterInfo
- type FConfig
- type Framework
- func (f *Framework) CheckNodeStatus(node *corev1.Node, expectReady bool) bool
- func (f *Framework) CheckPodListIpReady(podList *corev1.PodList) error
- func (f *Framework) CheckPodListRunning(podList *corev1.PodList) bool
- func (f *Framework) CreateConfigmap(configMap *corev1.ConfigMap, opts ...client.CreateOption) error
- func (f *Framework) CreateDaemonSet(ds *appsv1.DaemonSet, opts ...client.CreateOption) error
- func (f *Framework) CreateDaemonsetUntilReady(ctx context.Context, dsObj *appsv1.DaemonSet, opts ...client.CreateOption) (*corev1.PodList, error)
- func (f *Framework) CreateDeployment(dpm *appsv1.Deployment, opts ...client.CreateOption) error
- func (f *Framework) CreateDeploymentUntilReady(deployObj *appsv1.Deployment, timeOut time.Duration, ...) (*appsv1.Deployment, error)
- func (f *Framework) CreateEndpoint(ep *corev1.Endpoints, opts ...client.CreateOption) error
- func (f *Framework) CreateJob(jb *batchv1.Job, opts ...client.CreateOption) error
- func (f *Framework) CreateMultusInstance(nad *v1.NetworkAttachmentDefinition, opts ...client.CreateOption) error
- func (f *Framework) CreateNamespace(nsName string, opts ...client.CreateOption) error
- func (f *Framework) CreateNamespaceUntilDefaultServiceAccountReady(nsName string, timeoutForSA time.Duration, opts ...client.CreateOption) error
- func (f *Framework) CreatePod(pod *corev1.Pod, opts ...client.CreateOption) error
- func (f *Framework) CreateReplicaSet(rs *appsv1.ReplicaSet, opts ...client.CreateOption) error
- func (f *Framework) CreateResource(obj client.Object, opts ...client.CreateOption) error
- func (f *Framework) CreateService(service *corev1.Service, opts ...client.CreateOption) error
- func (f *Framework) CreateSpiderMultusInstance(nad *spiderv2beta1.SpiderMultusConfig, opts ...client.CreateOption) error
- func (f *Framework) CreateStatefulSet(sts *appsv1.StatefulSet, opts ...client.CreateOption) error
- func (f *Framework) DeleteConfigmap(name, namespace string, opts ...client.DeleteOption) error
- func (f *Framework) DeleteDaemonSet(name, namespace string, opts ...client.DeleteOption) error
- func (f *Framework) DeleteDeployment(name, namespace string, opts ...client.DeleteOption) error
- func (f *Framework) DeleteDeploymentUntilFinish(deployName, namespace string, timeOut time.Duration, ...) error
- func (f *Framework) DeleteEndpoint(name, namespace string, opts ...client.DeleteOption) error
- func (f *Framework) DeleteJob(name, namespace string, opts ...client.DeleteOption) error
- func (f *Framework) DeleteMultusInstance(name, namespace string) error
- func (f *Framework) DeleteNamespace(nsName string, opts ...client.DeleteOption) error
- func (f *Framework) DeleteNamespaceUntilFinish(nsName string, ctx context.Context, opts ...client.DeleteOption) error
- func (f *Framework) DeletePod(name, namespace string, opts ...client.DeleteOption) error
- func (f *Framework) DeletePodList(podList *corev1.PodList, opts ...client.DeleteOption) error
- func (f *Framework) DeletePodListByLabel(label map[string]string) error
- func (f *Framework) DeletePodListRepeatedly(label map[string]string, interval time.Duration, ctx context.Context, ...) error
- func (f *Framework) DeletePodListUntilReady(podList *corev1.PodList, timeOut time.Duration, opts ...client.DeleteOption) (*corev1.PodList, error)
- func (f *Framework) DeletePodUntilFinish(name, namespace string, ctx context.Context, opts ...client.DeleteOption) error
- func (f *Framework) DeleteReplicaSet(name, namespace string, opts ...client.DeleteOption) error
- func (f *Framework) DeleteResource(obj client.Object, opts ...client.DeleteOption) error
- func (f *Framework) DeleteService(name, namespace string, opts ...client.DeleteOption) error
- func (f *Framework) DeleteSpiderMultusInstance(namespace, name string) error
- func (f *Framework) DeleteStatefulSet(name, namespace string, opts ...client.DeleteOption) error
- func (f *Framework) DockerExecCommand(ctx context.Context, containerId string, command string) ([]byte, error)
- func (f *Framework) DockerRMCommand(ctx context.Context, containerId string) ([]byte, error)
- func (f *Framework) DockerRunCommand(ctx context.Context, command string) ([]byte, error)
- func (f *Framework) ExecCommandInPod(podName, nameSpace, command string, ctx context.Context) ([]byte, error)
- func (f *Framework) ExecKubectl(command string, ctx context.Context) ([]byte, error)
- func (f *Framework) GetConfigmap(name, namespace string) (*corev1.ConfigMap, error)
- func (f *Framework) GetDaemonSet(name, namespace string) (*appsv1.DaemonSet, error)
- func (f *Framework) GetDaemonSetPodList(ds *appsv1.DaemonSet) (*corev1.PodList, error)
- func (f *Framework) GetDeployment(name, namespace string) (*appsv1.Deployment, error)
- func (f *Framework) GetDeploymentPodList(dpm *appsv1.Deployment) (*corev1.PodList, error)
- func (f *Framework) GetEndpoint(name, namespace string) (*corev1.Endpoints, error)
- func (f *Framework) GetEvents(ctx context.Context, eventKind, objName, objNamespace string) (*corev1.EventList, error)
- func (f *Framework) GetJob(name, namespace string) (*batchv1.Job, error)
- func (f *Framework) GetJobPodList(jb *batchv1.Job) (*corev1.PodList, error)
- func (f *Framework) GetMultusInstance(name, namespace string) (*v1.NetworkAttachmentDefinition, error)
- func (f *Framework) GetNamespace(nsName string) (*corev1.Namespace, error)
- func (f *Framework) GetNode(nodeName string) (*corev1.Node, error)
- func (f *Framework) GetNodeList(opts ...client.ListOption) (*corev1.NodeList, error)
- func (f *Framework) GetPod(name, namespace string) (*corev1.Pod, error)
- func (f *Framework) GetPodList(opts ...client.ListOption) (*corev1.PodList, error)
- func (f *Framework) GetPodListByLabel(label map[string]string) (*corev1.PodList, error)
- func (f *Framework) GetReplicaSet(name, namespace string) (*appsv1.ReplicaSet, error)
- func (f *Framework) GetReplicaSetPodList(rs *appsv1.ReplicaSet) (*corev1.PodList, error)
- func (f *Framework) GetResource(key client.ObjectKey, obj client.Object) error
- func (f *Framework) GetService(name, namespace string) (*corev1.Service, error)
- func (f *Framework) GetServiceAccount(saName, namespace string) (*corev1.ServiceAccount, error)
- func (f *Framework) GetSpiderMultusInstance(namespace, name string) (*spiderv2beta1.SpiderMultusConfig, error)
- func (f *Framework) GetStatefulSet(name, namespace string) (*appsv1.StatefulSet, error)
- func (f *Framework) GetStatefulSetPodList(sts *appsv1.StatefulSet) (*corev1.PodList, error)
- func (f *Framework) ListEndpoint(options ...client.ListOption) (*corev1.EndpointsList, error)
- func (f *Framework) ListMultusInstances(opts ...client.ListOption) (*v1.NetworkAttachmentDefinitionList, error)
- func (f *Framework) ListResource(list client.ObjectList, opts ...client.ListOption) error
- func (f *Framework) ListService(options ...client.ListOption) (*corev1.ServiceList, error)
- func (f *Framework) ListSpiderMultusInstances(opts ...client.ListOption) (*spiderv2beta1.SpiderMultusConfigList, error)
- func (f *Framework) Log(format string, args ...interface{})
- func (f *Framework) PatchResource(obj client.Object, patch client.Patch, opts ...client.PatchOption) error
- func (f *Framework) RestartDeploymentPodUntilReady(deployName, namespace string, timeOut time.Duration, ...) error
- func (f *Framework) ScaleDeployment(dpm *appsv1.Deployment, replicas int32) (*appsv1.Deployment, error)
- func (f *Framework) ScaleReplicaSet(rs *appsv1.ReplicaSet, replicas int32) (*appsv1.ReplicaSet, error)
- func (f *Framework) ScaleStatefulSet(sts *appsv1.StatefulSet, replicas int32) (*appsv1.StatefulSet, error)
- func (f *Framework) UpdateResource(obj client.Object, opts ...client.UpdateOption) error
- func (f *Framework) UpdateResourceStatus(obj client.Object, opts ...client.SubResourceUpdateOption) error
- func (f *Framework) WaitAllPodUntilRunning(ctx context.Context) error
- func (f *Framework) WaitClusterNodeReady(ctx context.Context) (bool, error)
- func (f *Framework) WaitDaemonSetReady(name, namespace string, ctx context.Context) (*appsv1.DaemonSet, error)
- func (f *Framework) WaitDeploymentReady(name, namespace string, ctx context.Context) (*appsv1.Deployment, error)
- func (f *Framework) WaitDeploymentReadyAndCheckIP(depName string, nsName string, timeout time.Duration) (*corev1.PodList, error)
- func (f *Framework) WaitExceptEventOccurred(ctx context.Context, eventKind, objName, objNamespace, message string) error
- func (f *Framework) WaitJobFinished(jobName, namespace string, ctx context.Context) (*batchv1.Job, bool, error)
- func (f *Framework) WaitPodListDeleted(namespace string, label map[string]string, ctx context.Context) error
- func (f *Framework) WaitPodListRunning(label map[string]string, expectedPodNum int, ctx context.Context) error
- func (f *Framework) WaitPodStarted(name, namespace string, ctx context.Context) (*corev1.Pod, error)
- func (f *Framework) WaitReplicaSetReady(name, namespace string, ctx context.Context) (*appsv1.ReplicaSet, error)
- func (f *Framework) WaitServiceAccountReady(saName, namespace string, timeout time.Duration) error
- func (f *Framework) WaitStatefulSetReady(name, namespace string, ctx context.Context) (*appsv1.StatefulSet, error)
- type TestingT
Constants ¶
const ( E2E_CLUSTER_NAME = "E2E_CLUSTER_NAME" E2E_KUBECONFIG_PATH = "E2E_KUBECONFIG_PATH" E2E_IPV4_ENABLED = "E2E_IPV4_ENABLED" E2E_IPV6_ENABLED = "E2E_IPV6_ENABLED" E2E_MULTUS_CNI_ENABLED = "E2E_MULTUS_CNI_ENABLED" E2E_SPIDERPOOL_IPAM_ENABLED = "E2E_SPIDERPOOL_IPAM_ENABLED" E2E_WHEREABOUT_IPAM_ENABLED = "E2E_WHEREABOUT_IPAM_ENABLED" E2E_KIND_CLUSTER_NODE_LIST = "E2E_KIND_CLUSTER_NODE_LIST" E2E_Multus_DefaultCni = "E2E_Multus_DefaultCni" E2E_Multus_AdditionalCni = "E2E_Multus_AdditionalCni" E2E_SPIDERSUBNET_ENABLED = "E2E_SPIDERSUBNET_ENABLED" )
Variables ¶
var ( Default_k8sClient_QPS float32 = 200 Default_k8sClient_Burst int = 300 Default_k8sClient_ApiOperateTimeout = 15 * time.Second Default_k8sClient_ResourceDeleteTimeout = 60 * time.Second )
var ClusterInformation = &ClusterInfo{}
var ErrAlreadyExisted = errors.New("resource already exists")
var ErrChanelClosed = errors.New("channel is closed")
var ErrEvent = errors.New("received error event")
var ErrGetObj = errors.New("failed to get metaObject")
var ErrResDel = errors.New("resource is deleted")
var ErrTimeOut = errors.New("context timeout")
var ErrWatch = errors.New("failed to Watch")
var ErrWrongInput = errors.New("input variable is not valid")
Functions ¶
This section is empty.
Types ¶
type ClusterInfo ¶
type ClusterInfo struct { IpV4Enabled bool IpV6Enabled bool MultusEnabled bool SpiderIPAMEnabled bool WhereaboutIPAMEnabled bool ClusterName string KubeConfigPath string // docker container name for kind cluster KindNodeList []string KindNodeListRaw string // multus MultusDefaultCni string MultusAdditionalCni string SpiderSubnetEnabled bool }
type Framework ¶
type Framework struct { // clienset KClient client.WithWatch KConfig *rest.Config // cluster info Info ClusterInfo Config FConfig EnableLog bool // contains filtered or unexported fields }
func NewFramework ¶
func NewFramework(t TestingT, schemeRegisterList []func(*runtime.Scheme) error, fakeClient ...client.WithWatch) (*Framework, error)
NewFramework init Framework struct fakeClient for unitest
func (*Framework) CheckNodeStatus ¶
func (*Framework) CheckPodListIpReady ¶
func (*Framework) CheckPodListRunning ¶
func (*Framework) CreateConfigmap ¶
func (*Framework) CreateDaemonSet ¶
func (*Framework) CreateDaemonsetUntilReady ¶
func (f *Framework) CreateDaemonsetUntilReady(ctx context.Context, dsObj *appsv1.DaemonSet, opts ...client.CreateOption) (*corev1.PodList, error)
Create Daemonset and wait for ready and check that the IP of the Pod is assigned correctly
func (*Framework) CreateDeployment ¶
func (f *Framework) CreateDeployment(dpm *appsv1.Deployment, opts ...client.CreateOption) error
func (*Framework) CreateDeploymentUntilReady ¶
func (f *Framework) CreateDeploymentUntilReady(deployObj *appsv1.Deployment, timeOut time.Duration, opts ...client.CreateOption) (*appsv1.Deployment, error)
func (*Framework) CreateEndpoint ¶
CreateEndpoint create an endpoint to testing GetEndpoint/ListEndpoint
func (*Framework) CreateMultusInstance ¶
func (f *Framework) CreateMultusInstance(nad *v1.NetworkAttachmentDefinition, opts ...client.CreateOption) error
func (*Framework) CreateNamespace ¶
func (f *Framework) CreateNamespace(nsName string, opts ...client.CreateOption) error
func (*Framework) CreateNamespaceUntilDefaultServiceAccountReady ¶
func (*Framework) CreateReplicaSet ¶
func (f *Framework) CreateReplicaSet(rs *appsv1.ReplicaSet, opts ...client.CreateOption) error
func (*Framework) CreateResource ¶
func (*Framework) CreateService ¶
func (*Framework) CreateSpiderMultusInstance ¶
func (f *Framework) CreateSpiderMultusInstance(nad *spiderv2beta1.SpiderMultusConfig, opts ...client.CreateOption) error
func (*Framework) CreateStatefulSet ¶
func (f *Framework) CreateStatefulSet(sts *appsv1.StatefulSet, opts ...client.CreateOption) error
func (*Framework) DeleteConfigmap ¶
func (f *Framework) DeleteConfigmap(name, namespace string, opts ...client.DeleteOption) error
func (*Framework) DeleteDaemonSet ¶
func (f *Framework) DeleteDaemonSet(name, namespace string, opts ...client.DeleteOption) error
func (*Framework) DeleteDeployment ¶
func (f *Framework) DeleteDeployment(name, namespace string, opts ...client.DeleteOption) error
func (*Framework) DeleteDeploymentUntilFinish ¶
func (*Framework) DeleteEndpoint ¶
func (f *Framework) DeleteEndpoint(name, namespace string, opts ...client.DeleteOption) error
func (*Framework) DeleteJob ¶
func (f *Framework) DeleteJob(name, namespace string, opts ...client.DeleteOption) error
func (*Framework) DeleteMultusInstance ¶
func (*Framework) DeleteNamespace ¶
func (f *Framework) DeleteNamespace(nsName string, opts ...client.DeleteOption) error
func (*Framework) DeleteNamespaceUntilFinish ¶
func (*Framework) DeletePod ¶
func (f *Framework) DeletePod(name, namespace string, opts ...client.DeleteOption) error
func (*Framework) DeletePodList ¶
func (*Framework) DeletePodListByLabel ¶
func (*Framework) DeletePodListRepeatedly ¶
func (*Framework) DeletePodListUntilReady ¶
func (*Framework) DeletePodUntilFinish ¶
func (*Framework) DeleteReplicaSet ¶
func (f *Framework) DeleteReplicaSet(name, namespace string, opts ...client.DeleteOption) error
func (*Framework) DeleteResource ¶
func (*Framework) DeleteService ¶
func (f *Framework) DeleteService(name, namespace string, opts ...client.DeleteOption) error
func (*Framework) DeleteSpiderMultusInstance ¶
func (*Framework) DeleteStatefulSet ¶
func (f *Framework) DeleteStatefulSet(name, namespace string, opts ...client.DeleteOption) error
func (*Framework) DockerExecCommand ¶
func (f *Framework) DockerExecCommand(ctx context.Context, containerId string, command string) ([]byte, error)
DockerExecCommand is eq to `docker exec $containerId $command `
func (*Framework) DockerRMCommand ¶
DockerRMCommand is eq to `docker rm $containerId`
func (*Framework) DockerRunCommand ¶
DockerRunCommand eq to `docker run $command`
func (*Framework) ExecCommandInPod ¶
func (*Framework) ExecKubectl ¶
operate node container, like shutdown, ssh to login
func (*Framework) GetConfigmap ¶
func (*Framework) GetDaemonSet ¶
func (*Framework) GetDaemonSetPodList ¶
func (*Framework) GetDeployment ¶
func (f *Framework) GetDeployment(name, namespace string) (*appsv1.Deployment, error)
func (*Framework) GetDeploymentPodList ¶
func (*Framework) GetEndpoint ¶
func (*Framework) GetJobPodList ¶
func (*Framework) GetMultusInstance ¶
func (f *Framework) GetMultusInstance(name, namespace string) (*v1.NetworkAttachmentDefinition, error)
func (*Framework) GetNamespace ¶
func (*Framework) GetNodeList ¶
func (*Framework) GetPodList ¶
func (*Framework) GetPodListByLabel ¶
func (*Framework) GetReplicaSet ¶
func (f *Framework) GetReplicaSet(name, namespace string) (*appsv1.ReplicaSet, error)
func (*Framework) GetReplicaSetPodList ¶
func (*Framework) GetResource ¶
func (*Framework) GetService ¶
func (*Framework) GetServiceAccount ¶
func (f *Framework) GetServiceAccount(saName, namespace string) (*corev1.ServiceAccount, error)
func (*Framework) GetSpiderMultusInstance ¶
func (f *Framework) GetSpiderMultusInstance(namespace, name string) (*spiderv2beta1.SpiderMultusConfig, error)
func (*Framework) GetStatefulSet ¶
func (f *Framework) GetStatefulSet(name, namespace string) (*appsv1.StatefulSet, error)
func (*Framework) GetStatefulSetPodList ¶
func (*Framework) ListEndpoint ¶
func (f *Framework) ListEndpoint(options ...client.ListOption) (*corev1.EndpointsList, error)
func (*Framework) ListMultusInstances ¶
func (f *Framework) ListMultusInstances(opts ...client.ListOption) (*v1.NetworkAttachmentDefinitionList, error)
func (*Framework) ListResource ¶
func (f *Framework) ListResource(list client.ObjectList, opts ...client.ListOption) error
func (*Framework) ListService ¶
func (f *Framework) ListService(options ...client.ListOption) (*corev1.ServiceList, error)
func (*Framework) ListSpiderMultusInstances ¶
func (f *Framework) ListSpiderMultusInstances(opts ...client.ListOption) (*spiderv2beta1.SpiderMultusConfigList, error)
func (*Framework) PatchResource ¶
func (*Framework) RestartDeploymentPodUntilReady ¶
func (*Framework) ScaleDeployment ¶
func (f *Framework) ScaleDeployment(dpm *appsv1.Deployment, replicas int32) (*appsv1.Deployment, error)
func (*Framework) ScaleReplicaSet ¶
func (f *Framework) ScaleReplicaSet(rs *appsv1.ReplicaSet, replicas int32) (*appsv1.ReplicaSet, error)
func (*Framework) ScaleStatefulSet ¶
func (f *Framework) ScaleStatefulSet(sts *appsv1.StatefulSet, replicas int32) (*appsv1.StatefulSet, error)
func (*Framework) UpdateResource ¶
func (*Framework) UpdateResourceStatus ¶
func (*Framework) WaitAllPodUntilRunning ¶
Waiting for all pods in all namespaces to run
func (*Framework) WaitClusterNodeReady ¶
func (*Framework) WaitDaemonSetReady ¶
func (*Framework) WaitDeploymentReady ¶
func (*Framework) WaitDeploymentReadyAndCheckIP ¶
func (*Framework) WaitExceptEventOccurred ¶
func (*Framework) WaitJobFinished ¶
func (f *Framework) WaitJobFinished(jobName, namespace string, ctx context.Context) (*batchv1.Job, bool, error)
WaitJobFinished wait for all job pod finish , no matter succeed or fail