Repository: metallb/metallb
Pull request #1161 (2022-01-11 17:10:44)

Refactor uint32ptr / boolptr in a package
Many implementations of the same function were scattered across different test packages. Here we collect all of them in a package and use it.


msherif1234: LGTM
liornoy: great PR for a more organized code base, I myself needed int64Ptr and will use this pointer package for it.
sabinaaledort: /lgtm
oribon: Was this left out of the package on purpose? https://github.com/metallb/metallb/blob/35bbb235d0e7f176856166dc16c997a09367b62b/internal/config/validate_test.go#L233
oribon: lgtm

Patch:
diff --git a/go.mod b/go.mod
index ba68c5e4..48179358 100644
--- a/go.mod
+++ b/go.mod
@@ -35,7 +35,6 @@ require (
 	k8s.io/client-go v0.20.4
 	k8s.io/klog v0.3.1
 	k8s.io/kubernetes v1.21.1
-	k8s.io/utils v0.0.0-20201110183641-67b214c5f920
 	sigs.k8s.io/controller-runtime v0.7.0
 )
 
diff --git a/internal/pointer/pointer.go b/internal/pointer/pointer.go
new file mode 100644
index 00000000..8fa7b778
--- /dev/null
+++ b/internal/pointer/pointer.go
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier:Apache-2.0
+
+package pointer
+
+func Uint32Ptr(n uint32) *uint32 {
+	return &n
+}
+
+func Int32Ptr(n int32) *int32 {
+	return &n
+}
+
+func BoolPtr(b bool) *bool {
+	return &b
+}
+
+func StrPtr(s string) *string {
+	return &s
+}
+
+func IntPtr(i int) *int {
+	return &i
+}


