diff --git a/test/e2e/capi_e2e_test.go b/test/e2e/capi_e2e_test.go index 510d2c00..54937368 100644 --- a/test/e2e/capi_e2e_test.go +++ b/test/e2e/capi_e2e_test.go @@ -41,8 +41,8 @@ var _ = Describe("[General] Running the Cluster API E2E tests", func() { // - capi_e2e.MachineDeploymentRolloutSpec Context("Running the mhc-remediation spec", func() { - capi_e2e.MachineRemediationSpec(ctx, func() capi_e2e.MachineRemediationSpecInput { - return capi_e2e.MachineRemediationSpecInput{ + capi_e2e.MachineDeploymentRemediationSpec(ctx, func() capi_e2e.MachineDeploymentRemediationSpecInput { + return capi_e2e.MachineDeploymentRemediationSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, BootstrapClusterProxy: bootstrapClusterProxy, diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 9691ac66..d55b0ab8 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -25,10 +25,7 @@ import ( "net/url" "os" goruntime "runtime" - "strings" - "github.com/blang/semver" - "github.com/docker/distribution/reference" metal "github.com/equinix-labs/metal-go/metal/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -45,7 +42,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/infrastructure/container" - capiversionutil "sigs.k8s.io/cluster-api/util/version" + "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/apiutil" ) @@ -124,6 +121,11 @@ func (w *wrappedClusterProxy) GetRESTConfig() *rest.Config { return w.clusterProxy.GetRESTConfig() } +// GetCache returns a controller-runtime cache to create informer from. +func (w *wrappedClusterProxy) GetCache(ctx context.Context) cache.Cache { + return w.clusterProxy.GetCache(ctx) +} + // GetLogCollector returns the machine log collector for the Kubernetes cluster. func (w *wrappedClusterProxy) GetLogCollector() framework.ClusterLogCollector { return w.clusterProxy.GetLogCollector() @@ -366,6 +368,11 @@ func (wc *wrappedClient) RESTMapper() meta.RESTMapper { return wc.client.RESTMapper() } +// SubResource returns the sub resource this client is using. +func (wc *wrappedClient) SubResource(subResource string) client.SubResourceClient { + return wc.client.SubResource(subResource) +} + func (wc *wrappedClient) Scheme() *runtime.Scheme { return wc.client.Scheme() } @@ -373,30 +380,3 @@ func (wc *wrappedClient) Scheme() *runtime.Scheme { func (wc *wrappedClient) Status() client.StatusWriter { return wc.client.Status() } - -func containerImageGTE(container corev1.Container, version semver.Version) (bool, error) { - ref, err := reference.ParseNormalizedNamed(container.Image) - if err != nil { - return false, fmt.Errorf("failed to parse container reference %s: %w", container.Image, err) - } - - ref = reference.TagNameOnly(ref) - tagged, _ := ref.(reference.Tagged) - tag := tagged.Tag() - - if tag == "latest" { - return false, nil - } - - // If the image tag starts with sha-, assume we are running in CI and can assume the version is new enough - if strings.HasPrefix(tag, "sha-") { - return false, nil - } - - imageVersion, err := capiversionutil.ParseMajorMinorPatchTolerant(tag) - if err != nil { - return false, fmt.Errorf("failed to get version from image: %w", err) - } - - return imageVersion.GTE(version), nil -}