testingsdk

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MachineDeployment     = "MachineDeployment"
	KubeadmConfigTemplate = "KubeadmConfigTemplate"
	VCDMachineTemplate    = "VCDMachineTemplate"
)

Variables

View Source
var (
	ResourceExisted   = errors.New("[REX] resource is already existed")
	ResourceNotFound  = errors.New("[RNF] resource is not found")
	ResourceNameNull  = errors.New("[RNN] resource name is null")
	ControlPlaneLabel = "node-role.kubernetes.io/control-plane"
)

Functions

func CreateNewKubeadmConfigTemplate

func CreateNewKubeadmConfigTemplate(ctx context.Context, client *vcdsdk.Client, clusterId string, nodePoolName string) (map[string]interface{}, error)

func CreateNewMachineDeployment

func CreateNewMachineDeployment(ctx context.Context, client *vcdsdk.Client, clusterId string, nodePoolName string, nodePoolSize int64) (map[string]interface{}, error)

func CreateNewVCDMachineTemplate

func CreateNewVCDMachineTemplate(ctx context.Context, client *vcdsdk.Client, clusterId string, nodePoolName string) (map[string]interface{}, error)

func GetCapvcdYamlFromRde

func GetCapvcdYamlFromRde(capvcdRDE swagger.DefinedEntity) (string, error)

func GetComponentMapInStatus

func GetComponentMapInStatus(ctx context.Context, client *vcdsdk.Client, clusterId, componentName string) (map[string]interface{}, error)

Returns status.component as map[string]interface{}, this will help us narrow down to specific fields such as nodepools, vcdresources, etc Components: vcdKe, projector, csi, cpi, capvcd

func GetKubeconfigFromRDEId

func GetKubeconfigFromRDEId(ctx context.Context, client *vcdsdk.Client, clusterId string) (string, error)

func GetMapBySpecName

func GetMapBySpecName(specMap map[string]interface{}, specName string, sectionName string) (map[string]interface{}, error)

func GetVCDResourceSet

func GetVCDResourceSet(ctx context.Context, client *vcdsdk.Client, clusterId, componentName string) ([]vcdsdk.VCDResource, error)

func IsRetryableError

func IsRetryableError(err error) bool

Types

type ContainerParams

type ContainerParams struct {
	ContainerName  string
	ContainerImage string
	ContainerPort  int32
	Args           []string
}

type DeployParams

type DeployParams struct {
	Name            string
	Labels          map[string]string
	VolumeParams    VolumeParams
	ContainerParams ContainerParams
}

type Set

type Set struct {
	// contains filtered or unexported fields
}

func NewSet

func NewSet() *Set

func (*Set) Add

func (s *Set) Add(value interface{})

func (*Set) Contains

func (s *Set) Contains(value interface{}) bool

func (*Set) Size

func (s *Set) Size() int

type TestClient

type TestClient struct {
	VcdClient   *vcdsdk.Client
	Cs          kubernetes.Interface
	ClusterId   string
	ClusterName string
}

func NewTestClient

func NewTestClient(params *VCDAuthParams, clusterId string) (*TestClient, error)

func (*TestClient) CreateDeployment

func (tc *TestClient) CreateDeployment(ctx context.Context, params *DeployParams, nameSpace string) (*appsv1.Deployment, error)

func (*TestClient) CreateLoadBalancerService

func (tc *TestClient) CreateLoadBalancerService(ctx context.Context, nameSpace string, serviceName string, annotations map[string]string, labels map[string]string, servicePort []apiv1.ServicePort, loadBalancerIP string) (*apiv1.Service, error)

func (*TestClient) CreateNameSpace

func (tc *TestClient) CreateNameSpace(ctx context.Context, nsName string) (*apiv1.Namespace, error)

func (*TestClient) CreatePV

func (tc *TestClient) CreatePV(ctx context.Context, persistentVolumeName string, storageClass string, storageProfile string, storageSize string, reclaimPolicy apiv1.PersistentVolumeReclaimPolicy) (*apiv1.PersistentVolume, error)

func (*TestClient) CreatePVC

func (tc *TestClient) CreatePVC(ctx context.Context, nameSpace string, pvcName string, storageClass string, storageSize string) (*apiv1.PersistentVolumeClaim, error)