Test patch:
diff --git a/e2etest/bgptests/bgp.go b/e2etest/bgptests/bgp.go
index 55c4ef58..7df6fd7c 100644
--- a/e2etest/bgptests/bgp.go
+++ b/e2etest/bgptests/bgp.go
@@ -32,6 +32,7 @@ import (
 	"go.universe.tf/metallb/e2etest/pkg/metallb"
 	"go.universe.tf/metallb/e2etest/pkg/metrics"
 	metallbconfig "go.universe.tf/metallb/internal/config"
+	"go.universe.tf/metallb/internal/pointer"
 
 	"github.com/onsi/ginkgo"
 	"github.com/onsi/ginkgo/extensions/table"
@@ -563,12 +564,12 @@ var _ = ginkgo.Describe("BGP", func() {
 						Name: "full1",
 					},
 					Spec: metallbv1beta1.BFDProfileSpec{
-						ReceiveInterval:  uint32Ptr(60),
-						TransmitInterval: uint32Ptr(61),
-						EchoInterval:     uint32Ptr(62),
-						EchoMode:         boolPtr(false),
-						PassiveMode:      boolPtr(false),
-						MinimumTTL:       uint32Ptr(254),
+						ReceiveInterval:  pointer.Uint32Ptr(60),
+						TransmitInterval: pointer.Uint32Ptr(61),
+						EchoInterval:     pointer.Uint32Ptr(62),
+						EchoMode:         pointer.BoolPtr(false),
+						PassiveMode:      pointer.BoolPtr(false),
+						MinimumTTL:       pointer.Uint32Ptr(254),
 					},
 				}, ipfamily.IPv4, []string{v4PoolAddresses}, testservice.TrafficPolicyCluster),
 			table.Entry("IPV4 - echo mode enabled",
@@ -577,12 +578,12 @@ var _ = ginkgo.Describe("BGP", func() {
 						Name: "echo",
 					},
 					Spec: metallbv1beta1.BFDProfileSpec{
-						ReceiveInterval:  uint32Ptr(80),
-						TransmitInterval: uint32Ptr(81),
-						EchoInterval:     uint32Ptr(82),
-						EchoMode:         boolPtr(true),
-						PassiveMode:      boolPtr(false),
-						MinimumTTL:       uint32Ptr(254),
+						ReceiveInterval:  pointer.Uint32Ptr(80),
+						TransmitInterval: pointer.Uint32Ptr(81),
+						EchoInterval:     pointer.Uint32Ptr(82),
+						EchoMode:         pointer.BoolPtr(true),
+						PassiveMode:      pointer.BoolPtr(false),
+						MinimumTTL:       pointer.Uint32Ptr(254),
 					},
 				}, ipfamily.IPv4, []string{v4PoolAddresses}, testservice.TrafficPolicyCluster),
 			table.Entry("IPV6 - default",
@@ -597,12 +598,12 @@ var _ = ginkgo.Describe("BGP", func() {
 						Name: "full1",
 					},
 					Spec: metallbv1beta1.BFDProfileSpec{
-						ReceiveInterval:  uint32Ptr(60),
-						TransmitInterval: uint32Ptr(61),
-						EchoInterval:     uint32Ptr(62),
-						EchoMode:         boolPtr(false),
-						PassiveMode:      boolPtr(false),
-						MinimumTTL:       uint32Ptr(254),
+						ReceiveInterval:  pointer.Uint32Ptr(60),
+						TransmitInterval: pointer.Uint32Ptr(61),
+						EchoInterval:     pointer.Uint32Ptr(62),
+						EchoMode:         pointer.BoolPtr(false),
+						PassiveMode:      pointer.BoolPtr(false),
+						MinimumTTL:       pointer.Uint32Ptr(254),
 					},
 				}, ipfamily.IPv6, []string{v6PoolAddresses}, testservice.TrafficPolicyCluster),
 			table.Entry("IPV6 - echo mode enabled",
@@ -611,12 +612,12 @@ var _ = ginkgo.Describe("BGP", func() {
 						Name: "echo",
 					},
 					Spec: metallbv1beta1.BFDProfileSpec{
-						ReceiveInterval:  uint32Ptr(80),
-						TransmitInterval: uint32Ptr(81),
-						EchoInterval:     uint32Ptr(82),
-						EchoMode:         boolPtr(true),
-						PassiveMode:      boolPtr(false),
-						MinimumTTL:       uint32Ptr(254),
+						ReceiveInterval:  pointer.Uint32Ptr(80),
+						TransmitInterval: pointer.Uint32Ptr(81),
+						EchoInterval:     pointer.Uint32Ptr(82),
+						EchoMode:         pointer.BoolPtr(true),
+						PassiveMode:      pointer.BoolPtr(false),
+						MinimumTTL:       pointer.Uint32Ptr(254),
 					},
 				}, ipfamily.IPv6, []string{v6PoolAddresses}, testservice.TrafficPolicyCluster),
 			table.Entry("DUALSTACK - full params",
@@ -625,12 +626,12 @@ var _ = ginkgo.Describe("BGP", func() {
 						Name: "full1",
 					},
 					Spec: metallbv1beta1.BFDProfileSpec{
-						ReceiveInterval:  uint32Ptr(60),
-						TransmitInterval: uint32Ptr(61),
-						EchoInterval:     uint32Ptr(62),
-						EchoMode:         boolPtr(false),
-						PassiveMode:      boolPtr(false),
-						MinimumTTL:       uint32Ptr(254),
+						ReceiveInterval:  pointer.Uint32Ptr(60),
+						TransmitInterval: pointer.Uint32Ptr(61),
+						EchoInterval:     pointer.Uint32Ptr(62),
+						EchoMode:         pointer.BoolPtr(false),
+						PassiveMode:      pointer.BoolPtr(false),
+						MinimumTTL:       pointer.Uint32Ptr(254),
 					},
 				}, ipfamily.DualStack, []string{v4PoolAddresses, v6PoolAddresses}, func(svc *corev1.Service) {
 					testservice.TrafficPolicyCluster(svc)
@@ -801,12 +802,12 @@ var _ = ginkgo.Describe("BGP", func() {
 						Name: "echo",
 					},
 					Spec: metallbv1beta1.BFDProfileSpec{
-						ReceiveInterval:  uint32Ptr(80),
-						TransmitInterval: uint32Ptr(81),
-						EchoInterval:     uint32Ptr(82),
-						EchoMode:         boolPtr(true),
-						PassiveMode:      boolPtr(false),
-						MinimumTTL:       uint32Ptr(254),
+						ReceiveInterval:  pointer.Uint32Ptr(80),
+						TransmitInterval: pointer.Uint32Ptr(81),
+						EchoInterval:     pointer.Uint32Ptr(82),
+						EchoMode:         pointer.BoolPtr(true),
+						PassiveMode:      pointer.BoolPtr(false),
+						MinimumTTL:       pointer.Uint32Ptr(254),
 					},
 				}, ipfamily.IPv4, []string{v4PoolAddresses}),
 			table.Entry("IPV6 - default",
@@ -821,12 +822,12 @@ var _ = ginkgo.Describe("BGP", func() {
 						Name: "echo",
 					},
 					Spec: metallbv1beta1.BFDProfileSpec{
-						ReceiveInterval:  uint32Ptr(80),
-						TransmitInterval: uint32Ptr(81),
-						EchoInterval:     uint32Ptr(82),
-						EchoMode:         boolPtr(true),
-						PassiveMode:      boolPtr(false),
-						MinimumTTL:       uint32Ptr(254),
+						ReceiveInterval:  pointer.Uint32Ptr(80),
+						TransmitInterval: pointer.Uint32Ptr(81),
+						EchoInterval:     pointer.Uint32Ptr(82),
+						EchoMode:         pointer.BoolPtr(true),
+						PassiveMode:      pointer.BoolPtr(false),
+						MinimumTTL:       pointer.Uint32Ptr(254),
 					},
 				}, ipfamily.IPv6, []string{v6PoolAddresses}),
 			table.Entry("DUALSTACK - full params",
@@ -835,12 +836,12 @@ var _ = ginkgo.Describe("BGP", func() {
 						Name: "full1",
 					},
 					Spec: metallbv1beta1.BFDProfileSpec{
-						ReceiveInterval:  uint32Ptr(60),
-						TransmitInterval: uint32Ptr(61),
-						EchoInterval:     uint32Ptr(62),
-						EchoMode:         boolPtr(false),
-						PassiveMode:      boolPtr(false),
-						MinimumTTL:       uint32Ptr(254),
+						ReceiveInterval:  pointer.Uint32Ptr(60),
+						TransmitInterval: pointer.Uint32Ptr(61),
+						EchoInterval:     pointer.Uint32Ptr(62),
+						EchoMode:         pointer.BoolPtr(false),
+						PassiveMode:      pointer.BoolPtr(false),
+						MinimumTTL:       pointer.Uint32Ptr(254),
 					},
 				}, ipfamily.DualStack, []string{v4PoolAddresses, v6PoolAddresses}),
 		)
