e2e

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 57 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Kind       = "kind"
	NamePrefix = "NAMEPREFIX"
)

Variables

This section is empty.

Functions

func AnnotateBmh

func AnnotateBmh(ctx context.Context, client client.Client, host bmov1alpha1.BareMetalHost, key string, value *string)

AnnotateBmh annotates BaremetalHost with a given key and value.

func BmhNameToVMName added in v1.5.0

func BmhNameToVMName(hostname string) string

func BmhToVMName

func BmhToVMName(host bmov1alpha1.BareMetalHost) string

Derives the name of a VM created by metal3-dev-env from the name of a BareMetalHost object.

func BuildAndApplyKustomization added in v1.6.3

func BuildAndApplyKustomization(ctx context.Context, input *BuildAndApplyKustomizationInput) error

BuildAndApplyKustomization takes input from BuildAndApplyKustomizationInput. It builds the provided kustomization and apply it to the cluster provided by clusterProxy.

func BuildAndRemoveKustomization added in v1.6.3

func BuildAndRemoveKustomization(ctx context.Context, kustomization string, clusterProxy framework.ClusterProxy) error

BuildAndRemoveKustomization builds the provided kustomization to resources and removes them from the cluster provided by clusterProxy.

func Byf

func Byf(format string, a ...interface{})

func CreateNewM3MachineTemplate added in v1.8.0

func CreateNewM3MachineTemplate(ctx context.Context, namespace string, newM3MachineTemplateName string, m3MachineTemplateName string, clusterClient client.Client, imageURL string, imageChecksum string)

func CreateOrUpdateWithNamespace added in v1.8.0

func CreateOrUpdateWithNamespace(ctx context.Context, p framework.ClusterProxy, resources []byte, namespace string) error

CreateOrUpdateWithNamespace creates or updates objects using the clusterProxy client with specific namespace.

func DeleteNodeReuseLabelFromHost

func DeleteNodeReuseLabelFromHost(ctx context.Context, client client.Client, host bmov1alpha1.BareMetalHost, nodeReuseLabelName string)

DeleteNodeReuseLabelFromHost deletes nodeReuseLabelName from the host if it exists.

func DeployControlplaneHealthCheck added in v1.6.0

func DeployControlplaneHealthCheck(ctx context.Context, cli client.Client, namespace, clusterName string) (*clusterv1.MachineHealthCheck, error)

DeployControlplaneHealthCheck creates a MachineHealthcheck and Metal3RemediationTemplate for controlplane machines.

func DeployMachineHealthCheck added in v1.6.0

func DeployMachineHealthCheck(ctx context.Context, cli client.Client, namespace, clusterName, remediationTemplateName, healthCheckName string, matchLabels map[string]string) (*clusterv1.MachineHealthCheck, error)

DeployMachineHealthCheck creates a MachineHealthcheck and Metal3RemediationTemplate with given values.

func DeployWorkerHealthCheck added in v1.6.0

func DeployWorkerHealthCheck(ctx context.Context, cli client.Client, namespace, clusterName string) (*clusterv1.MachineHealthCheck, error)

DeployWorkerHealthCheck creates a MachineHealthcheck and Metal3RemediationTemplate for worker machines.

func DeploymentRolledOut

func DeploymentRolledOut(ctx context.Context, clientSet *kubernetes.Clientset, name string, namespace string, desiredGeneration int64) bool

func DownloadFile

func DownloadFile(filePath string, url string) error

DownloadFile will download a url and store it in local filepath.

func DumpSpecResourcesAndCleanup

func DumpSpecResourcesAndCleanup(ctx context.Context, specName string, clusterProxy framework.ClusterProxy, artifactFolder string, namespace string, intervalsGetter func(spec, key string) []interface{}, clusterName, clusterctlLogFolder string, skipCleanup bool)

func EnsureImage

func EnsureImage(k8sVersion string) (imageURL string, imageChecksum string)

func FilterBmhsByProvisioningState

func FilterBmhsByProvisioningState(bmhs []bmov1alpha1.BareMetalHost, state bmov1alpha1.ProvisioningState) (result []bmov1alpha1.BareMetalHost)

FilterBmhsByProvisioningState returns a filtered list of BaremetalHost objects in certain provisioning state.

func FilterMachines

