From 4063573e1b34c129b3e8782249f2644884e99fa5 Mon Sep 17 00:00:00 2001 From: muhammad adil ghaffar Date: Thu, 22 Feb 2024 15:06:48 +0200 Subject: [PATCH] Bumping CAPI to v1.6.2 and syncing go modues with CAPI Signed-off-by: muhammad adil ghaffar --- README.md | 4 +- api/go.mod | 4 +- api/go.sum | 8 +- api/v1beta1/metal3machine_webhook_test.go | 4 +- .../metal3machinetemplate_webhook_test.go | 4 +- baremetal/metal3cluster_manager_test.go | 4 +- baremetal/metal3data_manager.go | 12 +- baremetal/metal3data_manager_test.go | 138 +++++++++--------- baremetal/metal3datatemplate_manager.go | 10 +- baremetal/metal3machine_manager.go | 12 +- baremetal/metal3machine_manager_test.go | 38 ++--- .../metal3machinetemplate_manager_test.go | 28 ++-- baremetal/utils_test.go | 8 +- controllers/metal3cluster_controller.go | 4 +- controllers/metal3machine_controller.go | 4 +- ...tal3machine_controller_integration_test.go | 12 +- controllers/metal3machine_controller_test.go | 6 +- .../metal3machinetemplate_controller_test.go | 10 +- go.mod | 4 +- go.sum | 8 +- test/e2e/common.go | 4 +- test/e2e/inspection.go | 4 +- test/e2e/live_iso_test.go | 4 +- test/e2e/remediation.go | 8 +- test/e2e/upgrade_clusterctl_test.go | 38 ++--- test/go.mod | 6 +- test/go.sum | 12 +- 27 files changed, 199 insertions(+), 199 deletions(-) diff --git a/README.md b/README.md index a04aa16549..931eb77781 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ need to be manually installed. Example flow of installing Metal3 provider: level of the logging verbose with a positive integer number, ie. -v5. ```shell - clusterctl init --core cluster-api:v1.6.1 --bootstrap kubeadm:v1.6.1 \ - --control-plane kubeadm:v1.6.1 -v5 + clusterctl init --core cluster-api:v1.6.2 --bootstrap kubeadm:v1.6.2 \ + --control-plane kubeadm:v1.6.2 -v5 ``` 1. Install Metal3 provider. This will install the latest version of Cluster API diff --git a/api/go.mod b/api/go.mod index d38ed3d3ac..ff7255a8b4 100644 --- a/api/go.mod +++ b/api/go.mod @@ -11,8 +11,8 @@ require ( k8s.io/api v0.29.2 k8s.io/apimachinery v0.29.2 k8s.io/client-go v0.29.2 - k8s.io/utils v0.0.0-20230726121419-3b25d923346b - sigs.k8s.io/cluster-api v1.6.1 + k8s.io/utils v0.0.0-20231127182322-b307cd553661 + sigs.k8s.io/cluster-api v1.6.2 sigs.k8s.io/controller-runtime v0.17.2 ) diff --git a/api/go.sum b/api/go.sum index 2c8f69c42a..b598445f56 100644 --- a/api/go.sum +++ b/api/go.sum @@ -195,10 +195,10 @@ k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/cluster-api v1.6.1 h1:I34p/fwgRlEhs+o9cUhKXDwNNfPS3no0yJsd2bJyQVc= -sigs.k8s.io/cluster-api v1.6.1/go.mod h1:DaxwruDvSaEYq5q6FREDaGzX6UsAVUCA99Sp8vfMHyQ= +k8s.io/utils v0.0.0-20231127182322-b307cd553661 h1:FepOBzJ0GXm8t0su67ln2wAZjbQ6RxQGZDnzuLcrUTI= +k8s.io/utils v0.0.0-20231127182322-b307cd553661/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/cluster-api v1.6.2 h1:ruUi4q/9jXFuI+hmnDjo9izHgrBk4bjfQXLKx678PQE= +sigs.k8s.io/cluster-api v1.6.2/go.mod h1:Anm4cA6R/AIP6KdIuVje8CdFc/TdGl+382bi5oPawRc= sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= sigs.k8s.io/controller-runtime v0.17.2/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= diff --git a/api/v1beta1/metal3machine_webhook_test.go b/api/v1beta1/metal3machine_webhook_test.go index ddd9de91c9..a605f4a476 100644 --- a/api/v1beta1/metal3machine_webhook_test.go +++ b/api/v1beta1/metal3machine_webhook_test.go @@ -18,7 +18,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" ) func TestMetal3MachineDefault(_ *testing.T) { @@ -52,7 +52,7 @@ func TestMetal3MachineValidation(t *testing.T) { validIso := valid.DeepCopy() validIso.Spec.Image.Checksum = "" - validIso.Spec.Image.DiskFormat = pointer.String(LiveISODiskFormat) + validIso.Spec.Image.DiskFormat = ptr.To(LiveISODiskFormat) tests := []struct { name string diff --git a/api/v1beta1/metal3machinetemplate_webhook_test.go b/api/v1beta1/metal3machinetemplate_webhook_test.go index 03525ceae0..5cde47b867 100644 --- a/api/v1beta1/metal3machinetemplate_webhook_test.go +++ b/api/v1beta1/metal3machinetemplate_webhook_test.go @@ -18,7 +18,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" ) func TestMetal3MachineTemplateDefault(_ *testing.T) { @@ -56,7 +56,7 @@ func TestMetal3MachineTemplateValidation(t *testing.T) { validIso := valid.DeepCopy() validIso.Spec.Template.Spec.Image.Checksum = "" - validIso.Spec.Template.Spec.Image.DiskFormat = pointer.String(LiveISODiskFormat) + validIso.Spec.Template.Spec.Image.DiskFormat = ptr.To(LiveISODiskFormat) tests := []struct { name string diff --git a/baremetal/metal3cluster_manager_test.go b/baremetal/metal3cluster_manager_test.go index f9c6619eeb..fb783bb7eb 100644 --- a/baremetal/metal3cluster_manager_test.go +++ b/baremetal/metal3cluster_manager_test.go @@ -25,7 +25,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" _ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" capierrors "sigs.k8s.io/cluster-api/errors" "sigs.k8s.io/controller-runtime/pkg/client" @@ -167,7 +167,7 @@ var _ = Describe("Metal3Cluster manager", func() { Cluster: newCluster(clusterName), BMCluster: newMetal3Cluster(metal3ClusterName, bmcOwnerRef, nil, &infrav1.Metal3ClusterStatus{ - FailureMessage: pointer.String("cba"), + FailureMessage: ptr.To("cba"), }, ), }), diff --git a/baremetal/metal3data_manager.go b/baremetal/metal3data_manager.go index 8b1946751b..3853ab6e80 100644 --- a/baremetal/metal3data_manager.go +++ b/baremetal/metal3data_manager.go @@ -34,7 +34,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" caipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1alpha1" "sigs.k8s.io/cluster-api/util" @@ -249,7 +249,7 @@ func (m *DataManager) createSecrets(ctx context.Context) error { // Create the owner Ref for the secret ownerRefs := []metav1.OwnerReference{ { - Controller: pointer.Bool(true), + Controller: ptr.To(true), APIVersion: m.Data.APIVersion, Kind: m.Data.Kind, Name: m.Data.Name, @@ -432,7 +432,7 @@ type poolRefs map[string]corev1.TypedLocalObjectReference // It returns an error if a reference with the same name but a different group or kind already exists. func (p poolRefs) addRef(ref corev1.TypedLocalObjectReference) error { if ref.APIGroup == nil || *ref.APIGroup == "" { - ref.APIGroup = pointer.String("ipam.metal3.io") + ref.APIGroup = ptr.To("ipam.metal3.io") } if ref.Kind == "" { ref.Kind = "IPPool" @@ -453,7 +453,7 @@ func (p poolRefs) addRef(ref corev1.TypedLocalObjectReference) error { // addFromPool adds a pool reference from a [FromPool] value. func (p poolRefs) addFromPool(pool infrav1.FromPool) error { - return p.addRef(corev1.TypedLocalObjectReference{Name: pool.Name, APIGroup: pointer.String(pool.APIGroup), Kind: pool.Kind}) + return p.addRef(corev1.TypedLocalObjectReference{Name: pool.Name, APIGroup: ptr.To(pool.APIGroup), Kind: pool.Kind}) } // addName adds a reference to a metal3 pool using just its name. @@ -612,7 +612,7 @@ func (m *DataManager) m3IPClaimObjectMeta(name, poolRefName string, preallocatio Kind: m.Data.Kind, Name: m.Data.Name, UID: m.Data.UID, - Controller: pointer.Bool(true), + Controller: ptr.To(true), }, }, Labels: m.Data.Labels, @@ -845,7 +845,7 @@ func (m *DataManager) ensureIPClaim(ctx context.Context, poolRef corev1.TypedLoc Kind: m.Data.Kind, Name: m.Data.Name, UID: m.Data.UID, - Controller: pointer.BoolPtr(true), + Controller: ptr.To(true), }, }, Labels: m.Data.Labels, diff --git a/baremetal/metal3data_manager_test.go b/baremetal/metal3data_manager_test.go index 05ace535b9..c705522666 100644 --- a/baremetal/metal3data_manager_test.go +++ b/baremetal/metal3data_manager_test.go @@ -32,7 +32,7 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" caipamv1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/client" @@ -132,7 +132,7 @@ var _ = Describe("Metal3Data manager", func() { m3d: &infrav1.Metal3Data{ Spec: infrav1.Metal3DataSpec{}, Status: infrav1.Metal3DataStatus{ - ErrorMessage: pointer.String("Error Happened"), + ErrorMessage: ptr.To("Error Happened"), }, }, }), @@ -351,7 +351,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "eth0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - String: pointer.String("12:34:56:78:9A:BC"), + String: ptr.To("12:34:56:78:9A:BC"), }, }, }, @@ -382,8 +382,8 @@ var _ = Describe("Metal3Data manager", func() { }, }, expectReady: true, - expectedMetadata: pointer.String("Hello"), - expectedNetworkData: pointer.String("Bye"), + expectedMetadata: ptr.To("Hello"), + expectedNetworkData: ptr.To("Bye"), }), Entry("secrets do not exist", testCaseCreateSecrets{ m3d: &infrav1.Metal3Data{ @@ -412,7 +412,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "eth0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - String: pointer.String("12:34:56:78:9A:BC"), + String: ptr.To("12:34:56:78:9A:BC"), }, }, }, @@ -451,8 +451,8 @@ var _ = Describe("Metal3Data manager", func() { ObjectMeta: testObjectMeta(baremetalhostName, namespaceName, bmhuid), }, expectReady: true, - expectedMetadata: pointer.String(fmt.Sprintf("String-1: String-1\nproviderid: %s\n", providerid)), - expectedNetworkData: pointer.String("links:\n- ethernet_mac_address: 12:34:56:78:9A:BC\n id: eth0\n mtu: 1500\n type: phy\nnetworks: []\nservices: []\n"), + expectedMetadata: ptr.To(fmt.Sprintf("String-1: String-1\nproviderid: %s\n", providerid)), + expectedNetworkData: ptr.To("links:\n- ethernet_mac_address: 12:34:56:78:9A:BC\n id: eth0\n mtu: 1500\n type: phy\nnetworks: []\nservices: []\n"), }), Entry("No Machine OwnerRef on M3M", testCaseCreateSecrets{ m3d: &infrav1.Metal3Data{ @@ -481,7 +481,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "eth0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - String: pointer.String("12:34:56:78:9A:BC"), + String: ptr.To("12:34:56:78:9A:BC"), }, }, }, @@ -528,7 +528,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "eth0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - String: pointer.String("12:34:56:78:9A:BC"), + String: ptr.To("12:34:56:78:9A:BC"), }, }, }, @@ -648,7 +648,7 @@ var _ = Describe("Metal3Data manager", func() { Spec: caipamv1.IPAddressClaimSpec{ PoolRef: corev1.TypedLocalObjectReference{ Name: "abc", - APIGroup: pointer.String("ipam.cluster.x-k8s.io"), + APIGroup: ptr.To("ipam.cluster.x-k8s.io"), Kind: "TestPool", }, }, @@ -724,7 +724,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev4{ { Gateway: infrav1.NetworkGatewayv4{ - FromIPPool: pointer.String("abcd-5"), + FromIPPool: ptr.To("abcd-5"), }, }, }, @@ -736,7 +736,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev6{ { Gateway: infrav1.NetworkGatewayv6{ - FromIPPool: pointer.String("abcd-7"), + FromIPPool: ptr.To("abcd-7"), }, }, }, @@ -747,7 +747,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev4{ { Gateway: infrav1.NetworkGatewayv4{ - FromIPPool: pointer.String("abcd-8"), + FromIPPool: ptr.To("abcd-8"), }, }, }, @@ -758,7 +758,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev6{ { Gateway: infrav1.NetworkGatewayv6{ - FromIPPool: pointer.String("abcd-9"), + FromIPPool: ptr.To("abcd-9"), }, }, }, @@ -769,7 +769,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev6{ { Gateway: infrav1.NetworkGatewayv6{ - FromIPPool: pointer.String("abcd-10"), + FromIPPool: ptr.To("abcd-10"), }, }, }, @@ -854,7 +854,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev4{ { Gateway: infrav1.NetworkGatewayv4{ - FromIPPool: pointer.String("abcd-2"), + FromIPPool: ptr.To("abcd-2"), }, }, }, @@ -880,7 +880,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev6{ { Gateway: infrav1.NetworkGatewayv6{ - FromIPPool: pointer.String("abcd-2"), + FromIPPool: ptr.To("abcd-2"), }, }, }, @@ -905,7 +905,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev4{ { Gateway: infrav1.NetworkGatewayv4{ - FromIPPool: pointer.String("abcd"), + FromIPPool: ptr.To("abcd"), }, }, }, @@ -929,7 +929,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev6{ { Gateway: infrav1.NetworkGatewayv6{ - FromIPPool: pointer.String("abcd"), + FromIPPool: ptr.To("abcd"), }, }, }, @@ -953,7 +953,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev6{ { Gateway: infrav1.NetworkGatewayv6{ - FromIPPool: pointer.String("abcd"), + FromIPPool: ptr.To("abcd"), }, }, }, @@ -976,7 +976,7 @@ var _ = Describe("Metal3Data manager", func() { { FromPoolRef: &corev1.TypedLocalObjectReference{ Name: "test", - APIGroup: pointer.String("ipam.cluster.x-k8s.io"), + APIGroup: ptr.To("ipam.cluster.x-k8s.io"), Kind: "TestPool", }, }, @@ -985,7 +985,7 @@ var _ = Describe("Metal3Data manager", func() { { FromPoolRef: &corev1.TypedLocalObjectReference{ Name: "test-2", - APIGroup: pointer.String("ipam.cluster.x-k8s.io"), + APIGroup: ptr.To("ipam.cluster.x-k8s.io"), Kind: "TestPool", }, }, @@ -1029,7 +1029,7 @@ var _ = Describe("Metal3Data manager", func() { }, Spec: caipamv1.IPAddressClaimSpec{ PoolRef: corev1.TypedLocalObjectReference{ - APIGroup: pointer.String("ipam.cluster.x-k8s.io"), + APIGroup: ptr.To("ipam.cluster.x-k8s.io"), Kind: "TestPool", Name: "test", }, @@ -1117,7 +1117,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev4{ { Gateway: infrav1.NetworkGatewayv4{ - FromIPPool: pointer.String("abcd-5"), + FromIPPool: ptr.To("abcd-5"), }, }, }, @@ -1129,7 +1129,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev6{ { Gateway: infrav1.NetworkGatewayv6{ - FromIPPool: pointer.String("abcd-7"), + FromIPPool: ptr.To("abcd-7"), }, }, }, @@ -1140,7 +1140,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev4{ { Gateway: infrav1.NetworkGatewayv4{ - FromIPPool: pointer.String("abcd-8"), + FromIPPool: ptr.To("abcd-8"), }, }, }, @@ -1151,7 +1151,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev6{ { Gateway: infrav1.NetworkGatewayv6{ - FromIPPool: pointer.String("abcd-9"), + FromIPPool: ptr.To("abcd-9"), }, }, }, @@ -1162,7 +1162,7 @@ var _ = Describe("Metal3Data manager", func() { Routes: []infrav1.NetworkDataRoutev6{ { Gateway: infrav1.NetworkGatewayv6{ - FromIPPool: pointer.String("abcd-10"), + FromIPPool: ptr.To("abcd-10"), }, }, }, @@ -1191,12 +1191,12 @@ var _ = Describe("Metal3Data manager", func() { Networks: infrav1.NetworkDataNetwork{ IPv4: []infrav1.NetworkDataIPv4{ { - FromPoolRef: &corev1.TypedLocalObjectReference{APIGroup: pointer.String("ipam.cluster.x-k8s.io"), Kind: "TestPool", Name: "v4"}, + FromPoolRef: &corev1.TypedLocalObjectReference{APIGroup: ptr.To("ipam.cluster.x-k8s.io"), Kind: "TestPool", Name: "v4"}, }, }, IPv6: []infrav1.NetworkDataIPv6{ { - FromPoolRef: &corev1.TypedLocalObjectReference{APIGroup: pointer.String("ipam.cluster.x-k8s.io"), Kind: "TestPool", Name: "v6"}, + FromPoolRef: &corev1.TypedLocalObjectReference{APIGroup: ptr.To("ipam.cluster.x-k8s.io"), Kind: "TestPool", Name: "v6"}, }, }, }, @@ -1325,7 +1325,7 @@ var _ = Describe("Metal3Data manager", func() { Spec: ipamv1.IPAddressSpec{ Address: ipamv1.IPAddressStr("192.168.0.10"), Prefix: 26, - Gateway: (*ipamv1.IPAddressStr)(pointer.String("192.168.0.1")), + Gateway: (*ipamv1.IPAddressStr)(ptr.To("192.168.0.1")), DNSServers: []ipamv1.IPAddressStr{ "8.8.8.8", }, @@ -1374,7 +1374,7 @@ var _ = Describe("Metal3Data manager", func() { Spec: ipamv1.IPAddressSpec{ Address: ipamv1.IPAddressStr("192.168.0.10"), Prefix: 26, - Gateway: (*ipamv1.IPAddressStr)(pointer.String("192.168.0.1")), + Gateway: (*ipamv1.IPAddressStr)(ptr.To("192.168.0.1")), DNSServers: []ipamv1.IPAddressStr{ "8.8.8.8", }, @@ -1432,7 +1432,7 @@ var _ = Describe("Metal3Data manager", func() { }, }, Status: ipamv1.IPClaimStatus{ - ErrorMessage: pointer.String("Error happened"), + ErrorMessage: ptr.To("Error happened"), }, }, expectError: true, @@ -1505,7 +1505,7 @@ var _ = Describe("Metal3Data manager", func() { Spec: ipamv1.IPAddressSpec{ Address: ipamv1.IPAddressStr("192.168.0.10"), Prefix: 26, - Gateway: (*ipamv1.IPAddressStr)(pointer.String("192.168.0.1")), + Gateway: (*ipamv1.IPAddressStr)(ptr.To("192.168.0.1")), DNSServers: []ipamv1.IPAddressStr{ "8.8.8.8", }, @@ -1880,7 +1880,7 @@ var _ = Describe("Metal3Data manager", func() { APIVersion: infrav1.GroupVersion.Group + "/" + infrav1.GroupVersion.Version, Kind: "Metal3Data", Name: metal3DataName, - Controller: pointer.Bool(true), + Controller: ptr.To(true), }, }}, }, @@ -1948,7 +1948,7 @@ var _ = Describe("Metal3Data manager", func() { { APIVersion: "/", Name: metal3DataName, - Controller: pointer.Bool(true), + Controller: ptr.To(true), }, }}, }, @@ -2199,7 +2199,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "eth0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - String: pointer.String("12:34:56:78:9A:BC"), + String: ptr.To("12:34:56:78:9A:BC"), }, }, }, @@ -2215,7 +2215,7 @@ var _ = Describe("Metal3Data manager", func() { Network: "10.0.0.0", Prefix: 16, Gateway: infrav1.NetworkGatewayv4{ - String: (*ipamv1.IPAddressv4Str)(pointer.String("192.168.1.1")), + String: (*ipamv1.IPAddressv4Str)(ptr.To("192.168.1.1")), }, Services: infrav1.NetworkDataServicev4{ DNS: []ipamv1.IPAddressv4Str{ @@ -2296,7 +2296,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "eth0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - FromHostInterface: pointer.String("eth0"), + FromHostInterface: ptr.To("eth0"), }, }, }, @@ -2357,7 +2357,7 @@ var _ = Describe("Metal3Data manager", func() { (ipamv1.IPAddressStr)("8.8.8.8"), (ipamv1.IPAddressStr)("2001::8888"), }, - DNSFromIPPool: pointer.String("pool1"), + DNSFromIPPool: ptr.To("pool1"), }, poolAddresses: map[string]addressFromPool{ "pool1": { @@ -2388,7 +2388,7 @@ var _ = Describe("Metal3Data manager", func() { (ipamv1.IPAddressStr)("8.8.8.8"), (ipamv1.IPAddressStr)("2001::8888"), }, - DNSFromIPPool: pointer.String("pool1"), + DNSFromIPPool: ptr.To("pool1"), }, poolAddresses: map[string]addressFromPool{ "pool2": { @@ -2427,7 +2427,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "eth0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - String: pointer.String("12:34:56:78:9A:BC"), + String: ptr.To("12:34:56:78:9A:BC"), }, }, }, @@ -2449,7 +2449,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "eth0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - FromHostInterface: pointer.String("eth2"), + FromHostInterface: ptr.To("eth2"), }, }, }, @@ -2469,7 +2469,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "bond0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - String: pointer.String("12:34:56:78:9A:BC"), + String: ptr.To("12:34:56:78:9A:BC"), }, BondLinks: []string{"eth0"}, }, @@ -2495,7 +2495,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "bond0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - FromHostInterface: pointer.String("eth2"), + FromHostInterface: ptr.To("eth2"), }, BondLinks: []string{"eth0"}, }, @@ -2515,7 +2515,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "bond0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - String: pointer.String("12:34:56:78:9A:BC"), + String: ptr.To("12:34:56:78:9A:BC"), }, VlanLink: "eth0", }, @@ -2540,7 +2540,7 @@ var _ = Describe("Metal3Data manager", func() { Id: "bond0", MTU: 1500, MACAddress: &infrav1.NetworkLinkEthernetMac{ - FromHostInterface: pointer.String("eth2"), + FromHostInterface: ptr.To("eth2"), }, VlanLink: "eth0", }, @@ -2591,7 +2591,7 @@ var _ = Describe("Metal3Data manager", func() { Network: "10.0.0.0", Prefix: 16, Gateway: infrav1.NetworkGatewayv4{ - FromIPPool: pointer.String("abc"), + FromIPPool: ptr.To("abc"), }, Services: infrav1.NetworkDataServicev4{ DNS: []ipamv1.IPAddressv4Str{ @@ -2665,7 +2665,7 @@ var _ = Describe("Metal3Data manager", func() { Network: "2001::", Prefix: 64, Gateway: infrav1.NetworkGatewayv6{ - FromIPPool: pointer.String("abc"), + FromIPPool: ptr.To("abc"), }, Services: infrav1.NetworkDataServicev6{ DNS: []ipamv1.IPAddressv6Str{ @@ -2731,7 +2731,7 @@ var _ = Describe("Metal3Data manager", func() { Network: "10.0.0.0", Prefix: 16, Gateway: infrav1.NetworkGatewayv4{ - String: (*ipamv1.IPAddressv4Str)(pointer.String("192.168.1.1")), + String: (*ipamv1.IPAddressv4Str)(ptr.To("192.168.1.1")), }, Services: infrav1.NetworkDataServicev4{ DNS: []ipamv1.IPAddressv4Str{ @@ -2780,7 +2780,7 @@ var _ = Describe("Metal3Data manager", func() { Network: "2001::", Prefix: 64, Gateway: infrav1.NetworkGatewayv6{ - String: (*ipamv1.IPAddressv6Str)(pointer.String("fe80::2001:1")), + String: (*ipamv1.IPAddressv6Str)(ptr.To("fe80::2001:1")), }, Services: infrav1.NetworkDataServicev6{ DNS: []ipamv1.IPAddressv6Str{ @@ -2829,7 +2829,7 @@ var _ = Describe("Metal3Data manager", func() { Network: "2001::", Prefix: 64, Gateway: infrav1.NetworkGatewayv6{ - String: (*ipamv1.IPAddressv6Str)(pointer.String("fe80::2001:1")), + String: (*ipamv1.IPAddressv6Str)(ptr.To("fe80::2001:1")), }, Services: infrav1.NetworkDataServicev6{ DNS: []ipamv1.IPAddressv6Str{ @@ -2875,21 +2875,21 @@ var _ = Describe("Metal3Data manager", func() { Network: "192.168.0.0", Prefix: 24, Gateway: infrav1.NetworkGatewayv4{ - String: (*ipamv1.IPAddressv4Str)(pointer.String("192.168.1.1")), + String: (*ipamv1.IPAddressv4Str)(ptr.To("192.168.1.1")), }, }, { Network: "10.0.0.0", Prefix: 16, Gateway: infrav1.NetworkGatewayv4{ - FromIPPool: pointer.String("abc"), + FromIPPool: ptr.To("abc"), }, Services: infrav1.NetworkDataServicev4{ DNS: []ipamv1.IPAddressv4Str{ ipamv1.IPAddressv4Str("8.8.8.8"), ipamv1.IPAddressv4Str("8.8.4.4"), }, - DNSFromIPPool: pointer.String("abc"), + DNSFromIPPool: ptr.To("abc"), }, }, } @@ -2941,21 +2941,21 @@ var _ = Describe("Metal3Data manager", func() { Network: "2001::0", Prefix: 96, Gateway: infrav1.NetworkGatewayv6{ - String: (*ipamv1.IPAddressv6Str)(pointer.String("2001::1")), + String: (*ipamv1.IPAddressv6Str)(ptr.To("2001::1")), }, }, { Network: "fe80::0", Prefix: 64, Gateway: infrav1.NetworkGatewayv6{ - FromIPPool: pointer.String("abc"), + FromIPPool: ptr.To("abc"), }, Services: infrav1.NetworkDataServicev6{ DNS: []ipamv1.IPAddressv6Str{ ipamv1.IPAddressv6Str("fe80:2001::8888"), ipamv1.IPAddressv6Str("fe80:2001::8844"), }, - DNSFromIPPool: pointer.String("abc"), + DNSFromIPPool: ptr.To("abc"), }, }, } @@ -3052,13 +3052,13 @@ var _ = Describe("Metal3Data manager", func() { }, Entry("string", testCaseGetLinkMacAddress{ mac: &infrav1.NetworkLinkEthernetMac{ - String: pointer.String("12:34:56:78:9A:BC"), + String: ptr.To("12:34:56:78:9A:BC"), }, expectedMAC: "12:34:56:78:9A:BC", }), Entry("from host interface", testCaseGetLinkMacAddress{ mac: &infrav1.NetworkLinkEthernetMac{ - FromHostInterface: pointer.String("eth1"), + FromHostInterface: ptr.To("eth1"), }, bmh: &bmov1alpha1.BareMetalHost{ ObjectMeta: testObjectMeta(baremetalhostName, namespaceName, ""), @@ -3083,7 +3083,7 @@ var _ = Describe("Metal3Data manager", func() { }), Entry("from host interface not found", testCaseGetLinkMacAddress{ mac: &infrav1.NetworkLinkEthernetMac{ - FromHostInterface: pointer.String("eth2"), + FromHostInterface: ptr.To("eth2"), }, bmh: &bmov1alpha1.BareMetalHost{ ObjectMeta: testObjectMeta(baremetalhostName, namespaceName, ""), @@ -3963,7 +3963,7 @@ var _ = Describe("poolRefs map", func() { Expect(refs["foo"]).To(Equal(corev1.TypedLocalObjectReference{ Name: "foo", Kind: "IPPool", - APIGroup: pointer.String("ipam.metal3.io"), + APIGroup: ptr.To("ipam.metal3.io"), })) }) @@ -3973,7 +3973,7 @@ var _ = Describe("poolRefs map", func() { Expect(refs["foo"]).To(Equal(corev1.TypedLocalObjectReference{ Name: "foo", Kind: "IPPool", - APIGroup: pointer.String("ipam.metal3.io"), + APIGroup: ptr.To("ipam.metal3.io"), })) }) @@ -3985,7 +3985,7 @@ var _ = Describe("poolRefs map", func() { Expect(refs["foo"]).To(Equal(corev1.TypedLocalObjectReference{ Name: "foo", Kind: "IPPool", - APIGroup: pointer.String("ipam.metal3.io"), + APIGroup: ptr.To("ipam.metal3.io"), })) }) }) @@ -3998,7 +3998,7 @@ var _ = Describe("poolRefs map", func() { existing = corev1.TypedLocalObjectReference{ Name: "foo", Kind: "InClusterIPPool", - APIGroup: pointer.String("ipam.metal3.io"), + APIGroup: ptr.To("ipam.metal3.io"), } refs = poolRefs{ "foo": existing, @@ -4014,7 +4014,7 @@ var _ = Describe("poolRefs map", func() { Expect(refs.addRef(corev1.TypedLocalObjectReference{ Name: "foo", Kind: "IPPool", - APIGroup: pointer.String("ipam.metal3.io"), + APIGroup: ptr.To("ipam.metal3.io"), })).NotTo(Succeed()) Expect(refs["foo"]).To(Equal(existing)) }) @@ -4023,7 +4023,7 @@ var _ = Describe("poolRefs map", func() { Expect(refs.addRef(corev1.TypedLocalObjectReference{ Name: "foo", Kind: "InClusterIPPool", - APIGroup: pointer.String("ipam.cluster.x-k8s.io"), + APIGroup: ptr.To("ipam.cluster.x-k8s.io"), })).NotTo(Succeed()) Expect(refs["foo"]).To(Equal(existing)) }) @@ -4177,7 +4177,7 @@ var _ = Describe("When using BMH name based pre-allocation", func() { APIVersion: infrav1.GroupVersion.Group + "/" + infrav1.GroupVersion.Version, Kind: "Metal3Data", Name: metal3DataName, - Controller: pointer.Bool(true), + Controller: ptr.To(true), }, }}, }, diff --git a/baremetal/metal3datatemplate_manager.go b/baremetal/metal3datatemplate_manager.go index be101cadaa..3e98ca35b9 100644 --- a/baremetal/metal3datatemplate_manager.go +++ b/baremetal/metal3datatemplate_manager.go @@ -29,7 +29,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util/patch" "sigs.k8s.io/controller-runtime/pkg/client" @@ -318,7 +318,7 @@ func (m *DataTemplateManager) createData(ctx context.Context, Labels: dataClaim.Labels, OwnerReferences: []metav1.OwnerReference{ { - Controller: pointer.Bool(true), + Controller: ptr.To(true), APIVersion: m.DataTemplate.APIVersion, Kind: m.DataTemplate.Kind, Name: m.DataTemplate.Name, @@ -358,7 +358,7 @@ func (m *DataTemplateManager) createData(ctx context.Context, if err := createObject(ctx, m.client, dataObject); err != nil { var reconcileError ReconcileError if !(errors.As(err, &reconcileError) && reconcileError.IsTransient()) { - dataClaim.Status.ErrorMessage = pointer.String("Failed to create associated Metal3Data object") + dataClaim.Status.ErrorMessage = ptr.To("Failed to create associated Metal3Data object") } return indexes, err } @@ -398,14 +398,14 @@ func (m *DataTemplateManager) deleteData(ctx context.Context, } err := m.client.Get(ctx, key, tmpM3Data) if err != nil && !apierrors.IsNotFound(err) { - dataClaim.Status.ErrorMessage = pointer.String("Failed to get associated Metal3Data object") + dataClaim.Status.ErrorMessage = ptr.To("Failed to get associated Metal3Data object") return indexes, err } else if err == nil { // Delete the secret with metadata fmt.Println(tmpM3Data.Name) err = m.client.Delete(ctx, tmpM3Data) if err != nil && !apierrors.IsNotFound(err) { - dataClaim.Status.ErrorMessage = pointer.String("Failed to delete associated Metal3Data object") + dataClaim.Status.ErrorMessage = ptr.To("Failed to delete associated Metal3Data object") return indexes, err } } diff --git a/baremetal/metal3machine_manager.go b/baremetal/metal3machine_manager.go index 9d7c950e70..8e85bd6d96 100644 --- a/baremetal/metal3machine_manager.go +++ b/baremetal/metal3machine_manager.go @@ -44,7 +44,7 @@ import ( "k8s.io/apimachinery/pkg/util/strategicpatch" clientcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" "k8s.io/client-go/tools/cache" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1" capierrors "sigs.k8s.io/cluster-api/errors" @@ -285,7 +285,7 @@ func (m *MachineManager) GetBaremetalHostID(ctx context.Context) (*string, error return nil, WithTransientError(errors.New(errMessage), requeueAfter) } if host.Status.Provisioning.State == bmov1alpha1.StateProvisioned { - return pointer.String(string(host.ObjectMeta.UID)), nil + return ptr.To(string(host.ObjectMeta.UID)), nil } m.Log.Info("Provisioning BaremetalHost, requeuing") // Do not requeue since BMH update will trigger a reconciliation @@ -1275,7 +1275,7 @@ func (m *MachineManager) GetProviderIDAndBMHID() (string, *string) { return *providerID, nil } m.Log.V(4).Info("ProviderID contains the BMH ID", "providerID", *providerID) - return *providerID, pointer.String(bmhID) + return *providerID, ptr.To(bmhID) } // ClientGetter prototype. @@ -1448,13 +1448,13 @@ func setOwnerRefInList(refList []metav1.OwnerReference, controller bool, Kind: objType.Kind, Name: objMeta.Name, UID: objMeta.UID, - Controller: pointer.Bool(controller), + Controller: ptr.To(controller), }) } else { // The UID and the APIVersion might change due to move or version upgrade. refList[index].APIVersion = objType.APIVersion refList[index].UID = objMeta.UID - refList[index].Controller = pointer.Bool(controller) + refList[index].Controller = ptr.To(controller) } return refList, nil } @@ -1529,7 +1529,7 @@ func (m *MachineManager) AssociateM3Metadata(ctx context.Context) error { Kind: m.Metal3Machine.Kind, Name: m.Metal3Machine.Name, UID: m.Metal3Machine.UID, - Controller: pointer.Bool(true), + Controller: ptr.To(true), }, }, Labels: m.Metal3Machine.Labels, diff --git a/baremetal/metal3machine_manager_test.go b/baremetal/metal3machine_manager_test.go index b026ed3081..35fd22eb4e 100644 --- a/baremetal/metal3machine_manager_test.go +++ b/baremetal/metal3machine_manager_test.go @@ -36,7 +36,7 @@ import ( "k8s.io/apimachinery/pkg/types" clientfake "k8s.io/client-go/kubernetes/fake" clientcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1" capierrors "sigs.k8s.io/cluster-api/errors" @@ -56,7 +56,7 @@ const ( var Bmhuid = types.UID("4d25a2c2-46e4-11ec-81d3-0242ac130003") var ProviderID = fmt.Sprintf("metal3://%s", Bmhuid) -var testImageDiskFormat = pointer.String("raw") +var testImageDiskFormat = ptr.To("raw") func m3mSpec() *infrav1.Metal3MachineSpec { return &infrav1.Metal3MachineSpec{ @@ -74,7 +74,7 @@ func m3mSpecAll() *infrav1.Metal3MachineSpec { Image: infrav1.Image{ URL: testImageURL, Checksum: testImageChecksumURL, - ChecksumType: pointer.String("sha512"), + ChecksumType: ptr.To("sha512"), DiskFormat: testImageDiskFormat, }, HostSelector: infrav1.HostSelector{}, @@ -354,7 +354,7 @@ var _ = Describe("Metal3Machine manager", func() { Entry("no ProviderID", infrav1.Metal3Machine{}), Entry("existing ProviderID", infrav1.Metal3Machine{ Spec: infrav1.Metal3MachineSpec{ - ProviderID: pointer.String("wrong"), + ProviderID: ptr.To("wrong"), }, Status: infrav1.Metal3MachineStatus{ Ready: true, @@ -381,7 +381,7 @@ var _ = Describe("Metal3Machine manager", func() { Entry("provisioned", testCaseProvisioned{ M3Machine: infrav1.Metal3Machine{ Spec: infrav1.Metal3MachineSpec{ - ProviderID: pointer.String("abc"), + ProviderID: ptr.To("abc"), }, Status: infrav1.Metal3MachineStatus{ Ready: true, @@ -392,7 +392,7 @@ var _ = Describe("Metal3Machine manager", func() { Entry("missing ready", testCaseProvisioned{ M3Machine: infrav1.Metal3Machine{ Spec: infrav1.Metal3MachineSpec{ - ProviderID: pointer.String("abc"), + ProviderID: ptr.To("abc"), }, }, ExpectTrue: false, @@ -463,7 +463,7 @@ var _ = Describe("Metal3Machine manager", func() { Entry("No errors", infrav1.Metal3Machine{}), Entry("Overwrite existing error message", infrav1.Metal3Machine{ Status: infrav1.Metal3MachineStatus{ - FailureMessage: pointer.String("cba"), + FailureMessage: ptr.To("cba"), }, }), ) @@ -1832,7 +1832,7 @@ var _ = Describe("Metal3Machine manager", func() { }, Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - DataSecretName: pointer.String("Foobar"), + DataSecretName: ptr.To("Foobar"), }, }, }, @@ -1881,7 +1881,7 @@ var _ = Describe("Metal3Machine manager", func() { ObjectMeta: testObjectMeta("", namespaceName, ""), Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - DataSecretName: pointer.String(metal3machineName + "-user-data"), + DataSecretName: ptr.To(metal3machineName + "-user-data"), }, }, }, @@ -2042,7 +2042,7 @@ var _ = Describe("Metal3Machine manager", func() { }, Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - DataSecretName: pointer.String(metal3machineName + "-user-data")}, + DataSecretName: ptr.To(metal3machineName + "-user-data")}, }, }, MachineSet: &clusterv1.MachineSet{ @@ -2105,7 +2105,7 @@ var _ = Describe("Metal3Machine manager", func() { Spec: infrav1.Metal3MachineTemplateSpec{ Template: infrav1.Metal3MachineTemplateResource{ Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: pointer.String(infrav1.CleaningModeDisabled), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeDisabled), }, }, NodeReuse: true, @@ -2141,7 +2141,7 @@ var _ = Describe("Metal3Machine manager", func() { }, Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - DataSecretName: pointer.String(metal3machineName + "-user-data")}, + DataSecretName: ptr.To(metal3machineName + "-user-data")}, }, }, M3Machine: newMetal3Machine(metal3machineName, nil, m3mSecretStatus(), @@ -2186,7 +2186,7 @@ var _ = Describe("Metal3Machine manager", func() { Spec: infrav1.Metal3MachineTemplateSpec{ Template: infrav1.Metal3MachineTemplateResource{ Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: pointer.String(infrav1.CleaningModeDisabled), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeDisabled), }, }, NodeReuse: true, @@ -2521,7 +2521,7 @@ var _ = Describe("Metal3Machine manager", func() { }, Entry("Empty providerID", testCaseGetProviderIDAndBMHID{}), Entry("Provider ID set", testCaseGetProviderIDAndBMHID{ - providerID: pointer.String(ProviderID), + providerID: ptr.To(ProviderID), expectedBMHID: string(Bmhuid), }), ) @@ -2857,7 +2857,7 @@ var _ = Describe("Metal3Machine manager", func() { ObjectMeta: testObjectMeta("", namespaceName, ""), Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - DataSecretName: pointer.String("Foobar"), + DataSecretName: ptr.To("Foobar"), }, }, }, @@ -2885,7 +2885,7 @@ var _ = Describe("Metal3Machine manager", func() { }, Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - DataSecretName: pointer.String("Foobar"), + DataSecretName: ptr.To("Foobar"), }, }, }, @@ -2917,7 +2917,7 @@ var _ = Describe("Metal3Machine manager", func() { Name: "abc", Namespace: "def", }, - DataSecretName: pointer.String("Foobar"), + DataSecretName: ptr.To("Foobar"), }, }, }, @@ -2930,7 +2930,7 @@ var _ = Describe("Metal3Machine manager", func() { ObjectMeta: testObjectMeta("", namespaceName, ""), Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - DataSecretName: pointer.String("test-data-secret-name"), + DataSecretName: ptr.To("test-data-secret-name"), }, }, }, @@ -2942,7 +2942,7 @@ var _ = Describe("Metal3Machine manager", func() { ObjectMeta: testObjectMeta("", namespaceName, ""), Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - DataSecretName: pointer.String("test-data-secret-name"), + DataSecretName: ptr.To("test-data-secret-name"), }, }, }, diff --git a/baremetal/metal3machinetemplate_manager_test.go b/baremetal/metal3machinetemplate_manager_test.go index 66d8a8a2c7..c1c0c19ee3 100644 --- a/baremetal/metal3machinetemplate_manager_test.go +++ b/baremetal/metal3machinetemplate_manager_test.go @@ -25,7 +25,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - utils "k8s.io/utils/pointer" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake" ) @@ -66,7 +66,7 @@ var _ = Describe("Metal3MachineTemplate manager", func() { } }, Entry("Disk cleaning disabled", testCaseUpdate{ - ExpectedValue: utils.String("disabled"), + ExpectedValue: ptr.To("disabled"), M3MachineTemplate: &infrav1.Metal3MachineTemplate{ TypeMeta: metav1.TypeMeta{ APIVersion: infrav1.GroupVersion.String(), @@ -76,7 +76,7 @@ var _ = Describe("Metal3MachineTemplate manager", func() { Spec: infrav1.Metal3MachineTemplateSpec{ Template: infrav1.Metal3MachineTemplateResource{ Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeDisabled), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeDisabled), }, }, }, @@ -99,7 +99,7 @@ var _ = Describe("Metal3MachineTemplate manager", func() { }, }, Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeMetadata), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeMetadata), }, }, { @@ -113,7 +113,7 @@ var _ = Describe("Metal3MachineTemplate manager", func() { }, }, Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeMetadata), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeMetadata), }, }, { @@ -127,14 +127,14 @@ var _ = Describe("Metal3MachineTemplate manager", func() { }, }, Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeMetadata), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeMetadata), }, }, }, }, }), Entry("Disk cleaning enabled", testCaseUpdate{ - ExpectedValue: utils.String("metadata"), + ExpectedValue: ptr.To("metadata"), M3MachineTemplate: &infrav1.Metal3MachineTemplate{ TypeMeta: metav1.TypeMeta{ APIVersion: infrav1.GroupVersion.String(), @@ -144,7 +144,7 @@ var _ = Describe("Metal3MachineTemplate manager", func() { Spec: infrav1.Metal3MachineTemplateSpec{ Template: infrav1.Metal3MachineTemplateResource{ Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeMetadata), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeMetadata), }, }, }, @@ -167,7 +167,7 @@ var _ = Describe("Metal3MachineTemplate manager", func() { }, }, Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeDisabled), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeDisabled), }, }, { @@ -181,7 +181,7 @@ var _ = Describe("Metal3MachineTemplate manager", func() { }, }, Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeDisabled), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeDisabled), }, }, { @@ -195,14 +195,14 @@ var _ = Describe("Metal3MachineTemplate manager", func() { }, }, Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeDisabled), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeDisabled), }, }, }, }, }), Entry("Don't synchronize M3Machines which are not part of the M3MTemplate ", testCaseUpdate{ - ExpectedValue: utils.String("metadata"), + ExpectedValue: ptr.To("metadata"), M3MachineTemplate: &infrav1.Metal3MachineTemplate{ TypeMeta: metav1.TypeMeta{ APIVersion: infrav1.GroupVersion.String(), @@ -212,7 +212,7 @@ var _ = Describe("Metal3MachineTemplate manager", func() { Spec: infrav1.Metal3MachineTemplateSpec{ Template: infrav1.Metal3MachineTemplateResource{ Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String("disabled"), + AutomatedCleaningMode: ptr.To("disabled"), }, }, }, @@ -235,7 +235,7 @@ var _ = Describe("Metal3MachineTemplate manager", func() { }, }, Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeMetadata), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeMetadata), }, }, }, diff --git a/baremetal/utils_test.go b/baremetal/utils_test.go index 01f02e37ba..e9cc759a01 100644 --- a/baremetal/utils_test.go +++ b/baremetal/utils_test.go @@ -27,7 +27,7 @@ import ( corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util/patch" "sigs.k8s.io/controller-runtime/pkg/client" @@ -126,8 +126,8 @@ var _ = Describe("Metal3 manager utils", func() { Namespace: namespaceName, }, Spec: infrav1.Metal3MachineSpec{ - ProviderID: pointer.String("abcdef"), - AutomatedCleaningMode: pointer.String("metadata"), + ProviderID: ptr.To("abcdef"), + AutomatedCleaningMode: ptr.To("metadata"), }, Status: infrav1.Metal3MachineStatus{ Ready: true, @@ -140,7 +140,7 @@ var _ = Describe("Metal3 manager utils", func() { Namespace: namespaceName, }, Spec: infrav1.Metal3MachineSpec{ - ProviderID: pointer.String("abcdefg"), + ProviderID: ptr.To("abcdefg"), }, Status: infrav1.Metal3MachineStatus{ Ready: true, diff --git a/controllers/metal3cluster_controller.go b/controllers/metal3cluster_controller.go index 1326aa2aac..7ae22201f2 100644 --- a/controllers/metal3cluster_controller.go +++ b/controllers/metal3cluster_controller.go @@ -26,7 +26,7 @@ import ( "github.com/metal3-io/cluster-api-provider-metal3/baremetal" "github.com/pkg/errors" apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" capierrors "sigs.k8s.io/cluster-api/errors" "sigs.k8s.io/cluster-api/util" @@ -94,7 +94,7 @@ func (r *Metal3ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques if err != nil { invalidConfigError := capierrors.InvalidConfigurationClusterError metal3Cluster.Status.FailureReason = &invalidConfigError - metal3Cluster.Status.FailureMessage = pointer.String("Unable to get owner cluster") + metal3Cluster.Status.FailureMessage = ptr.To("Unable to get owner cluster") conditions.MarkFalse(metal3Cluster, infrav1.BaremetalInfrastructureReadyCondition, infrav1.InternalFailureReason, clusterv1.ConditionSeverityError, err.Error()) return ctrl.Result{}, err } diff --git a/controllers/metal3machine_controller.go b/controllers/metal3machine_controller.go index 8209530818..db0f68a98e 100644 --- a/controllers/metal3machine_controller.go +++ b/controllers/metal3machine_controller.go @@ -27,7 +27,7 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" capierrors "sigs.k8s.io/cluster-api/errors" "sigs.k8s.io/cluster-api/util" @@ -513,7 +513,7 @@ func (r *Metal3MachineReconciler) Metal3DataToMetal3Machines(_ context.Context, // setErrorM3Machine sets the ErrorMessage and ErrorReason fields on the metal3machine. func setErrorM3Machine(m3m *infrav1.Metal3Machine, message string, reason capierrors.MachineStatusError) { - m3m.Status.FailureMessage = pointer.String(message) + m3m.Status.FailureMessage = ptr.To(message) m3m.Status.FailureReason = &reason } diff --git a/controllers/metal3machine_controller_integration_test.go b/controllers/metal3machine_controller_integration_test.go index a01fb0d4b5..0455251456 100644 --- a/controllers/metal3machine_controller_integration_test.go +++ b/controllers/metal3machine_controller_integration_test.go @@ -36,7 +36,7 @@ import ( "k8s.io/apimachinery/pkg/types" clientfake "k8s.io/client-go/kubernetes/fake" clientcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" capierrors "sigs.k8s.io/cluster-api/errors" "sigs.k8s.io/cluster-api/util/conditions" @@ -266,10 +266,10 @@ var _ = Describe("Reconcile metal3machine", func() { Expect(testBMmachine.Spec.ProviderID).To(Equal(oldProviderID)) } else { if tc.CheckBMProviderIDNew { - Expect(testBMmachine.Spec.ProviderID).To(Equal(pointer.String(fmt.Sprintf("%s%s/%s/%s", baremetal.ProviderIDPrefix, + Expect(testBMmachine.Spec.ProviderID).To(Equal(ptr.To(fmt.Sprintf("%s%s/%s/%s", baremetal.ProviderIDPrefix, testBMHost.ObjectMeta.Namespace, testBMHost.ObjectMeta.Name, testBMmachine.ObjectMeta.Name)))) } else { - Expect(testBMmachine.Spec.ProviderID).To(Equal(pointer.String(fmt.Sprintf("%s%s", baremetal.ProviderIDPrefix, + Expect(testBMmachine.Spec.ProviderID).To(Equal(ptr.To(fmt.Sprintf("%s%s", baremetal.ProviderIDPrefix, string(testBMHost.ObjectMeta.UID))))) } } @@ -525,8 +525,8 @@ var _ = Describe("Reconcile metal3machine", func() { URL: "http://172.22.0.1/images/rhcos-ootpa-latest.qcow2", // Checking the pointers, // CheckBMHostProvisioned is true - ChecksumType: pointer.String("sha512"), - DiskFormat: pointer.String("raw"), + ChecksumType: ptr.To("sha512"), + DiskFormat: ptr.To("raw"), }, }, nil, false, ), @@ -645,7 +645,7 @@ var _ = Describe("Reconcile metal3machine", func() { newMetal3Machine( metal3machineName, m3mMetaWithAnnotation(), &infrav1.Metal3MachineSpec{ - ProviderID: pointer.String(providerID), + ProviderID: ptr.To(providerID), Image: infrav1.Image{ Checksum: "http://172.22.0.1/images/rhcos-ootpa-latest.qcow2.sha256sum", URL: "http://172.22.0.1/images/rhcos-ootpa-latest.qcow2", diff --git a/controllers/metal3machine_controller_test.go b/controllers/metal3machine_controller_test.go index f0961f47dc..bb48ebff6e 100644 --- a/controllers/metal3machine_controller_test.go +++ b/controllers/metal3machine_controller_test.go @@ -31,7 +31,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -120,12 +120,12 @@ func setReconcileNormalExpectations(ctrl *gomock.Controller, if tc.GetProviderIDFails { m.EXPECT().GetProviderIDAndBMHID().Return("", nil) m.EXPECT().GetBaremetalHostID(context.TODO()).Return( - pointer.String(string(bmhuid)), nil, + ptr.To(string(bmhuid)), nil, ) provID = "" } else { m.EXPECT().GetProviderIDAndBMHID().Return( - providerID, pointer.String(string(bmhuid)), + providerID, ptr.To(string(bmhuid)), ) m.EXPECT().GetBaremetalHostID(context.TODO()).MaxTimes(0) } diff --git a/controllers/metal3machinetemplate_controller_test.go b/controllers/metal3machinetemplate_controller_test.go index eed67f4d70..b56f01f702 100644 --- a/controllers/metal3machinetemplate_controller_test.go +++ b/controllers/metal3machinetemplate_controller_test.go @@ -29,7 +29,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - utils "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -105,7 +105,7 @@ var _ = Describe("Metal3MachineTemplate controller", func() { }, }, Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeDisabled), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeDisabled), }, }, M3MTemplate: &infrav1.Metal3MachineTemplate{ @@ -120,7 +120,7 @@ var _ = Describe("Metal3MachineTemplate controller", func() { Spec: infrav1.Metal3MachineTemplateSpec{ Template: infrav1.Metal3MachineTemplateResource{ Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeDisabled), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeDisabled), }, }, }, @@ -141,7 +141,7 @@ var _ = Describe("Metal3MachineTemplate controller", func() { }, }, Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeDisabled), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeDisabled), }, }, M3MTemplate: &infrav1.Metal3MachineTemplate{ @@ -156,7 +156,7 @@ var _ = Describe("Metal3MachineTemplate controller", func() { Spec: infrav1.Metal3MachineTemplateSpec{ Template: infrav1.Metal3MachineTemplateResource{ Spec: infrav1.Metal3MachineSpec{ - AutomatedCleaningMode: utils.String(infrav1.CleaningModeDisabled), + AutomatedCleaningMode: ptr.To(infrav1.CleaningModeDisabled), }, }, }, diff --git a/go.mod b/go.mod index e86944f9f0..586f302ab9 100644 --- a/go.mod +++ b/go.mod @@ -19,8 +19,8 @@ require ( k8s.io/client-go v0.29.2 k8s.io/component-base v0.29.2 k8s.io/klog/v2 v2.110.1 - k8s.io/utils v0.0.0-20230726121419-3b25d923346b - sigs.k8s.io/cluster-api v1.6.1 + k8s.io/utils v0.0.0-20231127182322-b307cd553661 + sigs.k8s.io/cluster-api v1.6.2 sigs.k8s.io/controller-runtime v0.17.2 sigs.k8s.io/yaml v1.4.0 ) diff --git a/go.sum b/go.sum index 143591c7e8..1b4f8055db 100644 --- a/go.sum +++ b/go.sum @@ -352,12 +352,12 @@ k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20231127182322-b307cd553661 h1:FepOBzJ0GXm8t0su67ln2wAZjbQ6RxQGZDnzuLcrUTI= +k8s.io/utils v0.0.0-20231127182322-b307cd553661/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 h1:TgtAeesdhpm2SGwkQasmbeqDo8th5wOBA5h/AjTKA4I= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0/go.mod h1:VHVDI/KrK4fjnV61bE2g3sA7tiETLn8sooImelsCx3Y= -sigs.k8s.io/cluster-api v1.6.1 h1:I34p/fwgRlEhs+o9cUhKXDwNNfPS3no0yJsd2bJyQVc= -sigs.k8s.io/cluster-api v1.6.1/go.mod h1:DaxwruDvSaEYq5q6FREDaGzX6UsAVUCA99Sp8vfMHyQ= +sigs.k8s.io/cluster-api v1.6.2 h1:ruUi4q/9jXFuI+hmnDjo9izHgrBk4bjfQXLKx678PQE= +sigs.k8s.io/cluster-api v1.6.2/go.mod h1:Anm4cA6R/AIP6KdIuVje8CdFc/TdGl+382bi5oPawRc= sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= sigs.k8s.io/controller-runtime v0.17.2/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= diff --git a/test/e2e/common.go b/test/e2e/common.go index f6aa4ac69f..f02a1857fb 100644 --- a/test/e2e/common.go +++ b/test/e2e/common.go @@ -28,7 +28,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1" expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1" @@ -277,7 +277,7 @@ func ScaleKubeadmControlPlane(ctx context.Context, c client.Client, name client. helper, err := patch.NewHelper(&ctrlplane, c) Expect(err).ToNot(HaveOccurred(), "Failed to create new patch helper") - ctrlplane.Spec.Replicas = pointer.Int32Ptr(int32(newReplicaCount)) + ctrlplane.Spec.Replicas = ptr.To(int32(newReplicaCount)) Expect(helper.Patch(ctx, &ctrlplane)).To(Succeed()) } diff --git a/test/e2e/inspection.go b/test/e2e/inspection.go index f6fbba0ac6..1745b00cf5 100644 --- a/test/e2e/inspection.go +++ b/test/e2e/inspection.go @@ -6,7 +6,7 @@ import ( bmov1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/clusterctl" "sigs.k8s.io/controller-runtime/pkg/client" @@ -41,7 +41,7 @@ func inspection(ctx context.Context, inputGetter func() InspectionInput) { Logf("Request inspection for all Available BMHs via API") for _, bmh := range availableBMHList.Items { if bmh.Status.Provisioning.State == bmov1alpha1.StateAvailable { - AnnotateBmh(ctx, bootstrapClient, bmh, inspectAnnotation, pointer.String("")) + AnnotateBmh(ctx, bootstrapClient, bmh, inspectAnnotation, ptr.To("")) } } diff --git a/test/e2e/live_iso_test.go b/test/e2e/live_iso_test.go index 39e9ae7723..fe05670db0 100644 --- a/test/e2e/live_iso_test.go +++ b/test/e2e/live_iso_test.go @@ -10,7 +10,7 @@ import ( bmov1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -74,7 +74,7 @@ func liveIsoTest() { URL: liveISOImageURL, Checksum: "", ChecksumType: "", - DiskFormat: pointer.String("live-iso"), + DiskFormat: ptr.To("live-iso"), } Expect(bootstrapClient.Update(ctx, &isoBmh)).NotTo(HaveOccurred()) isoBmhName := isoBmh.Name diff --git a/test/e2e/remediation.go b/test/e2e/remediation.go index 3e3e1afcc8..1f48c5b504 100644 --- a/test/e2e/remediation.go +++ b/test/e2e/remediation.go @@ -13,7 +13,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/clusterctl" @@ -115,7 +115,7 @@ func remediation(ctx context.Context, inputGetter func() RemediationInput) { By("Checking that rebooted node becomes Ready") Logf("Marking a BMH '%s' for reboot", workerBmh.GetName()) - AnnotateBmh(ctx, bootstrapClient, workerBmh, rebootAnnotation, pointer.String("")) + AnnotateBmh(ctx, bootstrapClient, workerBmh, rebootAnnotation, ptr.To("")) waitForVmsState([]string{vmName}, shutoff, input.SpecName, input.E2EConfig.GetIntervals(input.SpecName, "wait-vm-state")...) waitForVmsState([]string{vmName}, running, input.SpecName, input.E2EConfig.GetIntervals(input.SpecName, "wait-vm-state")...) waitForNodeStatus(ctx, targetClient, client.ObjectKey{Namespace: defaultNamespace, Name: workerNodeName}, corev1.ConditionTrue, input.SpecName, input.E2EConfig.GetIntervals(input.SpecName, "wait-vm-state")...) @@ -166,7 +166,7 @@ func remediation(ctx context.Context, inputGetter func() RemediationInput) { Logf("Start checking unhealthy annotation") Logf("Annotating BMH as unhealthy") - AnnotateBmh(ctx, bootstrapClient, workerBmh, unhealthyAnnotation, pointer.String("")) + AnnotateBmh(ctx, bootstrapClient, workerBmh, unhealthyAnnotation, ptr.To("")) By("Deleting a worker machine") workerMachine := GetMachine(ctx, bootstrapClient, client.ObjectKey{Namespace: input.Namespace, Name: workerMachineName}) @@ -475,7 +475,7 @@ func powerCycle(ctx context.Context, c client.Client, workloadClient client.Clie Logf("Marking %d BMHs for power off", len(machines)) for _, set := range machines { - AnnotateBmh(ctx, c, *set.baremetalhost, poweroffAnnotation, pointer.String("")) + AnnotateBmh(ctx, c, *set.baremetalhost, poweroffAnnotation, ptr.To("")) } waitForVmsState(machines.getVMNames(), shutoff, specName, e2eConfig.GetIntervals(specName, "wait-vm-state")...) diff --git a/test/e2e/upgrade_clusterctl_test.go b/test/e2e/upgrade_clusterctl_test.go index 42cf5c2a0b..2871faebd4 100644 --- a/test/e2e/upgrade_clusterctl_test.go +++ b/test/e2e/upgrade_clusterctl_test.go @@ -66,25 +66,25 @@ var _ = Describe(fmt.Sprintf("When testing cluster upgrade from releases %s > cu if isPreRelease { capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput { return capi_e2e.ClusterctlUpgradeSpecInput{ - E2EConfig: e2eConfig, - ClusterctlConfigPath: clusterctlConfigPath, - BootstrapClusterProxy: bootstrapClusterProxy, - ArtifactFolder: artifactFolder, - SkipCleanup: skipCleanup, - InitWithProvidersContract: "v1alpha4", - CoreProvider: fmt.Sprintf("capi-system/cluster-api:%s", os.Getenv("CAPI_TO_RELEASE")), - BootstrapProviders: []string{fmt.Sprintf("capi-kubeadm-bootstrap-system/kubeadm:%s", os.Getenv("CAPI_TO_RELEASE"))}, - ControlPlaneProviders: []string{fmt.Sprintf("capi-kubeadm-control-plane-system/kubeadm:%s", os.Getenv("CAPI_TO_RELEASE"))}, - InfrastructureProviders: []string{fmt.Sprintf("capm3-system/metal3:%s", os.Getenv("CAPM3_TO_RELEASE"))}, - InitWithBinary: e2eConfig.GetVariable("INIT_WITH_BINARY"), - InitWithKubernetesVersion: e2eConfig.GetVariable("INIT_WITH_KUBERNETES_VERSION"), - WorkloadKubernetesVersion: e2eConfig.GetVariable("INIT_WITH_KUBERNETES_VERSION"), - PreInit: preInitFunc, - PreWaitForCluster: preWaitForCluster, - PreUpgrade: preUpgrade, - PreCleanupManagementCluster: preCleanupManagementCluster, - MgmtFlavor: osType, - WorkloadFlavor: osType, + E2EConfig: e2eConfig, + ClusterctlConfigPath: clusterctlConfigPath, + BootstrapClusterProxy: bootstrapClusterProxy, + ArtifactFolder: artifactFolder, + SkipCleanup: skipCleanup, + InitWithProvidersContract: "v1alpha4", + InitWithCoreProvider: fmt.Sprintf("capi-system/cluster-api:%s", os.Getenv("CAPI_TO_RELEASE")), + InitWithBootstrapProviders: []string{fmt.Sprintf("capi-kubeadm-bootstrap-system/kubeadm:%s", os.Getenv("CAPI_TO_RELEASE"))}, + InitWithControlPlaneProviders: []string{fmt.Sprintf("capi-kubeadm-control-plane-system/kubeadm:%s", os.Getenv("CAPI_TO_RELEASE"))}, + InitWithInfrastructureProviders: []string{fmt.Sprintf("capm3-system/metal3:%s", os.Getenv("CAPM3_TO_RELEASE"))}, + InitWithBinary: e2eConfig.GetVariable("INIT_WITH_BINARY"), + InitWithKubernetesVersion: e2eConfig.GetVariable("INIT_WITH_KUBERNETES_VERSION"), + WorkloadKubernetesVersion: e2eConfig.GetVariable("INIT_WITH_KUBERNETES_VERSION"), + PreInit: preInitFunc, + PreWaitForCluster: preWaitForCluster, + PreUpgrade: preUpgrade, + PreCleanupManagementCluster: preCleanupManagementCluster, + MgmtFlavor: osType, + WorkloadFlavor: osType, } }) } else { diff --git a/test/go.mod b/test/go.mod index 2820dce27d..dd742d8722 100644 --- a/test/go.mod +++ b/test/go.mod @@ -16,9 +16,9 @@ require ( k8s.io/apiextensions-apiserver v0.29.2 k8s.io/apimachinery v0.29.2 k8s.io/client-go v0.29.2 - k8s.io/utils v0.0.0-20230726121419-3b25d923346b - sigs.k8s.io/cluster-api v1.6.1 - sigs.k8s.io/cluster-api/test v1.6.1 + k8s.io/utils v0.0.0-20231127182322-b307cd553661 + sigs.k8s.io/cluster-api v1.6.2 + sigs.k8s.io/cluster-api/test v1.6.2 sigs.k8s.io/controller-runtime v0.17.2 ) diff --git a/test/go.sum b/test/go.sum index bf43386d4b..1b4a55876a 100644 --- a/test/go.sum +++ b/test/go.sum @@ -802,17 +802,17 @@ k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20231127182322-b307cd553661 h1:FepOBzJ0GXm8t0su67ln2wAZjbQ6RxQGZDnzuLcrUTI= +k8s.io/utils v0.0.0-20231127182322-b307cd553661/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 h1:TgtAeesdhpm2SGwkQasmbeqDo8th5wOBA5h/AjTKA4I= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0/go.mod h1:VHVDI/KrK4fjnV61bE2g3sA7tiETLn8sooImelsCx3Y= -sigs.k8s.io/cluster-api v1.6.1 h1:I34p/fwgRlEhs+o9cUhKXDwNNfPS3no0yJsd2bJyQVc= -sigs.k8s.io/cluster-api v1.6.1/go.mod h1:DaxwruDvSaEYq5q6FREDaGzX6UsAVUCA99Sp8vfMHyQ= -sigs.k8s.io/cluster-api/test v1.6.1 h1:9TffRPOuYNUyfHqdeWQtFhdK0oY+NAbvjlzbqK7chTw= -sigs.k8s.io/cluster-api/test v1.6.1/go.mod h1:+zOSrnG/2wI2XtWOkaVpVJ1BXumT/73zqRXZBYrclPQ= +sigs.k8s.io/cluster-api v1.6.2 h1:ruUi4q/9jXFuI+hmnDjo9izHgrBk4bjfQXLKx678PQE= +sigs.k8s.io/cluster-api v1.6.2/go.mod h1:Anm4cA6R/AIP6KdIuVje8CdFc/TdGl+382bi5oPawRc= +sigs.k8s.io/cluster-api/test v1.6.2 h1:RjrYL8Ag9vBxfv++RWEKy/vgTukQYeYVJBMkWvylASc= +sigs.k8s.io/cluster-api/test v1.6.2/go.mod h1:qfkWBqONPAyOwsPFlS8tsrAq7pjKH55pCpKtjhEbUrk= sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= sigs.k8s.io/controller-runtime v0.17.2/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=