@@ -1304,12 +1305,12 @@ var _ = ginkgo.Describe("BGP", func() {
 					{
 						ObjectMeta: metav1.ObjectMeta{Name: "fullbfdprofile1"},
 						Spec: metallbv1beta1.BFDProfileSpec{
-							ReceiveInterval:  uint32Ptr(93),
-							TransmitInterval: uint32Ptr(95),
-							EchoInterval:     uint32Ptr(97),
-							EchoMode:         boolPtr(true),
-							PassiveMode:      boolPtr(true),
-							MinimumTTL:       uint32Ptr(253),
+							ReceiveInterval:  pointer.Uint32Ptr(93),
+							TransmitInterval: pointer.Uint32Ptr(95),
+							EchoInterval:     pointer.Uint32Ptr(97),
+							EchoMode:         pointer.BoolPtr(true),
+							PassiveMode:      pointer.BoolPtr(true),
+							MinimumTTL:       pointer.Uint32Ptr(253),
 						},
 					},
 				},
@@ -1374,14 +1375,6 @@ var _ = ginkgo.Describe("BGP", func() {
 
 })
 
-func uint32Ptr(n uint32) *uint32 {
-	return &n
-}
-
-func boolPtr(b bool) *bool {
-	return &b
-}
-
 // substringCount creates a Gomega transform function that
 // counts the number of occurrences in the subject string.
 func substringCount(substr string) interface{} {
diff --git a/e2etest/pkg/config/parse.go b/e2etest/pkg/config/parse.go
index 1b6b85e7..12b0cc79 100644
--- a/e2etest/pkg/config/parse.go
+++ b/e2etest/pkg/config/parse.go
@@ -5,6 +5,7 @@ package config
 import (
 	metallbv1beta1 "go.universe.tf/metallb/api/v1beta1"
 	"go.universe.tf/metallb/internal/config"
+	"go.universe.tf/metallb/internal/pointer"
 	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
 
@@ -20,8 +21,8 @@ func BFDProfileWithDefaults(profile metallbv1beta1.BFDProfile, multiHop bool) me
 	res.Spec.PassiveMode = profile.Spec.PassiveMode
 
 	if multiHop {
-		res.Spec.EchoMode = boolPtr(false)
-		res.Spec.EchoInterval = uint32Ptr(50)
+		res.Spec.EchoMode = pointer.BoolPtr(false)
+		res.Spec.EchoInterval = pointer.Uint32Ptr(50)
 	}
 
 	return res
@@ -62,11 +63,3 @@ func valueWithDefault(v *uint32, def uint32) *uint32 {
 	}
 	return &def
 }
-
-func uint32Ptr(n uint32) *uint32 {
-	return &n
-}
-
-func boolPtr(b bool) *bool {
-	return &b
-}
diff --git a/internal/bgp/frr/frr_bfd_test.go b/internal/bgp/frr/frr_bfd_test.go
index a7544ded..87167ee1 100644
--- a/internal/bgp/frr/frr_bfd_test.go
+++ b/internal/bgp/frr/frr_bfd_test.go
@@ -10,6 +10,7 @@ import (
 	"github.com/go-kit/kit/log"
 	"go.universe.tf/metallb/internal/config"
 	"go.universe.tf/metallb/internal/logging"
+	"go.universe.tf/metallb/internal/pointer"
 )
 
 func TestBFDProfileNoSessions(t *testing.T) {
@@ -18,23 +19,23 @@ func TestBFDProfileNoSessions(t *testing.T) {
 	pp := map[string]*config.BFDProfile{
 		"foo": {
 			Name:             "foo",
-			ReceiveInterval:  uint32Ptr(60),
-			TransmitInterval: uint32Ptr(70),
-			DetectMultiplier: uint32Ptr(5),
-			EchoInterval:     uint32Ptr(90),
+			ReceiveInterval:  pointer.Uint32Ptr(60),
+			TransmitInterval: pointer.Uint32Ptr(70),
+			DetectMultiplier: pointer.Uint32Ptr(5),
+			EchoInterval:     pointer.Uint32Ptr(90),
 			EchoMode:         false,
 			PassiveMode:      false,
-			MinimumTTL:       uint32Ptr(60),
+			MinimumTTL:       pointer.Uint32Ptr(60),
 		},
 		"bar": {
 			Name:             "bar",
-			ReceiveInterval:  uint32Ptr(60),
-			TransmitInterval: uint32Ptr(70),
-			DetectMultiplier: uint32Ptr(5),
-			EchoInterval:     uint32Ptr(90),
+			ReceiveInterval:  pointer.Uint32Ptr(60),
+			TransmitInterval: pointer.Uint32Ptr(70),
+			DetectMultiplier: pointer.Uint32Ptr(5),
+			EchoInterval:     pointer.Uint32Ptr(90),
 			EchoMode:         false,
 			PassiveMode:      false,
-			MinimumTTL:       uint32Ptr(60),
+			MinimumTTL:       pointer.Uint32Ptr(60),
 		},
 	}
 	l := log.NewNopLogger()
@@ -59,13 +60,13 @@ func TestBFDProfileCornerCases(t *testing.T) {
 	pp := map[string]*config.BFDProfile{
 		"foo": {
 			Name:             "foo",
-			ReceiveInterval:  uint32Ptr(60),
-			TransmitInterval: uint32Ptr(70),
-			DetectMultiplier: uint32Ptr(5),
-			EchoInterval:     uint32Ptr(90),
+			ReceiveInterval:  pointer.Uint32Ptr(60),
+			TransmitInterval: pointer.Uint32Ptr(70),
+			DetectMultiplier: pointer.Uint32Ptr(5),
+			EchoInterval:     pointer.Uint32Ptr(90),
 			EchoMode:         true,
 			PassiveMode:      true,
-			MinimumTTL:       uint32Ptr(60),
+			MinimumTTL:       pointer.Uint32Ptr(60),
 		},
 	}
 
@@ -91,23 +92,23 @@ func TestBFDWithSession(t *testing.T) {
 	pp := map[string]*config.BFDProfile{
 		"foo": {
 			Name:             "foo",
-			ReceiveInterval:  uint32Ptr(60),
-			TransmitInterval: uint32Ptr(70),
-			DetectMultiplier: uint32Ptr(5),
-			EchoInterval:     uint32Ptr(90),
+			ReceiveInterval:  pointer.Uint32Ptr(60),
+			TransmitInterval: pointer.Uint32Ptr(70),
+			DetectMultiplier: pointer.Uint32Ptr(5),
+			EchoInterval:     pointer.Uint32Ptr(90),
 			EchoMode:         false,
 			PassiveMode:      false,
-			MinimumTTL:       uint32Ptr(60),
+			MinimumTTL:       pointer.Uint32Ptr(60),
 		},
 		"bar": {
 			Name:             "bar",
-			ReceiveInterval:  uint32Ptr(60),
-			TransmitInterval: uint32Ptr(70),
-			DetectMultiplier: uint32Ptr(5),
-			EchoInterval:     uint32Ptr(90),
+			ReceiveInterval:  pointer.Uint32Ptr(60),
+			TransmitInterval: pointer.Uint32Ptr(70),
+			DetectMultiplier: pointer.Uint32Ptr(5),
+			EchoInterval:     pointer.Uint32Ptr(90),
 			EchoMode:         false,
 			PassiveMode:      false,
-			MinimumTTL:       uint32Ptr(60),
+			MinimumTTL:       pointer.Uint32Ptr(60),
 		},
 	}
 
@@ -139,13 +140,13 @@ func TestBFDProfileAllDefault(t *testing.T) {
 	pp := map[string]*config.BFDProfile{
 		"foo": {
 			Name:             "foo",
-			ReceiveInterval:  uint32Ptr(60),
-			TransmitInterval: uint32Ptr(70),
-			DetectMultiplier: uint32Ptr(5),
-			EchoInterval:     uint32Ptr(90),
+			ReceiveInterval:  pointer.Uint32Ptr(60),
+			TransmitInterval: pointer.Uint32Ptr(70),
+			DetectMultiplier: pointer.Uint32Ptr(5),
+			EchoInterval:     pointer.Uint32Ptr(90),
 			EchoMode:         false,
 			PassiveMode:      false,
-			MinimumTTL:       uint32Ptr(60),
+			MinimumTTL:       pointer.Uint32Ptr(60),
 		},
 		"bar": {
 			Name: "bar",
@@ -167,7 +168,3 @@ func TestBFDProfileAllDefault(t *testing.T) {
 		t.Fatalf("Failed to sync bfd profiles %s", err)
 	}
 }
-
-func uint32Ptr(n uint32) *uint32 {
-	return &n
-}
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 0a66f8ab..823aa903 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -10,9 +10,9 @@ import (
 	"github.com/google/go-cmp/cmp"
 	"go.universe.tf/metallb/api/v1beta1"
 	"go.universe.tf/metallb/api/v1beta2"
+	"go.universe.tf/metallb/internal/pointer"
 	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/labels"
-	"k8s.io/utils/pointer"
 )
 
 func selector(s string) labels.Selector {
@@ -1054,13 +1054,13 @@ func TestParse(t *testing.T) {
 							Name: "nondefault",
 						},
 						Spec: v1beta1.BFDProfileSpec{
-							ReceiveInterval:  uint32Ptr(50),
-							TransmitInterval: uint32Ptr(51),
-							DetectMultiplier: uint32Ptr(52),
-							EchoInterval:     uint32Ptr(54),
+							ReceiveInterval:  pointer.Uint32Ptr(50),
+							TransmitInterval: pointer.Uint32Ptr(51),
+							DetectMultiplier: pointer.Uint32Ptr(52),
+							EchoInterval:     pointer.Uint32Ptr(54),
 							EchoMode:         pointer.BoolPtr(true),
 							PassiveMode:      pointer.BoolPtr(true),
-							MinimumTTL:       uint32Ptr(55),
+							MinimumTTL:       pointer.Uint32Ptr(55),
 						},
 					},
 				},
@@ -1089,11 +1089,11 @@ func TestParse(t *testing.T) {
 				BFDProfiles: map[string]*BFDProfile{
 					"nondefault": {
 						Name:             "nondefault",
-						ReceiveInterval:  uint32Ptr(50),
-						DetectMultiplier: uint32Ptr(52),
-						TransmitInterval: uint32Ptr(51),
-						EchoInterval:     uint32Ptr(54),
-						MinimumTTL:       uint32Ptr(55),
+						ReceiveInterval:  pointer.Uint32Ptr(50),
+						DetectMultiplier: pointer.Uint32Ptr(52),
+						TransmitInterval: pointer.Uint32Ptr(51),
+						EchoInterval:     pointer.Uint32Ptr(54),
+						MinimumTTL:       pointer.Uint32Ptr(55),
 						EchoMode:         true,
 						PassiveMode:      true,
 					},
@@ -1110,7 +1110,7 @@ func TestParse(t *testing.T) {
 							Name: "default",
 						},
 						Spec: v1beta1.BFDProfileSpec{
-							ReceiveInterval: uint32Ptr(2),
+							ReceiveInterval: pointer.Uint32Ptr(2),
 						},
 					},
 				},
@@ -1126,7 +1126,7 @@ func TestParse(t *testing.T) {
 							Name: "default",
 						},
 						Spec: v1beta1.BFDProfileSpec{
-							ReceiveInterval: uint32Ptr(90000),
+							ReceiveInterval: pointer.Uint32Ptr(90000),
 						},
 					},
 				},
@@ -1385,7 +1385,3 @@ func TestParse(t *testing.T) {
 		})
 	}
 }
-
-func uint32Ptr(n uint32) *uint32 {
-	return &n
-}
diff --git a/speaker/bgp_controller_test.go b/speaker/bgp_controller_test.go
index e9041476..70a7c36f 100644
--- a/speaker/bgp_controller_test.go
+++ b/speaker/bgp_controller_test.go
@@ -16,6 +16,7 @@ import (
 	"go.universe.tf/metallb/internal/k8s/controllers"
 	"go.universe.tf/metallb/internal/k8s/epslices"
 	"go.universe.tf/metallb/internal/logging"
+	"go.universe.tf/metallb/internal/pointer"
 
 	"github.com/go-kit/kit/log"
 	"github.com/google/go-cmp/cmp"
@@ -25,10 +26,6 @@ import (
 	"k8s.io/apimachinery/pkg/labels"
 )
 
-func strptr(s string) *string {
-	return &s
-}
-
 func mustSelector(s string) labels.Selector {
 	res, err := labels.Parse(s)
 	if err != nil {
@@ -249,7 +246,7 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 						},
@@ -304,7 +301,7 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("pandora"),
+									NodeName: pointer.StrPtr("pandora"),
 								},
 							},
 						},
@@ -336,7 +333,7 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 						},
@@ -372,7 +369,7 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 						},
@@ -404,11 +401,11 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 								{
 									IP:       "2.3.4.6",
-									NodeName: strptr("pandora"),
+									NodeName: pointer.StrPtr("pandora"),
 								},
 							},
 						},