func FilterMachines(machines []clusterv1.Machine, accept func(clusterv1.Machine) bool) (result []clusterv1.Machine)

FilterMachines returns a filtered list of Machines that were accepted by the accept function.

func FilterMachinesByPhase

func FilterMachinesByPhase(machines []clusterv1.Machine, phase clusterv1.MachinePhase) (result []clusterv1.Machine)

FilterMachinesByPhase returns a filtered list of CAPI machine objects in certain desired phase.

func FilterMetal3DatasByName added in v1.5.0

func FilterMetal3DatasByName(m3datas []infrav1.Metal3Data, name string) (result []infrav1.Metal3Data)

FilterMetal3DatasByName returns a filtered list of m3data objects with specific name.

func FilterMetal3MachinesByName added in v1.5.0

func FilterMetal3MachinesByName(m3ms []infrav1.Metal3Machine, name string) (result []infrav1.Metal3Machine)

FilterMetal3MachinesByName returns a filtered list of m3machine objects with specific name.

func FilterNodeCondition

func FilterNodeCondition(conditions []corev1.NodeCondition, conditionType corev1.NodeConditionType) []corev1.NodeCondition

FilterNodeCondition will filter the slice of NodeConditions so that only the given conditionType remains and return the resulting slice.

func GenerateIPPoolPreallocations added in v1.5.0

func GenerateIPPoolPreallocations(ctx context.Context, ippool ipamv1.IPPool, poolName string, c client.Client) (map[string]ipamv1.IPAddressStr, error)

GenerateIPPoolPreallocations fetches the current allocated IPs from an IPPool and returns a new map concatenating BMH and IPPool names as a key and an IPAddress as a value.

func GetAllBmhs

func GetAllBmhs(ctx context.Context, c client.Client, namespace string) ([]bmov1alpha1.BareMetalHost, error)

func GetCAPM3StableReleaseOfMinor added in v1.7.0

func GetCAPM3StableReleaseOfMinor(ctx context.Context, minorRelease string) (string, error)

GetCAPM3StableReleaseOfMinor returns latest stable version of minorRelease.

func GetIPPools added in v1.5.0

func GetIPPools(ctx context.Context, c client.Client, _, namespace string) ([]ipamv1.IPPool, []ipamv1.IPPool)

GetIPPools return baremetal and provisioning IPPools.

func GetLatestPatchRelease added in v1.7.2

func GetLatestPatchRelease(goProxyPath string, minorReleaseVersion string) (string, error)

GetLatestPatchRelease returns latest patch release against minor release.

func GetMachine

func GetMachine(ctx context.Context, c client.Client, name client.ObjectKey) (result clusterv1.Machine)

Get the machine object given its object name.

func GetMetal3Machines

func GetMetal3Machines(ctx context.Context, c client.Client, _, namespace string) ([]infrav1.Metal3Machine, []infrav1.Metal3Machine)

func IPReuse added in v1.5.0

func IPReuse(ctx context.Context, inputGetter func() IPReuseInput)

func KubectlDelete added in v1.6.3

func KubectlDelete(ctx context.Context, kubeconfigPath string, resources []byte, args ...string) error

KubectlDelete shells out to kubectl delete.

func LabelCRD added in v1.6.0

func LabelCRD(ctx context.Context, c client.Client, crdName string, labels map[string]string) error

LabelCRD is adding the specified labels to the CRD crdName. Existing labels with matching keys will be overwritten.

func ListBareMetalHosts

func ListBareMetalHosts(ctx context.Context, c client.Client, opts ...client.ListOption)

ListBareMetalHosts logs the names, provisioning status, consumer and power status of all BareMetalHosts matching the opts. Similar to kubectl get baremetalhosts.

func ListMachines

func ListMachines(ctx context.Context, c client.Client, opts ...client.ListOption)

ListMachines logs the names, status phase, provider ID and Kubernetes version of all Machines in the namespace. Similar to kubectl get machines.

func ListMetal3Machines

func ListMetal3Machines(ctx context.Context, c client.Client, opts ...client.ListOption)

ListMetal3Machines logs the names, ready status and provider ID of all Metal3Machines in the namespace. Similar to kubectl get metal3machines.

func ListNodes

func ListNodes(ctx context.Context, c client.Client)

