diff --git a/test/e2e/cluster_upgrade.go b/test/e2e/cluster_upgrade.go index 3631818277d6..d8a8aacfc2ea 100644 --- a/test/e2e/cluster_upgrade.go +++ b/test/e2e/cluster_upgrade.go @@ -41,6 +41,9 @@ type ClusterUpgradeConformanceSpecInput struct { ArtifactFolder string SkipCleanup bool SkipConformanceTests bool + + // Flavor to use when creating the cluster for testing, "upgrades" is used if not specified. + Flavor *string } // ClusterUpgradeConformanceSpec implements a spec that upgrades a cluster and runs the Kubernetes conformance suite. @@ -95,7 +98,7 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust ClusterctlConfigPath: input.ClusterctlConfigPath, KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(), InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, - Flavor: "upgrades", + Flavor: pointer.StringDeref(input.Flavor, "upgrades"), Namespace: namespace.Name, ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)), KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeFrom), diff --git a/test/e2e/clusterctl_upgrade.go b/test/e2e/clusterctl_upgrade.go index 7ff3eb4d73bf..209383c07518 100644 --- a/test/e2e/clusterctl_upgrade.go +++ b/test/e2e/clusterctl_upgrade.go @@ -59,6 +59,8 @@ type ClusterctlUpgradeSpecInput struct { SkipCleanup bool PreUpgrade func(managementClusterProxy framework.ClusterProxy) PostUpgrade func(managementClusterProxy framework.ClusterProxy) + MgmtFlavor string + WorkloadFlavor string } // ClusterctlUpgradeSpec implements a test that verifies clusterctl upgrade of a management cluster. @@ -110,7 +112,7 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg ClusterctlConfigPath: input.ClusterctlConfigPath, KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(), InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, - Flavor: clusterctl.DefaultFlavor, + Flavor: input.MgmtFlavor, Namespace: managementClusterNamespace.Name, ClusterName: managementClusterName, KubernetesVersion: input.E2EConfig.GetVariable(initWithKubernetesVersion), @@ -195,7 +197,7 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg // pass the clusterctl config file that points to the local provider repository created for this test, ClusterctlConfigPath: input.ClusterctlConfigPath, // select template - Flavor: clusterctl.DefaultFlavor, + Flavor: input.WorkloadFlavor, // define template variables Namespace: testNamespace.Name, ClusterName: workLoadClusterName, diff --git a/test/e2e/k8s_conformance.go b/test/e2e/k8s_conformance.go index 8ff0772fd184..ce085f981af9 100644 --- a/test/e2e/k8s_conformance.go +++ b/test/e2e/k8s_conformance.go @@ -41,6 +41,7 @@ type K8SConformanceSpecInput struct { BootstrapClusterProxy framework.ClusterProxy ArtifactFolder string SkipCleanup bool + Flavor string } // K8SConformanceSpec implements a spec that creates a cluster and runs Kubernetes conformance suite. @@ -89,7 +90,7 @@ func K8SConformanceSpec(ctx context.Context, inputGetter func() K8SConformanceSp ClusterctlConfigPath: input.ClusterctlConfigPath, KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(), InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, - Flavor: clusterctl.DefaultFlavor, + Flavor: input.Flavor, Namespace: namespace.Name, ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)), KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion), diff --git a/test/e2e/kcp_adoption.go b/test/e2e/kcp_adoption.go index 3b85f594a9e0..ac45f871849a 100644 --- a/test/e2e/kcp_adoption.go +++ b/test/e2e/kcp_adoption.go @@ -47,6 +47,18 @@ type KCPAdoptionSpecInput struct { BootstrapClusterProxy framework.ClusterProxy ArtifactFolder string SkipCleanup bool + + // Flavor, if specified, must refer to a template that is + // specially crafted with individual control plane machines + // and a KubeadmControlPlane resource configured for adoption. + // The initial Cluster, InfraCluster, Machine, InfraMachine, + // KubeadmConfig, and any other resources that should exist + // prior to adoption must have the kcp-adoption.step1: "" label + // applied to them. The updated Cluster (with controlPlaneRef + // configured), InfraMachineTemplate, and KubeadmControlPlane + // resources must have the kcp-adoption.step2: "" applied to them. + // If not specified, "kcp-adoption" is used. + Flavor *string } type ClusterProxy interface { @@ -96,7 +108,7 @@ func KCPAdoptionSpec(ctx context.Context, inputGetter func() KCPAdoptionSpecInpu // pass the clusterctl config file that points to the local provider repository created for this test, ClusterctlConfigPath: input.ClusterctlConfigPath, // select template - Flavor: "kcp-adoption", + Flavor: pointer.StringDeref(input.Flavor, "kcp-adoption"), // define template variables Namespace: namespace.Name, ClusterName: clusterName, diff --git a/test/e2e/machine_pool.go b/test/e2e/machine_pool.go index 002e6a36d962..cc7ac18bfc6b 100644 --- a/test/e2e/machine_pool.go +++ b/test/e2e/machine_pool.go @@ -42,6 +42,10 @@ type MachinePoolInput struct { BootstrapClusterProxy framework.ClusterProxy ArtifactFolder string SkipCleanup bool + + // Flavor, if specified must refer to a template that contains a MachinePool resource. + // If not specified, "machine-pool" is used + Flavor *string } // MachinePoolSpec implements a test that verifies MachinePool create, scale up and scale down. @@ -79,7 +83,7 @@ func MachinePoolSpec(ctx context.Context, inputGetter func() MachinePoolInput) { ClusterctlConfigPath: input.ClusterctlConfigPath, KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(), InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, - Flavor: "machine-pool", + Flavor: pointer.StringDeref(input.Flavor, "machine-pool"), Namespace: namespace.Name, ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)), KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeFrom), diff --git a/test/e2e/md_rollout.go b/test/e2e/md_rollout.go index 1366647b950d..188228e5681e 100644 --- a/test/e2e/md_rollout.go +++ b/test/e2e/md_rollout.go @@ -40,6 +40,7 @@ type MachineDeploymentRolloutSpecInput struct { BootstrapClusterProxy framework.ClusterProxy ArtifactFolder string SkipCleanup bool + Flavor string } // MachineDeploymentRolloutSpec implements a test that verifies that MachineDeployment rolling updates are successful. @@ -78,7 +79,7 @@ func MachineDeploymentRolloutSpec(ctx context.Context, inputGetter func() Machin ClusterctlConfigPath: input.ClusterctlConfigPath, KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(), InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, - Flavor: clusterctl.DefaultFlavor, + Flavor: input.Flavor, Namespace: namespace.Name, ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)), KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeFrom), diff --git a/test/e2e/md_scale.go b/test/e2e/md_scale.go index f6d9850b1ce9..97c02264bc4d 100644 --- a/test/e2e/md_scale.go +++ b/test/e2e/md_scale.go @@ -39,6 +39,7 @@ type MachineDeploymentScaleSpecInput struct { BootstrapClusterProxy framework.ClusterProxy ArtifactFolder string SkipCleanup bool + Flavor string } // MachineDeploymentScaleSpec implements a test that verifies that MachineDeployment scale operations are successful. @@ -68,6 +69,7 @@ func MachineDeploymentScaleSpec(ctx context.Context, inputGetter func() MachineD It("Should successfully scale a MachineDeployment up and down upon changes to the MachineDeployment replica count", func() { By("Creating a workload cluster") + clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{ ClusterProxy: input.BootstrapClusterProxy, ConfigCluster: clusterctl.ConfigClusterInput{ @@ -75,7 +77,7 @@ func MachineDeploymentScaleSpec(ctx context.Context, inputGetter func() MachineD ClusterctlConfigPath: input.ClusterctlConfigPath, KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(), InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, - Flavor: clusterctl.DefaultFlavor, + Flavor: input.Flavor, Namespace: namespace.Name, ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)), KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion), diff --git a/test/e2e/mhc_remediations.go b/test/e2e/mhc_remediations.go index 481d90f36118..0f56136feaf2 100644 --- a/test/e2e/mhc_remediations.go +++ b/test/e2e/mhc_remediations.go @@ -40,6 +40,20 @@ type MachineRemediationSpecInput struct { BootstrapClusterProxy framework.ClusterProxy ArtifactFolder string SkipCleanup bool + + // KCPFlavor, if specified, must refer to a template that has a MachineHealthCheck + // resource configured to match the control plane Machines (cluster.x-k8s.io/controlplane: "" label) + // and be configured to treat "e2e.remediation.condition" "False" as an unhealthy + // condition with a short timeout. + // If not specified, "kcp-remediation" is used. + KCPFlavor *string + + // MDFlavor, if specified, must refer to a template that has a MachineHealthCheck + // resource configured to match the MachineDeployment managed Machines and be + // configured to treat "e2e.remediation.condition" "False" as an unhealthy + // condition with a short timeout. + // If not specified, "md-remediation" is used. + MDFlavor *string } // MachineRemediationSpec implements a test that verifies that Machines are remediated by MHC during unhealthy conditions. @@ -76,7 +90,7 @@ func MachineRemediationSpec(ctx context.Context, inputGetter func() MachineRemed ClusterctlConfigPath: input.ClusterctlConfigPath, KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(), InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, - Flavor: "md-remediation", + Flavor: pointer.StringDeref(input.MDFlavor, "md-remediation"), Namespace: namespace.Name, ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)), KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion), @@ -108,7 +122,7 @@ func MachineRemediationSpec(ctx context.Context, inputGetter func() MachineRemed ClusterctlConfigPath: input.ClusterctlConfigPath, KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(), InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, - Flavor: "kcp-remediation", + Flavor: pointer.StringDeref(input.KCPFlavor, "kcp-remediation"), Namespace: namespace.Name, ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)), KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion), diff --git a/test/e2e/node_drain_timeout.go b/test/e2e/node_drain_timeout.go index 879e0c9552d0..bfd83f79ed76 100644 --- a/test/e2e/node_drain_timeout.go +++ b/test/e2e/node_drain_timeout.go @@ -44,6 +44,13 @@ type NodeDrainTimeoutSpecInput struct { BootstrapClusterProxy framework.ClusterProxy ArtifactFolder string SkipCleanup bool + + // Flavor, if specified, must refer to a template that contains + // a KubeadmControlPlane resource with spec.machineTemplate.nodeDrainTimeout + // configured and a MachineDeployment resource that has + // spec.template.spec.nodeDrainTimeout configured. + // If not specified, "node-drain" is used. + Flavor *string } func NodeDrainTimeoutSpec(ctx context.Context, inputGetter func() NodeDrainTimeoutSpecInput) { @@ -83,7 +90,7 @@ func NodeDrainTimeoutSpec(ctx context.Context, inputGetter func() NodeDrainTimeo ClusterctlConfigPath: input.ClusterctlConfigPath, KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(), InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, - Flavor: "node-drain", + Flavor: pointer.StringDeref(input.Flavor, "node-drain"), Namespace: namespace.Name, ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)), KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion), diff --git a/test/e2e/quick_start.go b/test/e2e/quick_start.go index f09f409604ec..9b0ce1b1c2d8 100644 --- a/test/e2e/quick_start.go +++ b/test/e2e/quick_start.go @@ -40,6 +40,11 @@ type QuickStartSpecInput struct { BootstrapClusterProxy framework.ClusterProxy ArtifactFolder string SkipCleanup bool + + // Flavor, if specified is the template flavor used to create the cluster for testing. + // If not specified, and the e2econfig variable IPFamily is IPV6, then "ipv6" is used, + // otherwise the default flavor is used. + Flavor *string } // QuickStartSpec implements a spec that mimics the operation described in the Cluster API quick start, that is @@ -72,9 +77,9 @@ func QuickStartSpec(ctx context.Context, inputGetter func() QuickStartSpecInput) It("Should create a workload cluster", func() { By("Creating a workload cluster") - flavor := clusterctl.DefaultFlavor + defaultFlavor := clusterctl.DefaultFlavor if input.E2EConfig.GetVariable(IPFamily) == "IPv6" { - flavor = "ipv6" + defaultFlavor = "ipv6" } clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{ @@ -84,7 +89,7 @@ func QuickStartSpec(ctx context.Context, inputGetter func() QuickStartSpecInput) ClusterctlConfigPath: input.ClusterctlConfigPath, KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(), InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, - Flavor: flavor, + Flavor: pointer.StringDeref(input.Flavor, defaultFlavor), Namespace: namespace.Name, ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)), KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion), diff --git a/test/e2e/self_hosted.go b/test/e2e/self_hosted.go index bd356e35e8fa..8f728c077684 100644 --- a/test/e2e/self_hosted.go +++ b/test/e2e/self_hosted.go @@ -43,6 +43,7 @@ type SelfHostedSpecInput struct { BootstrapClusterProxy framework.ClusterProxy ArtifactFolder string SkipCleanup bool + Flavor string } // SelfHostedSpec implements a test that verifies Cluster API creating a cluster, pivoting to a self-hosted cluster. @@ -84,7 +85,7 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput) ClusterctlConfigPath: input.ClusterctlConfigPath, KubeconfigPath: input.BootstrapClusterProxy.GetKubeconfigPath(), InfrastructureProvider: clusterctl.DefaultInfrastructureProvider, - Flavor: clusterctl.DefaultFlavor, + Flavor: input.Flavor, Namespace: namespace.Name, ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)), KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion),