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:
@@ -27,7 +27,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
iptablestest "k8s.io/kubernetes/pkg/util/iptables/testing"
|
||||
netutils "k8s.io/utils/net"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
// kube-proxy generates iptables rules to forward traffic from Services to Endpoints
|
||||
@@ -361,8 +361,6 @@ func generateServiceEndpoints(nServices, nEndpoints int, epsFunc func(eps *disco
|
||||
baseEp := netutils.BigForIP(netutils.ParseIPSloppy("172.16.0.1"))
|
||||
epPort := 8080
|
||||
|
||||
tcpProtocol := v1.ProtocolTCP
|
||||
|
||||
eps := &discovery.EndpointSlice{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "ep",
|
||||
@@ -371,9 +369,9 @@ func generateServiceEndpoints(nServices, nEndpoints int, epsFunc func(eps *disco
|
||||
AddressType: discovery.AddressTypeIPv4,
|
||||
Endpoints: []discovery.Endpoint{},
|
||||
Ports: []discovery.EndpointPort{{
|
||||
Name: pointer.String(fmt.Sprintf("%d", epPort)),
|
||||
Port: pointer.Int32(int32(epPort)),
|
||||
Protocol: &tcpProtocol,
|
||||
Name: ptr.To(fmt.Sprintf("%d", epPort)),
|
||||
Port: ptr.To(int32(epPort)),
|
||||
Protocol: ptr.To(v1.ProtocolTCP),
|
||||
}},
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user