@@ -444,11 +441,11 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 								{
 									IP:       "2.3.4.6",
-									NodeName: strptr("pandora"),
+									NodeName: pointer.StrPtr("pandora"),
 								},
 							},
 						},
@@ -456,13 +453,13 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 							NotReadyAddresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.6",
-									NodeName: strptr("pandora"),
+									NodeName: pointer.StrPtr("pandora"),
 								},
 							},
 						},
@@ -512,7 +509,7 @@ func TestBGPSpeaker(t *testing.T) {
 							NotReadyAddresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 						},
@@ -544,13 +541,13 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 							NotReadyAddresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.6",
-									NodeName: strptr("pandora"),
+									NodeName: pointer.StrPtr("pandora"),
 								},
 							},
 						},
@@ -610,7 +607,7 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 						},
@@ -674,7 +671,7 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 						},
@@ -714,7 +711,7 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 						},
@@ -755,7 +752,7 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 						},
@@ -802,7 +799,7 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 						},
@@ -888,7 +885,7 @@ func TestBGPSpeaker(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris"),
+									NodeName: pointer.StrPtr("iris"),
 								},
 							},
 						},
@@ -986,7 +983,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1041,7 +1038,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "pandora",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1076,7 +1073,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1115,7 +1112,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1150,7 +1147,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1165,7 +1162,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "pandora",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1204,7 +1201,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1219,7 +1216,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "pandora",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(false),
+									Ready: pointer.BoolPtr(false),
 								},
 							},
 						},
