framework

package
v0.0.0-...-b25b198 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package framework implements the test framework.

Index

Constants

View Source
const (
	// TkgDefaultClusterPrefix is TKG cluster prefix
	TkgDefaultClusterPrefix = "tkg-cli-"

	// TkgDefaultTimeout is the default timeout
	TkgDefaultTimeout = "30m"

	// TkgDefaultLogLevel is the default log level
	TkgDefaultLogLevel = 6
)

Variables

This section is empty.

Functions

func AddDefaultSchemes

func AddDefaultSchemes(scheme *runtime.Scheme)

AddDefaultSchemes adds the default schemes

func GetClusterClass

func GetClusterClass(proxy *ClusterProxy, clusterName string, namespace string) (string, error)

GetClusterClass returns ClusterClass used by the Cluster

func GetClusterclient

func GetClusterclient(kubeconfigPath, context string) clusterclient.Client

GetClusterclient creates and returns clusterclient for given kube config file

func GetTempClusterConfigFile

func GetTempClusterConfigFile(clusterConfigFile string, options *CreateClusterOptions) (string, error)

GetTempClusterConfigFile gets temporary config file

func SetCliConfigFlag

func SetCliConfigFlag(flagName string, value string) error

SetCliConfigFlag sets cli flag

func SetFeatures

func SetFeatures(cfg *configapi.ClientConfig, paramArray []string, value string) error

SetFeatures sets flags in given ClientConfig

func WaitForNodes

func WaitForNodes(proxy *ClusterProxy, desiredCount int)

WaitForNodes waits for desiredCount number of nodes to be ready

func WaitForNodesDuringScaleUp

func WaitForNodesDuringScaleUp(proxy *ClusterProxy, desiredCount int)

WaitForNodesDuringScaleUp waits for desiredCount number of nodes to be ready

Types

type ClusterProxy

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

ClusterProxy hold information to connect to a cluster

func NewClusterProxy

func NewClusterProxy(name, kubeconfigPath, contextName string) *ClusterProxy

NewClusterProxy returns clusterProxy

func (*ClusterProxy) GetClient

func (p *ClusterProxy) GetClient() client.Client

GetClient gets the Client of a cluster

func (*ClusterProxy) GetClientSet

func (p *ClusterProxy) GetClientSet() *kubernetes.Clientset

GetClientSet gets the ClientSet of a cluster

func (*ClusterProxy) GetCluster

func (p *ClusterProxy) GetCluster(ctx context.Context, clusterName, namespace string) *clusterv1.Cluster

GetCluster gets the v1beta1 cluster object

func (*ClusterProxy) GetClusterClass

func (p *ClusterProxy) GetClusterClass(ctx context.Context, clusterClassName, namespace string) *clusterv1.ClusterClass

GetClusterClass gets the v1beta1 clusterclass object

func (*ClusterProxy) GetClusterNodes

func (p *ClusterProxy) GetClusterNodes() []corev1.Node

GetClusterNodes gets the cluster Nodes

func (*ClusterProxy) GetKubernetesVersion

func (p *ClusterProxy) GetKubernetesVersion() string

GetKubernetesVersion gets the k8s version

func (*ClusterProxy) GetOSImages

func (p *ClusterProxy) GetOSImages(ctx context.Context) []*runv1.OSImage

GetOSImages gets the OSImages available in management cluster

func (*ClusterProxy) GetPackages

func (p *ClusterProxy) GetPackages(ctx context.Context, namespace string) []*kappcontrollerv1alpha1.Package

GetPackages gets the package objects in a namespace

func (*ClusterProxy) GetProviderVersions

func (p *ClusterProxy) GetProviderVersions(ctx context.Context) map[string]string

GetProviderVersions gets the TKG provider versions

func (*ClusterProxy) GetRestConfig

func (p *ClusterProxy) GetRestConfig() *rest.Config

GetRestConfig returns the RestConfig of a cluster

func (*ClusterProxy) GetScheme

func (p *ClusterProxy) GetScheme() *runtime.Scheme

GetScheme returns scheme

func (*ClusterProxy) GetTKRs

GetTKRs gets the TKRs available in management cluster

type CreateClusterOptions

type CreateClusterOptions struct {
	GenerateOnly                bool
	SkipPrompt                  bool
	ControlPlaneMachineCount    int
	WorkerMachineCount          int
	ClusterName                 string
	Plan                        string
	InfrastructureProvider      string
	Namespace                   string
	KubernetesVersion           string
	Size                        string
	ControlPlaneSize            string
	WorkerSize                  string
	CniType                     string
	EnableClusterOptions        string
	VsphereControlPlaneEndpoint string
	Timeout                     time.Duration

	OtherConfigs map[string]string
}

CreateClusterOptions represent options to create a TKG cluster

type E2EConfig