ListNodes logs the names, status and Kubernetes version of all Nodes. Similar to kubectl get nodes.

func LogFromFile

func LogFromFile(logFile string)

func Logf

func Logf(format string, a ...interface{})

func MachineToIPAddress added in v1.5.0

func MachineToIPAddress(ctx context.Context, cli client.Client, m *clusterv1.Machine, ippool ipamv1.IPPool) (string, error)

MachineTiIPAddress gets IPAddress based on machine, from machine -> m3machine -> m3data -> IPAddress.

func MachineToVMName added in v1.5.0

func MachineToVMName(ctx context.Context, cli client.Client, m *clusterv1.Machine) (string, error)

func Metal3DataToMachineName added in v1.5.0

func Metal3DataToMachineName(m3data infrav1.Metal3Data) (string, error)

Metal3DataToMachineName finds the relevant owner reference in Metal3Data and returns the name of corresponding Metal3Machine.

func Metal3MachineToBmhName

func Metal3MachineToBmhName(m3machine infrav1.Metal3Machine) string

func Metal3MachineToMachineName

func Metal3MachineToMachineName(m3machine infrav1.Metal3Machine) (string, error)

Metal3MachineToMachineName finds the relevant owner reference in Metal3Machine and returns the name of corresponding Machine.

func RemoveDeployment added in v1.5.0

func RemoveDeployment(ctx context.Context, inputGetter func() RemoveDeploymentInput)

func ScaleKubeadmControlPlane

func ScaleKubeadmControlPlane(ctx context.Context, c client.Client, name client.ObjectKey, newReplicaCount int)

ScaleKubeadmControlPlane scales up/down KubeadmControlPlane object to desired replicas.

func ScaleMachineDeployment

func ScaleMachineDeployment(ctx context.Context, clusterClient client.Client, clusterName, namespace string, newReplicas int)

ScaleMachineDeployment scales up/down MachineDeployment object to desired replicas.

func WaitForHealthCheckCurrentHealthyToMatch added in v1.6.0

func WaitForHealthCheckCurrentHealthyToMatch(ctx context.Context, cli client.Client, number int32, healthcheck *clusterv1.MachineHealthCheck, timeout, frequency time.Duration)

WaitForHealthCheckCurrentHealthyToMatch waits for current healthy machines watched by healthcheck to match the number given.

func WaitForNumBmhInState

func WaitForNumBmhInState(ctx context.Context, state bmov1alpha1.ProvisioningState, input WaitForNumInput)

WaitForNumBmhInState will wait for the given number of BMHs to be in the given state.

func WaitForNumMachines

func WaitForNumMachines(ctx context.Context, accept func(clusterv1.Machine) bool, input WaitForNumInput)

WaitForNumMachines will wait for the given number of Machines to be accepted by the accept function. This is a more generic function than WaitForNumMachinesInState. It can be used to wait for any condition, e.g. that the Kubernetes version is correct.

func WaitForNumMachinesInState

func WaitForNumMachinesInState(ctx context.Context, phase clusterv1.MachinePhase, input WaitForNumInput)

WaitForNumMachinesInState will wait for the given number of Machines to be in the given state.

func WaitForNumMetal3MachinesReady

func WaitForNumMetal3MachinesReady(ctx context.Context, input WaitForNumInput)

WaitForNumMetal3MachinesReady will wait for the given number of M3Ms to be ready.

func WaitForRemediationRequest added in v1.6.0

func WaitForRemediationRequest(ctx context.Context, cli client.Client, healthcheckName types.NamespacedName, toExist bool, timeout, frequency time.Duration)

WaitForRemediationRequest waits until a remediation request created with healthcheck either exists or is deleted.

Types

type BuildAndApplyKustomizationInput added in v1.6.3

type BuildAndApplyKustomizationInput struct {
	// Path to the kustomization to build
	Kustomization string

	ClusterProxy framework.ClusterProxy

	// If this is set to true. Perform a wait until the deployment specified by
	// DeploymentName and DeploymentNamespace is available or WaitIntervals is timed out
	WaitForDeployment bool

	// If this is set to true. Set up a log watcher for the deployment specified by
	// DeploymentName and DeploymentNamespace
	WatchDeploymentLogs bool

	// DeploymentName and DeploymentNamespace specified a deployment that will be waited and/or logged
	DeploymentName      string
	DeploymentNamespace string

	// Path to store the deployment logs
	LogPath string

	// Intervals to use in checking and waiting for the deployment
	WaitIntervals []interface{}
}