@@ -1234,7 +1231,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1249,7 +1246,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "pandora",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1300,7 +1297,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(false),
+									Ready: pointer.BoolPtr(false),
 								},
 							},
 						},
@@ -1335,7 +1332,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 							{
@@ -1346,7 +1343,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "pandora",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(false),
+									Ready: pointer.BoolPtr(false),
 								},
 							},
 						},
@@ -1409,7 +1406,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1476,7 +1473,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1519,7 +1516,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1563,7 +1560,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1613,7 +1610,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -1700,7 +1697,7 @@ func TestBGPSpeakerEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
diff --git a/speaker/layer2_controller_test.go b/speaker/layer2_controller_test.go
index a3e4f5d5..98d8cf55 100644
--- a/speaker/layer2_controller_test.go
+++ b/speaker/layer2_controller_test.go
@@ -12,6 +12,7 @@ import (
 	"go.universe.tf/metallb/internal/config"
 	"go.universe.tf/metallb/internal/k8s/controllers"
 	"go.universe.tf/metallb/internal/k8s/epslices"
+	"go.universe.tf/metallb/internal/pointer"
 
 	"github.com/go-kit/kit/log"
 	v1 "k8s.io/api/core/v1"
@@ -72,11 +73,11 @@ func TestUsableNodes(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris1"),
+									NodeName: pointer.StrPtr("iris1"),
 								},
 								{
 									IP:       "2.3.4.15",
-									NodeName: strptr("iris2"),
+									NodeName: pointer.StrPtr("iris2"),
 								},
 							},
 						},
