diff --git a/Makefile b/Makefile index eb5b5680d..6d5eaeeb1 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,6 @@ MODULE := $(shell head -1 go.mod | cut -d' ' -f2) ARTIFACTS := _out TEST_PKGS ?= ./... TALOS_RELEASE ?= v1.4.0-beta.0 -PREVIOUS_TALOS_RELEASE ?= v0.13.4 DEFAULT_K8S_VERSION ?= v1.26.0 TOOLS ?= ghcr.io/siderolabs/tools:v1.4.0 @@ -172,7 +171,6 @@ run-sfyra: talos-artifacts clusterctl-release ## Run Sfyra integration test. @ARTIFACTS=$(ARTIFACTS) \ CLUSTERCTL_CONFIG=$(SFYRA_CLUSTERCTL_CONFIG) \ TALOS_RELEASE=$(TALOS_RELEASE) \ - PREVIOUS_TALOS_RELEASE=$(PREVIOUS_TALOS_RELEASE) \ ./hack/scripts/integration-test.sh # Development diff --git a/hack/scripts/integration-test.sh b/hack/scripts/integration-test.sh index 1c9b5041c..3684db22d 100755 --- a/hack/scripts/integration-test.sh +++ b/hack/scripts/integration-test.sh @@ -36,15 +36,9 @@ else PREFIX= fi -COMPATIBILITY_TESTS_ARGS= - -if [[ ! -z "${PREVIOUS_TALOS_RELEASE}" ]]; then - COMPATIBILITY_TESTS_ARGS="--prev-talos-release=${PREVIOUS_TALOS_RELEASE}" -fi - ${PREFIX} "${INTEGRATION_TEST}" test integration \ --talosctl-path "${TALOSCTL}" \ --clusterctl-config "${CLUSTERCTL_CONFIG}" \ --power-simulated-explicit-failure-prob=0.1 \ --power-simulated-silent-failure-prob=0.0 \ - ${COMPATIBILITY_TESTS_ARGS} ${REGISTRY_MIRROR_FLAGS} ${SFYRA_EXTRA_FLAGS} + ${REGISTRY_MIRROR_FLAGS} ${SFYRA_EXTRA_FLAGS} diff --git a/sfyra/cmd/sfyra/cmd/options.go b/sfyra/cmd/sfyra/cmd/options.go index 45ff9dfab..a3ec45210 100644 --- a/sfyra/cmd/sfyra/cmd/options.go +++ b/sfyra/cmd/sfyra/cmd/options.go @@ -42,8 +42,7 @@ type Options struct { DefaultBootOrder string - TalosctlPath string - PrevTalosRelease string + TalosctlPath string PowerSimulatedExplicitFailureProb float64 PowerSimulatedSilentFailureProb float64 diff --git a/sfyra/cmd/sfyra/cmd/test_integration.go b/sfyra/cmd/sfyra/cmd/test_integration.go index 8e76644d2..48bc7ac8a 100644 --- a/sfyra/cmd/sfyra/cmd/test_integration.go +++ b/sfyra/cmd/sfyra/cmd/test_integration.go @@ -112,7 +112,6 @@ var testIntegrationCmd = &cobra.Command{ RunTestPattern: runTestPattern, TalosRelease: TalosRelease, - PrevTalosRelease: options.PrevTalosRelease, KubernetesVersion: KubernetesVersion, }); !ok { return fmt.Errorf("test failure") @@ -145,5 +144,4 @@ func init() { testIntegrationCmd.Flags().Float64Var(&options.PowerSimulatedExplicitFailureProb, "power-simulated-explicit-failure-prob", options.PowerSimulatedExplicitFailureProb, "simulated power management explicit failure probability") testIntegrationCmd.Flags().Float64Var(&options.PowerSimulatedSilentFailureProb, "power-simulated-silent-failure-prob", options.PowerSimulatedSilentFailureProb, "simulated power management silent failure probability") testIntegrationCmd.Flags().StringVar(&runTestPattern, "test.run", "", "tests to run (regular expression)") - testIntegrationCmd.Flags().StringVar(&options.PrevTalosRelease, "prev-talos-release", options.PrevTalosRelease, "Talos version to run compatibility tests against") } diff --git a/sfyra/pkg/tests/cluster_utils.go b/sfyra/pkg/tests/cluster_utils.go index fe8aac74b..88e5b3231 100644 --- a/sfyra/pkg/tests/cluster_utils.go +++ b/sfyra/pkg/tests/cluster_utils.go @@ -31,29 +31,12 @@ import ( "github.com/siderolabs/sidero/sfyra/pkg/vm" ) -type clusterOptions struct { - configURL string -} - -type clusterOption func(o *clusterOptions) - -func withConfigURL(value string) clusterOption { - return func(o *clusterOptions) { - o.configURL = value - } -} - // createCluster without waiting for it to become ready. func createCluster(ctx context.Context, t *testing.T, metalClient client.Client, capiCluster talos.Cluster, vmSet *vm.Set, - capiManager *capi.Manager, clusterName, serverClassName string, loadbalancerPort int, controlPlaneNodes, workerNodes int64, talosVersion, kubernetesVersion string, options ...clusterOption, + capiManager *capi.Manager, clusterName, serverClassName string, loadbalancerPort int, controlPlaneNodes, workerNodes int64, talosVersion, kubernetesVersion string, ) *loadbalancer.ControlPlane { t.Logf("deploying cluster %q from server class %q with loadbalancer port %d", clusterName, serverClassName, loadbalancerPort) - var opts clusterOptions - for _, o := range options { - o(&opts) - } - kubeconfig, err := capiManager.GetKubeconfig(ctx) require.NoError(t, err) @@ -80,12 +63,6 @@ func createCluster(ctx context.Context, t *testing.T, metalClient client.Client, WorkerMachineCount: &workerNodes, } - if opts.configURL != "" { - templateOptions.URLSource = &capiclient.URLSourceOptions{ - URL: opts.configURL, - } - } - template, err := capiClient.GetClusterTemplate(templateOptions) require.NoError(t, err) @@ -157,9 +134,9 @@ func waitForClusterReady(ctx context.Context, t *testing.T, metalClient client.C } func deployCluster(ctx context.Context, t *testing.T, metalClient client.Client, capiCluster talos.Cluster, vmSet *vm.Set, - capiManager *capi.Manager, clusterName, serverClassName string, loadbalancerPort int, controlPlaneNodes, workerNodes int64, talosVersion, kubernetesVersion string, options ...clusterOption, + capiManager *capi.Manager, clusterName, serverClassName string, loadbalancerPort int, controlPlaneNodes, workerNodes int64, talosVersion, kubernetesVersion string, ) *loadbalancer.ControlPlane { - loadbalancer := createCluster(ctx, t, metalClient, capiCluster, vmSet, capiManager, clusterName, serverClassName, loadbalancerPort, controlPlaneNodes, workerNodes, talosVersion, kubernetesVersion, options...) + loadbalancer := createCluster(ctx, t, metalClient, capiCluster, vmSet, capiManager, clusterName, serverClassName, loadbalancerPort, controlPlaneNodes, workerNodes, talosVersion, kubernetesVersion) waitForClusterReady(ctx, t, metalClient, vmSet, clusterName) diff --git a/sfyra/pkg/tests/compatibility.go b/sfyra/pkg/tests/compatibility.go deleted file mode 100644 index 1924a1789..000000000 --- a/sfyra/pkg/tests/compatibility.go +++ /dev/null @@ -1,119 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -package tests - -import ( - "context" - "fmt" - "os" - "path/filepath" - "strings" - "testing" - "time" - - v1 "k8s.io/api/core/v1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/client" - - "github.com/siderolabs/go-procfs/procfs" - "github.com/siderolabs/go-retry/retry" - "github.com/siderolabs/talos/pkg/machinery/kernel" - "github.com/stretchr/testify/require" - - metalv1 "github.com/siderolabs/sidero/app/sidero-controller-manager/api/v1alpha2" - "github.com/siderolabs/sidero/sfyra/pkg/capi" - "github.com/siderolabs/sidero/sfyra/pkg/constants" - "github.com/siderolabs/sidero/sfyra/pkg/talos" - "github.com/siderolabs/sidero/sfyra/pkg/vm" -) - -const ( - compatibilityClusterName = "compatibility-cluster" - compatibilityClusterLBPort = 10003 -) - -// TestCompatibilityCluster deploys the compatibility cluster via CAPI. -func TestCompatibilityCluster(ctx context.Context, metalClient client.Client, cluster talos.Cluster, vmSet *vm.Set, capiManager *capi.Manager, talosRelease, kubernetesVersion string) TestFunc { - return func(t *testing.T) { - if talosRelease == "" { - t.Skip("--prev-talos-release is not set, skipped compatibility check") - } - - var environment metalv1.Environment - - envName := fmt.Sprintf("talos-%s", strings.ReplaceAll(talosRelease, ".", "-")) - - if err := metalClient.Get(ctx, types.NamespacedName{Name: envName}, &environment); err != nil { - if !apierrors.IsNotFound(err) { - require.NoError(t, err) - } - - cmdline := procfs.NewCmdline("") - cmdline.SetAll(kernel.DefaultArgs) - - cmdline.Append("console", "ttyS0") - cmdline.Append("talos.platform", "metal") - - environment.APIVersion = constants.SideroAPIVersion - environment.Name = envName - environment.Spec.Kernel.URL = fmt.Sprintf("https://github.com/siderolabs/talos/releases/download/%s/vmlinuz-amd64", talosRelease) - environment.Spec.Kernel.SHA512 = "" - environment.Spec.Kernel.Args = cmdline.Strings() - environment.Spec.Initrd.URL = fmt.Sprintf("https://github.com/siderolabs/talos/releases/download/%s/initramfs-amd64.xz", talosRelease) - environment.Spec.Initrd.SHA512 = "" - - require.NoError(t, metalClient.Create(ctx, &environment)) - } - - // wait for the environment to report ready - require.NoError(t, retry.Constant(5*time.Minute, retry.WithUnits(10*time.Second)).Retry(func() error { - if err := metalClient.Get(ctx, types.NamespacedName{Name: envName}, &environment); err != nil { - return err - } - - if !environment.IsReady() { - return retry.ExpectedErrorf("some assets are not ready") - } - - return nil - })) - - serverClassName := envName - classSpec := metalv1.ServerClassSpec{ - Qualifiers: metalv1.Qualifiers{ - Hardware: []metalv1.HardwareInformation{ - { - Compute: &metalv1.ComputeInformation{ - Processors: []*metalv1.Processor{ - { - Manufacturer: "QEMU", - }, - }, - }, - }, - }, - }, - EnvironmentRef: &v1.ObjectReference{ - Name: envName, - }, - } - - _, err := createServerClass(ctx, metalClient, serverClassName, classSpec) - require.NoError(t, err) - - ex, err := os.Executable() - require.NoError(t, err) - - exPath := filepath.Dir(ex) - - loadbalancer := deployCluster(ctx, t, metalClient, cluster, vmSet, capiManager, compatibilityClusterName, serverClassName, compatibilityClusterLBPort, 1, 0, talosRelease, kubernetesVersion, - withConfigURL(fmt.Sprintf("file://%s/../templates/cluster-template-talos-%s.yaml", exPath, talosRelease)), - ) - - deleteCluster(ctx, t, metalClient, compatibilityClusterName) - loadbalancer.Close() //nolint:errcheck - } -} diff --git a/sfyra/pkg/tests/tests.go b/sfyra/pkg/tests/tests.go index 541d7f07b..6d344e91e 100644 --- a/sfyra/pkg/tests/tests.go +++ b/sfyra/pkg/tests/tests.go @@ -28,7 +28,6 @@ type Options struct { RunTestPattern string TalosRelease string - PrevTalosRelease string KubernetesVersion string } @@ -98,10 +97,6 @@ func Run(ctx context.Context, cluster talos.Cluster, vmSet *vm.Set, capiManager "TestServerClassPatch", TestServerClassPatch(ctx, metalClient, cluster, capiManager), }, - { - "TestCompatibilityCluster", - TestCompatibilityCluster(ctx, metalClient, cluster, vmSet, capiManager, options.PrevTalosRelease, "v1.22.12"), - }, { "TestServerPXEBoot", TestServerPXEBoot(ctx, metalClient, cluster, vmSet, capiManager, options.TalosRelease, options.KubernetesVersion), diff --git a/templates/cluster-template-talos-v0.13.4.yaml b/templates/cluster-template-talos-v0.13.4.yaml deleted file mode 100644 index f6c010e67..000000000 --- a/templates/cluster-template-talos-v0.13.4.yaml +++ /dev/null @@ -1,107 +0,0 @@ -# this is cluster template for Talos <= v0.13 -# which is used to test backward compatibility -apiVersion: cluster.x-k8s.io/v1beta1 -kind: Cluster -metadata: - name: ${CLUSTER_NAME} -spec: - clusterNetwork: - pods: - cidrBlocks: - - 10.244.0.0/16 - services: - cidrBlocks: - - 10.96.0.0/12 - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 - kind: MetalCluster - name: ${CLUSTER_NAME} - controlPlaneRef: - apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 - kind: TalosControlPlane - name: ${CLUSTER_NAME}-cp ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 -kind: MetalCluster -metadata: - name: ${CLUSTER_NAME} -spec: - controlPlaneEndpoint: - host: ${CONTROL_PLANE_ENDPOINT} - port: ${CONTROL_PLANE_PORT} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 -kind: MetalMachineTemplate -metadata: - name: ${CLUSTER_NAME}-cp -spec: - template: - spec: - serverClassRef: - apiVersion: metal.sidero.dev/v1alpha2 - kind: ServerClass - name: ${CONTROL_PLANE_SERVERCLASS} ---- -apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 -kind: TalosControlPlane -metadata: - name: ${CLUSTER_NAME}-cp -spec: - version: ${KUBERNETES_VERSION} - replicas: ${CONTROL_PLANE_MACHINE_COUNT} - infrastructureTemplate: - kind: MetalMachineTemplate - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 - name: ${CLUSTER_NAME}-cp - controlPlaneConfig: - init: - generateType: init - talosVersion: ${TALOS_VERSION} - controlplane: - generateType: controlplane - talosVersion: ${TALOS_VERSION} ---- -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 -kind: TalosConfigTemplate -metadata: - name: ${CLUSTER_NAME}-workers -spec: - template: - spec: - generateType: join - talosVersion: ${TALOS_VERSION} ---- -apiVersion: cluster.x-k8s.io/v1beta1 -kind: MachineDeployment -metadata: - name: ${CLUSTER_NAME}-workers -spec: - clusterName: ${CLUSTER_NAME} - replicas: ${WORKER_MACHINE_COUNT} - selector: - matchLabels: null - template: - spec: - version: ${KUBERNETES_VERSION} - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 - kind: TalosConfigTemplate - name: ${CLUSTER_NAME}-workers - clusterName: ${CLUSTER_NAME} - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 - kind: MetalMachineTemplate - name: ${CLUSTER_NAME}-workers ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 -kind: MetalMachineTemplate -metadata: - name: ${CLUSTER_NAME}-workers -spec: - template: - spec: - serverClassRef: - apiVersion: metal.sidero.dev/v1alpha2 - kind: ServerClass - name: ${WORKER_SERVERCLASS}