type E2EConfig struct {
	UseExistingCluster       bool                     `json:"use_existing_cluster,omitempty"`
	UpgradeManagementCluster bool                     `json:"upgrade_management_cluster,omitempty"`
	TkgCliLogLevel           int32                    `json:"tkg_cli_log_level,omitempty"`
	InfrastructureName       string                   `json:"infrastructure_name,omitempty"`
	InfrastructureVersion    string                   `json:"infrastructure_version,omitempty"`
	ClusterAPIVersion        string                   `json:"capi_version,omitempty"`
	TkrVersion               string                   `json:"kubernetes_version,omitempty"`
	TkgCliPath               string                   `json:"tkg_cli_path,omitempty"`
	InfrastructureVersionOld string                   `json:"infrastructure_version_old,omitempty"`
	ClusterAPIVersionOld     string                   `json:"capi_version_old,omitempty"`
	KubernetesVersionOld     string                   `json:"kubernetes_version_old,omitempty"`
	TKGSKubeconfigPath       string                   `json:"tkgs_kubeconfig_path,omitempty"`
	TKGSKubeconfigContext    string                   `json:"tkgs_kubeconfig_context,omitempty"`
	TkgCliPathOld            string                   `json:"tkg_cli_path_old,omitempty"`
	DefaultTimeout           string                   `json:"default_timeout,omitempty"`
	TkgConfigDir             string                   `json:"tkg_config_dir,omitempty"`
	TkgClusterConfigPath     string                   `json:"tkg_config_path,omitempty"`
	ManagementClusterName    string                   `json:"management_cluster_name,omitempty"`
	ClusterPrefix            string                   `json:"cluster_prefix,omitempty"`
	TkgConfigVariables       map[string]string        `json:"tkg_config_variables,omitempty"`
	ManagementClusterOptions ManagementClusterOptions `json:"management_cluster_options,omitempty"`
	WorkloadClusterOptions   WorkloadClusterOptions   `json:"workload_cluster_options,omitempty"`
}

E2EConfig represents the configuration for the e2e tests

func LoadE2EConfig

func LoadE2EConfig(ctx context.Context, input E2EConfigInput) *E2EConfig

LoadE2EConfig loads the configuration for the e2e test environment

func (*E2EConfig) Defaults

func (c *E2EConfig) Defaults()

Defaults assign default values to the config if not present

func (*E2EConfig) SaveTkgConfigVariables

func (c *E2EConfig) SaveTkgConfigVariables() error

SaveTkgConfigVariables saves the config variables from e2e config to the TKG config file

func (*E2EConfig) SaveWorkloadClusterOptions

func (c *E2EConfig) SaveWorkloadClusterOptions(clusterConfigFile string) error

SaveWorkloadClusterOptions saves the config variables from E2EConfig.WorkloadClusterOptions config to the given input file path

func (*E2EConfig) Validate

func (c *E2EConfig) Validate() error

Validate validates the configuration in the e2e config file

type E2EConfigInput

type E2EConfigInput struct {
	ConfigPath string
}

E2EConfigInput is the input to E2E test suite

type ManagementClusterOptions

type ManagementClusterOptions struct {
	Endpoint             string `yaml:"endpoint,omitempty"`
	Plan                 string `yaml:"plan,omitempty"`
	Size                 string `yaml:"size,omitempty"`
	DeployTKGonVsphere7  bool   `yaml:"deploy_tkg_on_vSphere7,omitempty"`
	EnableTKGSOnVsphere7 bool   `yaml:"enable_tkgs_on_vSphere7,omitempty"`
}

ManagementClusterOptions represents all options to create a management cluster

type WorkloadClusterOptions

type WorkloadClusterOptions struct {
	ClusterName              string `json:"CLUSTER_NAME,omitempty"`
	Namespace                string `json:"NAMESPACE,omitempty"`
	ClusterPlan              string `json:"CLUSTER_PLAN,omitempty"`
	ClusterCIDR              string `json:"CLUSTER_CIDR,omitempty"`
	ServiceCIDR              string `json:"SERVICE_CIDR,omitempty"`
	InfrastructureProvider   string `json:"INFRASTRUCTURE_PROVIDER,omitempty"`
	OSArch                   string `json:"OS_ARCH,omitempty"`
	OSName                   string `json:"OS_NAME,omitempty"`
	OSVersion                string `json:"OS_VERSION,omitempty"`
	ServiceDomain            string `json:"SERVICE_DOMAIN,omitempty"`
	ControlPlaneStorageClass string `json:"CONTROL_PLANE_STORAGE_CLASS,omitempty"`
	WorkerStorageClass       string `json:"WORKER_STORAGE_CLASS,omitempty"`
	ControlPlaneVMClass      string `json:"CONTROL_PLANE_VM_CLASS,omitempty"`
	WorkerVMClass            string `json:"WORKER_VM_CLASS,omitempty"`
	NodePoolName             string `json:"NODE_POOL_0_NAME,omitempty"`
	ClusterClassFilePath     string `json:"CLUSTER_CLASS_FILE_PATH,omitempty"`
	ClusterClassCBFilePath   string `json:"CLUSTER_CLASS_CB_FILE_PATH,omitempty"`
}

WorkloadClusterOptions represents options to create workload cluster

Directories

Path Synopsis
Package exec implements command execution functionality.
Package exec implements command execution functionality.

Jump to

Keyboard shortcuts

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