Use k8s.io/utils/ptr in pkg/proxy (#121154)
* Use k8s.io/utils/ptr in pkg/proxy * Replace pointer.String(), pointer.StringPtr(), and pointer.Bool() with ptr.To() * Replace pointer.Int32(constexpr) with ptr.To[int32](constexpr) * Replace pointer.Int32(int32(var)) with ptr.To(int32(var)) * Replace remaining pointer.Int32() cases with ptr.To * Replace 'tcpProtocol := v1.ProtocolTCP; ... &tcpProtocol', etc with ptr.To(v1.ProtocolTCP) * Replace 'nodeName = testHostname; ... &nodeName' with ptr.To(testHostname) * Use ptr.To for SessionAffinityConfig.ClientIP.TimeoutSeconds * Use ptr.To for InternalTrafficPolicy * Use ptr.To for LoadBalancer.Ingress.IPMode
This commit is contained in:
@@ -30,7 +30,7 @@ import (
|
||||
"k8s.io/client-go/informers"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
ktesting "k8s.io/client-go/testing"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func TestNewServicesSourceApi_UpdatesAndMultipleServices(t *testing.T) {
|
||||
@@ -83,7 +83,6 @@ func TestNewServicesSourceApi_UpdatesAndMultipleServices(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewEndpointsSourceApi_UpdatesAndMultipleEndpoints(t *testing.T) {
|
||||
tcp := v1.ProtocolTCP
|
||||
endpoints1v1 := &discoveryv1.EndpointSlice{
|
||||
ObjectMeta: metav1.ObjectMeta{Namespace: "testnamespace", Name: "e1"},
|
||||
AddressType: discoveryv1.AddressTypeIPv4,
|
||||
@@ -93,8 +92,8 @@ func TestNewEndpointsSourceApi_UpdatesAndMultipleEndpoints(t *testing.T) {
|
||||
},
|
||||
}},
|
||||
Ports: []discoveryv1.EndpointPort{{
|
||||
Port: utilpointer.Int32(8080),
|
||||
Protocol: &tcp,
|
||||
Port: ptr.To[int32](8080),
|
||||
Protocol: ptr.To(v1.ProtocolTCP),
|
||||
}},
|
||||
}
|
||||
endpoints1v2 := &discoveryv1.EndpointSlice{
|
||||
@@ -107,8 +106,8 @@ func TestNewEndpointsSourceApi_UpdatesAndMultipleEndpoints(t *testing.T) {
|
||||
},
|
||||
}},
|
||||
Ports: []discoveryv1.EndpointPort{{
|
||||
Port: utilpointer.Int32(8080),
|
||||
Protocol: &tcp,
|
||||
Port: ptr.To[int32](8080),
|
||||
Protocol: ptr.To(v1.ProtocolTCP),
|
||||
}},
|
||||
}
|
||||
endpoints2 := &discoveryv1.EndpointSlice{
|
||||
@@ -120,8 +119,8 @@ func TestNewEndpointsSourceApi_UpdatesAndMultipleEndpoints(t *testing.T) {
|
||||
},
|
||||
}},
|
||||
Ports: []discoveryv1.EndpointPort{{
|
||||
Port: utilpointer.Int32(8080),
|
||||
Protocol: &tcp,
|
||||
Port: ptr.To[int32](8080),
|
||||
Protocol: ptr.To(v1.ProtocolTCP),
|
||||
}},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user