@@ -95,11 +96,11 @@ func TestUsableNodes(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris1"),
+									NodeName: pointer.StrPtr("iris1"),
 								},
 								{
 									IP:       "2.3.4.15",
-									NodeName: strptr("iris1"),
+									NodeName: pointer.StrPtr("iris1"),
 								},
 							},
 						},
@@ -118,13 +119,13 @@ func TestUsableNodes(t *testing.T) {
 							Addresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.5",
-									NodeName: strptr("iris1"),
+									NodeName: pointer.StrPtr("iris1"),
 								},
 							},
 							NotReadyAddresses: []v1.EndpointAddress{
 								{
 									IP:       "2.3.4.15",
-									NodeName: strptr("iris1"),
+									NodeName: pointer.StrPtr("iris1"),
 								},
 							},
 						},
@@ -179,7 +180,7 @@ func TestUsableNodesEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris1",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -194,7 +195,7 @@ func TestUsableNodesEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris2",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -219,7 +220,7 @@ func TestUsableNodesEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris1",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 							{
@@ -230,7 +231,7 @@ func TestUsableNodesEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris2",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -255,7 +256,7 @@ func TestUsableNodesEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris1",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 							{
@@ -266,7 +267,7 @@ func TestUsableNodesEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris1",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 						},
@@ -292,7 +293,7 @@ func TestUsableNodesEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris1",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(true),
+									Ready: pointer.BoolPtr(true),
 								},
 							},
 							{
@@ -303,7 +304,7 @@ func TestUsableNodesEPSlices(t *testing.T) {
 									"kubernetes.io/hostname": "iris1",
 								},
 								Conditions: discovery.EndpointConditions{
-									Ready: boolPtr(false),
+									Ready: pointer.BoolPtr(false),
 								},
 							},
 						},