BuildAndApplyKustomizationInput provides input for BuildAndApplyKustomize(). If WaitForDeployment and/or WatchDeploymentLogs is set to true, then DeploymentName and DeploymentNamespace are expected.

type CertRotationInput

type CertRotationInput struct {
	E2EConfig         *clusterctl.E2EConfig
	ManagementCluster framework.ClusterProxy
	SpecName          string
}

type HealthCheckInput added in v1.6.0

type HealthCheckInput struct {
	BootstrapClusterProxy framework.ClusterProxy
	ClusterName           string
	Namespace             string
}

type IPReuseInput added in v1.5.0

type IPReuseInput struct {
	E2EConfig             *clusterctl.E2EConfig
	BootstrapClusterProxy framework.ClusterProxy
	TargetCluster         framework.ClusterProxy
	SpecName              string
	ClusterName           string
	Namespace             string
}

type InspectionInput

type InspectionInput struct {
	E2EConfig             *clusterctl.E2EConfig
	ClusterctlConfigPath  string
	BootstrapClusterProxy framework.ClusterProxy
	Namespace             string
	SpecName              string
}

type Metal3LogCollector added in v1.5.0

type Metal3LogCollector struct{}

func (Metal3LogCollector) CollectInfrastructureLogs added in v1.5.0

func (Metal3LogCollector) CollectInfrastructureLogs(_ context.Context, _ client.Client, _ *clusterv1.Cluster, _ string) error

func (Metal3LogCollector) CollectMachineLog added in v1.5.0

func (Metal3LogCollector) CollectMachineLog(ctx context.Context, cli client.Client, m *clusterv1.Machine, outputPath string) error

CollectMachineLog collects specific logs from machines.

func (Metal3LogCollector) CollectMachinePoolLog added in v1.5.0

func (Metal3LogCollector) CollectMachinePoolLog(_ context.Context, _ client.Client, _ *expv1.MachinePool, _ string) error

type NodeRemediation added in v1.8.0

type NodeRemediation struct {
	E2EConfig             *clusterctl.E2EConfig
	BootstrapClusterProxy framework.ClusterProxy
	TargetCluster         framework.ClusterProxy
	SpecName              string
	ClusterName           string
	Namespace             string
}

type NodeReuseInput

type NodeReuseInput struct {
	E2EConfig         *clusterctl.E2EConfig
	ManagementCluster framework.ClusterProxy
	TargetCluster     framework.ClusterProxy
	SpecName          string
	ClusterName       string
	Namespace         string
}

type PivotingInput

type PivotingInput struct {
	E2EConfig             *clusterctl.E2EConfig
	BootstrapClusterProxy framework.ClusterProxy
	TargetCluster         framework.ClusterProxy
	SpecName              string
	ClusterName           string
	Namespace             string
	ArtifactFolder        string
	ClusterctlConfigPath  string
}

type RePivotingInput

type RePivotingInput struct {
	E2EConfig             *clusterctl.E2EConfig
	BootstrapClusterProxy framework.ClusterProxy
	TargetCluster         framework.ClusterProxy
	SpecName              string
	ClusterName           string
	Namespace             string
	ArtifactFolder        string
	ClusterctlConfigPath  string
}

type RemediationInput

type RemediationInput struct {
	E2EConfig             *clusterctl.E2EConfig
	BootstrapClusterProxy framework.ClusterProxy
	TargetCluster         framework.ClusterProxy
	SpecName              string
	ClusterName           string
	Namespace             string
	ClusterctlConfigPath  string
}

type RemoveDeploymentInput added in v1.5.0

type RemoveDeploymentInput struct {
	ManagementCluster framework.ClusterProxy
	Namespace         string
	Name              string
}

type RemoveIronicInput

type RemoveIronicInput struct {
	ManagementCluster framework.ClusterProxy
	IsDeployment      bool
	Namespace         string
	NamePrefix        string
}

type WaitForNumInput

type WaitForNumInput struct {
	Client    client.Client
	Options   []client.ListOption
	Replicas  int
	Intervals []interface{}
}

Jump to

Keyboard shortcuts

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