cluster-api: Index | Files | Directories

package clusterctl

import ""


Package Files

client.go clusterctl_config.go clusterctl_helpers.go e2e_config.go repository.go


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

func ConfigCluster Uses

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

ConfigCluster gets a workload cluster based on a template.

func CreateRepository Uses

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 Uses

func Init(ctx context.Context, input InitInput)

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

func InitManagementClusterAndWatchControllerLogs Uses

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 Uses

func Move(ctx context.Context, input MoveInput)

Move moves workload clusters.

func SetCNIEnvVar Uses

func SetCNIEnvVar(cniManifestPath string, cniEnvVar string)

SetCNIEnvVar read CNI from cniManifestPath and sets an environmental variable that keeps CNI resources. A ClusterResourceSet can be used to apply CNI using this environmental variable.

type ApplyClusterTemplateAndWaitInput Uses

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

ApplyClusterTemplateAndWaitInput is the input type for ApplyClusterTemplateAndWait.

type ApplyClusterTemplateAndWaitResult Uses

type ApplyClusterTemplateAndWaitResult struct {
    Cluster            *clusterv1.Cluster
    ControlPlane       *controlplanev1.KubeadmControlPlane
    MachineDeployments []*clusterv1.MachineDeployment
    MachinePools       []*clusterv1exp.MachinePool

func ApplyClusterTemplateAndWait Uses

func ApplyClusterTemplateAndWait(ctx context.Context, input ApplyClusterTemplateAndWaitInput) *ApplyClusterTemplateAndWaitResult

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.

type ConfigClusterInput Uses

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 Uses

type CreateRepositoryInput struct {
    RepositoryFolder string
    E2EConfig        *E2EConfig

CreateRepositoryInput is the input for CreateRepository.

type E2EConfig Uses

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 Uses

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

LoadE2EConfig loads the configuration for the e2e test environment.

func (*E2EConfig) AbsPaths Uses

func (c *E2EConfig) AbsPaths(basePath string)

AbsPaths makes relative paths absolute using the give base path.

func (*E2EConfig) Defaults Uses

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) GetInt32PtrVariable Uses

func (c *E2EConfig) GetInt32PtrVariable(varName string) *int32

GetInt32PtrVariable returns an Int32Ptr variable from the e2e config file.

func (*E2EConfig) GetInt64PtrVariable Uses

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

GetInt64PtrVariable returns an Int64Ptr variable from the e2e config file.

func (*E2EConfig) GetIntervals Uses

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 Uses

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

GetVariable returns a variable from the e2e config file.

func (*E2EConfig) HasDockerProvider Uses

func (c *E2EConfig) HasDockerProvider() bool

func (*E2EConfig) InfrastructureProviders Uses

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

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

func (*E2EConfig) Validate Uses

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 Uses

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 Uses

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 Uses

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

InitManagementClusterAndWatchControllerLogsInput is the input type for InitManagementClusterAndWatchControllerLogs.

type LoadE2EConfigInput Uses

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

LoadE2EConfigInput is the input for LoadE2EConfig.

type MoveInput Uses

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

MoveInput is the input for ClusterctlMove.

type ProviderConfig Uses

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.



Package clusterctl imports 27 packages (graph) and is imported by 1 packages. Updated 2020-10-29. Refresh now. Tools for package owners.