@@ -25,10 +25,7 @@ import (
25
25
"net/url"
26
26
"os"
27
27
goruntime "runtime"
28
- "strings"
29
28
30
- "github.com/blang/semver"
31
- "github.com/docker/distribution/reference"
32
29
metal "github.com/equinix-labs/metal-go/metal/v1"
33
30
. "github.com/onsi/ginkgo/v2"
34
31
. "github.com/onsi/gomega"
@@ -45,7 +42,7 @@ import (
45
42
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
46
43
"sigs.k8s.io/cluster-api/test/framework"
47
44
"sigs.k8s.io/cluster-api/test/infrastructure/container"
48
- capiversionutil "sigs.k8s.io/cluster-api/util/version "
45
+ "sigs.k8s.io/controller-runtime/pkg/cache "
49
46
"sigs.k8s.io/controller-runtime/pkg/client"
50
47
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
51
48
)
@@ -124,6 +121,11 @@ func (w *wrappedClusterProxy) GetRESTConfig() *rest.Config {
124
121
return w .clusterProxy .GetRESTConfig ()
125
122
}
126
123
124
+ // GetCache returns a controller-runtime cache to create informer from.
125
+ func (w * wrappedClusterProxy ) GetCache (ctx context.Context ) cache.Cache {
126
+ return w .clusterProxy .GetCache (ctx )
127
+ }
128
+
127
129
// GetLogCollector returns the machine log collector for the Kubernetes cluster.
128
130
func (w * wrappedClusterProxy ) GetLogCollector () framework.ClusterLogCollector {
129
131
return w .clusterProxy .GetLogCollector ()
@@ -366,37 +368,15 @@ func (wc *wrappedClient) RESTMapper() meta.RESTMapper {
366
368
return wc .client .RESTMapper ()
367
369
}
368
370
371
+ // SubResource returns the sub resource this client is using.
372
+ func (wc * wrappedClient ) SubResource (subResource string ) client.SubResourceClient {
373
+ return wc .client .SubResource (subResource )
374
+ }
375
+
369
376
func (wc * wrappedClient ) Scheme () * runtime.Scheme {
370
377
return wc .client .Scheme ()
371
378
}
372
379
373
380
func (wc * wrappedClient ) Status () client.StatusWriter {
374
381
return wc .client .Status ()
375
382
}
376
-
377
- func containerImageGTE (container corev1.Container , version semver.Version ) (bool , error ) {
378
- ref , err := reference .ParseNormalizedNamed (container .Image )
379
- if err != nil {
380
- return false , fmt .Errorf ("failed to parse container reference %s: %w" , container .Image , err )
381
- }
382
-
383
- ref = reference .TagNameOnly (ref )
384
- tagged , _ := ref .(reference.Tagged )
385
- tag := tagged .Tag ()
386
-
387
- if tag == "latest" {
388
- return false , nil
389
- }
390
-
391
- // If the image tag starts with sha-, assume we are running in CI and can assume the version is new enough
392
- if strings .HasPrefix (tag , "sha-" ) {
393
- return false , nil
394
- }
395
-
396
- imageVersion , err := capiversionutil .ParseMajorMinorPatchTolerant (tag )
397
- if err != nil {
398
- return false , fmt .Errorf ("failed to get version from image: %w" , err )
399
- }
400
-
401
- return imageVersion .GTE (version ), nil
402
- }
0 commit comments