pkg/controller: Replace deprecated func usage from the k8s.io/utils/pointer
pkg
This commit is contained in:
@@ -29,7 +29,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/client-go/informers"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
"k8s.io/utils/pointer"
|
||||
)
|
||||
|
||||
func TestDetermineNeededServiceUpdates(t *testing.T) {
|
||||
@@ -674,19 +674,19 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
|
||||
name: "No change",
|
||||
ep1: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
ep2: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
expected: true,
|
||||
},
|
||||
@@ -694,19 +694,19 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
|
||||
name: "NodeName changed",
|
||||
ep1: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
ep2: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
NodeName: utilpointer.StringPtr("node-2"),
|
||||
NodeName: pointer.String("node-2"),
|
||||
},
|
||||
expected: false,
|
||||
},
|
||||
@@ -714,19 +714,19 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
|
||||
name: "Zone changed",
|
||||
ep1: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
},
|
||||
ep2: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
Zone: utilpointer.StringPtr("zone-2"),
|
||||
Zone: pointer.String("zone-2"),
|
||||
},
|
||||
expected: false,
|
||||
},
|
||||
@@ -734,21 +734,21 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
|
||||
name: "Ready condition changed",
|
||||
ep1: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
ep2: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(false),
|
||||
Ready: pointer.Bool(false),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
expected: false,
|
||||
},
|
||||
@@ -756,25 +756,25 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
|
||||
name: "Serving condition changed from nil to true",
|
||||
ep1: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
Serving: nil,
|
||||
Terminating: nil,
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
ep2: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Serving: utilpointer.BoolPtr(true),
|
||||
Terminating: utilpointer.BoolPtr(false),
|
||||
Ready: pointer.Bool(true),
|
||||
Serving: pointer.Bool(true),
|
||||
Terminating: pointer.Bool(false),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
expected: false,
|
||||
},
|
||||
@@ -782,25 +782,25 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
|
||||
name: "Serving condition changed from false to true",
|
||||
ep1: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Serving: utilpointer.BoolPtr(false),
|
||||
Terminating: utilpointer.BoolPtr(false),
|
||||
Ready: pointer.Bool(true),
|
||||
Serving: pointer.Bool(false),
|
||||
Terminating: pointer.Bool(false),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
ep2: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Serving: utilpointer.BoolPtr(true),
|
||||
Terminating: utilpointer.BoolPtr(false),
|
||||
Ready: pointer.Bool(true),
|
||||
Serving: pointer.Bool(true),
|
||||
Terminating: pointer.Bool(false),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
expected: false,
|
||||
},
|
||||
@@ -808,21 +808,21 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
|
||||
name: "Pod name changed",
|
||||
ep1: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
ep2: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod1"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
expected: false,
|
||||
},
|
||||
@@ -830,21 +830,21 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
|
||||
name: "Pod resourceVersion changed",
|
||||
ep1: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0", ResourceVersion: "1"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
ep2: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0", ResourceVersion: "2"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
expected: true,
|
||||
},
|
||||
@@ -852,21 +852,21 @@ func TestEndpointsEqualBeyondHash(t *testing.T) {
|
||||
name: "Pod resourceVersion removed",
|
||||
ep1: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0", ResourceVersion: "1"},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
ep2: &discovery.Endpoint{
|
||||
Conditions: discovery.EndpointConditions{
|
||||
Ready: utilpointer.BoolPtr(true),
|
||||
Ready: pointer.Bool(true),
|
||||
},
|
||||
Addresses: []string{"10.0.0.1"},
|
||||
TargetRef: &v1.ObjectReference{Kind: "Pod", Namespace: "default", Name: "pod0", ResourceVersion: ""},
|
||||
Zone: utilpointer.StringPtr("zone-1"),
|
||||
NodeName: utilpointer.StringPtr("node-1"),
|
||||
Zone: pointer.String("zone-1"),
|
||||
NodeName: pointer.String("node-1"),
|
||||
},
|
||||
expected: true,
|
||||
},
|
||||
|
Reference in New Issue
Block a user