func (*TestClient) CreateStorageClass

func (tc *TestClient) CreateStorageClass(ctx context.Context, scName string, reclaimPolicy apiv1.PersistentVolumeReclaimPolicy, storageProfile string) (*stov1.StorageClass, error)

func (*TestClient) DeleteDeployment

func (tc *TestClient) DeleteDeployment(ctx context.Context, nameSpace string, deploymentName string) error

func (*TestClient) DeleteNameSpace

func (tc *TestClient) DeleteNameSpace(ctx context.Context, nameSpace string) error

func (*TestClient) DeletePV

func (tc *TestClient) DeletePV(ctx context.Context, pvName string) error

func (*TestClient) DeletePVC

func (tc *TestClient) DeletePVC(ctx context.Context, nameSpace string, pvcName string) error

func (*TestClient) DeleteService

func (tc *TestClient) DeleteService(ctx context.Context, nameSpace string, serviceName string) error

func (*TestClient) DeleteStorageClass

func (tc *TestClient) DeleteStorageClass(ctx context.Context, scName string) error

func (*TestClient) GetConfigMap

func (tc *TestClient) GetConfigMap(namespace, name string) (*apiv1.ConfigMap, error)

func (*TestClient) GetDeployment

func (tc *TestClient) GetDeployment(ctx context.Context, nameSpace string, deployName string) (*appsv1.Deployment, error)

func (*TestClient) GetIpamSubnetFromConfigMap

func (tc *TestClient) GetIpamSubnetFromConfigMap(cm *apiv1.ConfigMap) (string, error)

func (*TestClient) GetNetworkNameFromConfigMap

func (tc *TestClient) GetNetworkNameFromConfigMap(cm *apiv1.ConfigMap) (string, error)

func (*TestClient) GetPV

func (tc *TestClient) GetPV(ctx context.Context, pvName string) (*apiv1.PersistentVolume, error)

func (*TestClient) GetPVC

func (tc *TestClient) GetPVC(ctx context.Context, nameSpace string, pvcName string) (*apiv1.PersistentVolumeClaim, error)

func (*TestClient) GetService

func (tc *TestClient) GetService(ctx context.Context, nameSpace string, serviceName string) (*apiv1.Service, error)

func (*TestClient) GetStorageClass

func (tc *TestClient) GetStorageClass(ctx context.Context, scName string) (*stov1.StorageClass, error)

func (*TestClient) GetWorkerNodes

func (tc *TestClient) GetWorkerNodes(ctx context.Context) ([]apiv1.Node, error)

func (*TestClient) WaitForDeploymentReady

func (tc *TestClient) WaitForDeploymentReady(ctx context.Context, nameSpace string, deployName string) error

func (*TestClient) WaitForExtIP

func (tc *TestClient) WaitForExtIP(namespace string, name string) (string, error)

func (*TestClient) WaitForPVDeleted

func (tc *TestClient) WaitForPVDeleted(ctx context.Context, pvName string) (bool, error)

func (*TestClient) WaitForPvcReady

func (tc *TestClient) WaitForPvcReady(ctx context.Context, nameSpace string, pvcName string) error

func (*TestClient) WaitForWorkerNodeNotReady

func (tc *TestClient) WaitForWorkerNodeNotReady(ctx context.Context, workerNode *apiv1.Node) error

WaitForWorkerNodeNotReady we cannot use negate result from WaitForWorkerNodeReady() Set different RetryTimeInterval and avoid timeout error

func (*TestClient) WaitForWorkerNodePhaseRunning

func (tc *TestClient) WaitForWorkerNodePhaseRunning(ctx context.Context, workerNode *apiv1.Node) error

func (*TestClient) WaitForWorkerNodeReady

func (tc *TestClient) WaitForWorkerNodeReady(ctx context.Context, workerNode *apiv1.Node) error

type VCDAuthParams

type VCDAuthParams struct {
	Host         string
	OvdcName     string
	OrgName      string
	Username     string
	RefreshToken string
	UserOrg      string
	GetVdcClient bool // This will need to be set to true as it's needed for CSI, but may not be needed for other use cases
}

type VolumeParams

type VolumeParams struct {
	VolumeName string
	PvcRef     string
	MountPath  string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL