clusterctl

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 24 Imported by: 16

Documentation

Index

Constants

View Source
const (
	// DefaultFlavor for ConfigClusterInput; use it for getting the cluster-template.yaml file.
	DefaultFlavor = ""
)
View Source
const (
	// DefaultInfrastructureProvider for ConfigClusterInput; use it for using the only infrastructure provider installed in a cluster.
	DefaultInfrastructureProvider = ""
)

Variables

This section is empty.

Functions

func ApplyClusterTemplateAndWait

ApplyClusterTemplateAndWait gets a cluster template using clusterctl, and waits for the cluster to be ready. Important! this method assumes the cluster uses a KubeadmControlPlane and MachineDeployments.

func ConfigCluster

func ConfigCluster(ctx context.Context, input ConfigClusterInput) []byte

ConfigCluster gets a workload cluster based on a template.

func CreateRepository

func CreateRepository(ctx context.Context, input CreateRepositoryInput) string

CreateRepository creates a clusterctl local repository based on the e2e test config, and the returns the path to a clusterctl config file to be used for working with such repository.

func Init

func Init(ctx context.Context, input InitInput)

Init calls clusterctl init with the list of providers defined in the local repository

func InitManagementClusterAndWatchControllerLogs

func InitManagementClusterAndWatchControllerLogs(ctx context.Context, input InitManagementClusterAndWatchControllerLogsInput, intervals ...interface{})

InitManagementClusterAndWatchControllerLogs initializes a management using clusterctl and setup watches for controller logs. Important: Considering we want to support test suites using existing clusters, clusterctl init is executed only in case there are no provider controllers in the cluster; but controller logs watchers are created regardless of the pre-existing providers.

func Move

func Move(ctx context.Context, input MoveInput)

Move moves workload clusters.

Types

type ApplyClusterTemplateAndWaitInput

type ApplyClusterTemplateAndWaitInput struct {
	ClusterProxy                 framework.ClusterProxy
	ConfigCluster                ConfigClusterInput
	CNIManifestPath              string
	WaitForClusterIntervals      []interface{}
	WaitForControlPlaneIntervals []interface{}
	WaitForMachineDeployments    []interface{}
}

ApplyClusterTemplateAndWaitInput is the input type for ApplyClusterTemplateAndWait.

type ConfigClusterInput

type ConfigClusterInput struct {
	LogFolder                string
	ClusterctlConfigPath     string
	KubeconfigPath           string
	InfrastructureProvider   string
	Namespace                string
	ClusterName              string
	KubernetesVersion        string
	ControlPlaneMachineCount *int64
	WorkerMachineCount       *int64
	Flavor                   string
}

ConfigClusterInput is the input for ConfigCluster.

type CreateRepositoryInput

type CreateRepositoryInput struct {
	RepositoryFolder string
	E2EConfig        *E2EConfig
}

CreateRepositoryInput is the input for CreateRepository.

type E2EConfig

type E2EConfig struct {
	// Name is the name of the Kind management cluster.
	// Defaults to test-[random generated suffix].
	ManagementClusterName string `json:"managementClusterName,omitempty"`

	// Images is a list of container images to load into the Kind cluster.
	Images []framework.ContainerImage `json:"images,omitempty"`

	// Providers is a list of providers to be configured in the local repository that will be created for the e2e test.
	// It is required to provide following providers
	// - cluster-api
	// - bootstrap kubeadm
	// - control-plane kubeadm
	// - one infrastructure provider
	// The test will adapt to the selected infrastructure provider
	Providers []ProviderConfig `json:"providers,omitempty"`

	// Variables to be added to the clusterctl config file
	// Please note that clusterctl read variables from OS environment variables as well, so you can avoid to hard code
	// sensitive data in the config file.
	Variables map[string]string `json:"variables,omitempty"`

	// Intervals to be used for long operations during tests
	Intervals map[string][]string `json:"intervals,omitempty"`
}

E2EConfig defines the configuration of an e2e test environment.

func LoadE2EConfig

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

LoadE2EConfig loads the configuration for the e2e test environment.

func (*E2EConfig) AbsPaths

func (c *E2EConfig) AbsPaths(basePath string)

AbsPaths makes relative paths absolute using the give base path.

func (*E2EConfig) Defaults

func (c *E2EConfig) Defaults()

Defaults assigns default values to the object. More specifically: - ManagementClusterName gets a default name if empty. - Providers version gets type KustomizeSource if not otherwise specified. - Providers file gets targetName = sourceName if not otherwise specified. - Images gets LoadBehavior = MustLoadImage if not otherwise specified.

func (*E2EConfig) GetInt64PtrVariable

func (c *E2EConfig) GetInt64PtrVariable(varName string) *int64

GetVariable returns an Int64Ptr variable from the e2e config file.

func (*E2EConfig) GetIntervals

func (c *E2EConfig) GetIntervals(spec, key string) []interface{}

GetIntervals returns the intervals to be applied to a Eventually operation. It searches for [spec]/[key] intervals first, and if it is not found, it searches for default/[key]. If also the default/[key] intervals are not found, ginkgo DefaultEventuallyTimeout and DefaultEventuallyPollingInterval are used.

func (*E2EConfig) GetVariable

func (c *E2EConfig) GetVariable(varName string) string

GetVariable returns a variable from the e2e config file.

func (*E2EConfig) HasDockerProvider

func (c *E2EConfig) HasDockerProvider() bool

func (*E2EConfig) InfrastructureProviders

func (c *E2EConfig) InfrastructureProviders() []string

InfraProvider returns the infrastructure provider selected for running this E2E test.

func (*E2EConfig) Validate

func (c *E2EConfig) Validate() error

Validate validates the configuration. More specifically: - ManagementClusterName should not be empty. - There should be one CoreProvider (cluster-api), one BootstrapProvider (kubeadm), one ControlPlaneProvider (kubeadm). - There should be one InfraProvider (pick your own). - Image should have name and loadBehavior be one of [mustload, tryload]. - Intervals should be valid ginkgo intervals.

type Files

type Files struct {
	// SourcePath path of the file.
	SourcePath string `json:"sourcePath"`

	// TargetName name of the file copied into the local repository. if empty, the source name
	// Will be preserved
	TargetName string `json:"targetName,omitempty"`
}

Files contains information about files to be copied into the local repository

type InitInput

type InitInput struct {
	LogFolder               string
	ClusterctlConfigPath    string
	KubeconfigPath          string
	CoreProvider            string
	BootstrapProviders      []string
	ControlPlaneProviders   []string
	InfrastructureProviders []string
}

InitInput is the input for Init.

type InitManagementClusterAndWatchControllerLogsInput

type InitManagementClusterAndWatchControllerLogsInput struct {
	ClusterProxy            framework.ClusterProxy
	ClusterctlConfigPath    string
	InfrastructureProviders []string
	LogFolder               string
}

InitManagementClusterAndWatchControllerLogsInput is the input type for InitManagementClusterAndWatchControllerLogs.

type LoadE2EConfigInput

type LoadE2EConfigInput struct {
	// ConfigPath for the e2e test.
	ConfigPath string
}

LoadE2EConfigInput is the input for LoadE2EConfig.

type MoveInput

type MoveInput struct {
	LogFolder            string
	ClusterctlConfigPath string
	FromKubeconfigPath   string
	ToKubeconfigPath     string
	Namespace            string
}

MoveInput is the input for ClusterctlMove.

type ProviderConfig

type ProviderConfig struct {
	// Name is the name of the provider.
	Name string `json:"name"`

	// Type is the type of the provider.
	Type string `json:"type"`

	// Versions is a list of component YAML to be added to the local repository, one for each release.
	// Please note that the first source will be used a a default release for this provider.
	Versions []framework.ComponentSource `json:"versions,omitempty"`

	// Files is a list of test files to be copied into the local repository for the default release of this provider.
	Files []Files `json:"files,omitempty"`
}

ProviderConfig describes a provider to be configured in the local repository that will be created for the e2e test.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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