@@ -390,11 +391,11 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 								},
 							},
@@ -438,11 +439,11 @@ func TestShouldAnnounce(t *testing.T) {
 								NotReadyAddresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 								},
 							},
@@ -485,11 +486,11 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 							},
@@ -530,11 +531,11 @@ func TestShouldAnnounce(t *testing.T) {
 								NotReadyAddresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 							},
@@ -575,13 +576,13 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 								},
 								NotReadyAddresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 							},
@@ -629,11 +630,11 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 							},
@@ -648,11 +649,11 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.25",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 									{
 										IP:       "2.3.4.35",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 							},
@@ -702,11 +703,11 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 							},
@@ -721,13 +722,13 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.25",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 								},
 								NotReadyAddresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.35",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 							},
@@ -777,13 +778,13 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 								NotReadyAddresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 								},
 							},
@@ -798,13 +799,13 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.25",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 								},
 								NotReadyAddresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.35",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 							},
@@ -847,15 +848,15 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 									{
 										IP:       "2.3.4.25",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 							},
@@ -896,15 +897,15 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 									{
 										IP:       "2.3.4.25",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 								},
 							},
@@ -945,17 +946,17 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 								NotReadyAddresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.25",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 							},
@@ -996,17 +997,17 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 								NotReadyAddresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.25",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 								},
 							},
@@ -1047,17 +1048,17 @@ func TestShouldAnnounce(t *testing.T) {
 								Addresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.5",
-										NodeName: strptr("iris1"),
+										NodeName: pointer.StrPtr("iris1"),
 									},
 								},
 								NotReadyAddresses: []v1.EndpointAddress{
 									{
 										IP:       "2.3.4.15",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 									{
 										IP:       "2.3.4.25",
-										NodeName: strptr("iris2"),
+										NodeName: pointer.StrPtr("iris2"),
 									},
 								},
 							},
@@ -1171,7 +1172,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1182,7 +1183,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 							},
@@ -1228,7 +1229,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(false),
+										Ready: pointer.BoolPtr(false),
 									},
 								},
 								{
@@ -1239,7 +1240,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(false),
+										Ready: pointer.BoolPtr(false),
 									},
 								},
 							},
@@ -1285,7 +1286,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1296,7 +1297,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 							},
@@ -1342,7 +1343,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(false),
+										Ready: pointer.BoolPtr(false),
 									},
 								},
 								{
@@ -1353,7 +1354,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(false),
+										Ready: pointer.BoolPtr(false),
 									},
 								},
 							},
@@ -1399,7 +1400,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1410,7 +1411,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(false),
+										Ready: pointer.BoolPtr(false),
 									},
 								},
 							},
@@ -1463,7 +1464,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1474,7 +1475,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 							},
@@ -1494,7 +1495,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1505,7 +1506,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 							},
@@ -1560,7 +1561,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1571,7 +1572,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 							},
@@ -1591,7 +1592,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1602,7 +1603,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(false),
+										Ready: pointer.BoolPtr(false),
 									},
 								},
 							},
@@ -1657,7 +1658,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1668,7 +1669,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(false),
+										Ready: pointer.BoolPtr(false),
 									},
 								},
 							},
@@ -1688,7 +1689,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1699,7 +1700,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(false),
+										Ready: pointer.BoolPtr(false),
 									},
 								},
 							},
@@ -1747,7 +1748,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1758,7 +1759,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 							},
@@ -1773,7 +1774,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 							},
@@ -1819,7 +1820,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1830,7 +1831,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1841,7 +1842,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 							},
@@ -1887,7 +1888,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1898,7 +1899,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1909,7 +1910,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 							},
@@ -1955,7 +1956,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1966,7 +1967,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -1977,7 +1978,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(false),
+										Ready: pointer.BoolPtr(false),
 									},
 								},
 							},
@@ -2023,7 +2024,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris1",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(true),
+										Ready: pointer.BoolPtr(true),
 									},
 								},
 								{
@@ -2034,7 +2035,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(false),
+										Ready: pointer.BoolPtr(false),
 									},
 								},
 								{
@@ -2045,7 +2046,7 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 										"kubernetes.io/hostname": "iris2",
 									},
 									Conditions: discovery.EndpointConditions{
-										Ready: boolPtr(false),
+										Ready: pointer.BoolPtr(false),
 									},
 								},
 							},
@@ -2089,10 +2090,6 @@ func TestShouldAnnounceEPSlices(t *testing.T) {
 	}
 }
 
-func boolPtr(b bool) *bool {
-	return &b
-}
-
 func TestClusterPolicy(t *testing.T) {
 	fakeSL := &fakeSpeakerList{
 		speakers: map[string]bool{
@@ -2149,7 +2146,7 @@ func TestClusterPolicy(t *testing.T) {
 							"kubernetes.io/hostname": "iris1",
 						},
 						Conditions: discovery.EndpointConditions{
-							Ready: boolPtr(true),
+							Ready: pointer.BoolPtr(true),
 						},
 					},
 				},
@@ -2169,7 +2166,7 @@ func TestClusterPolicy(t *testing.T) {
 							"kubernetes.io/hostname": "iris2",
 						},
 						Conditions: discovery.EndpointConditions{
-							Ready: boolPtr(true),
+							Ready: pointer.BoolPtr(true),
 						},
 					},
 				},