mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Merge pull request #84440 from lsytj0413/fix-gosimple
refactor(*): fix comparison to bool constant, return redundant
This commit is contained in:
commit
1da7210180
@ -117,7 +117,7 @@ func newEndpointSliceInfo(endpointSlice *discovery.EndpointSlice, remove bool) *
|
|||||||
|
|
||||||
if !remove {
|
if !remove {
|
||||||
for _, endpoint := range endpointSlice.Endpoints {
|
for _, endpoint := range endpointSlice.Endpoints {
|
||||||
if endpoint.Conditions.Ready == nil || *endpoint.Conditions.Ready == true {
|
if endpoint.Conditions.Ready == nil || *endpoint.Conditions.Ready {
|
||||||
esInfo.Endpoints = append(esInfo.Endpoints, &endpointInfo{
|
esInfo.Endpoints = append(esInfo.Endpoints, &endpointInfo{
|
||||||
Addresses: endpoint.Addresses,
|
Addresses: endpoint.Addresses,
|
||||||
Topology: endpoint.Topology,
|
Topology: endpoint.Topology,
|
||||||
|
@ -296,10 +296,7 @@ func TestDeleteEndpointConnections(t *testing.T) {
|
|||||||
if tc.protocol == UDP {
|
if tc.protocol == UDP {
|
||||||
isIPv6 := func(ip string) bool {
|
isIPv6 := func(ip string) bool {
|
||||||
netIP := net.ParseIP(ip)
|
netIP := net.ParseIP(ip)
|
||||||
if netIP.To4() == nil {
|
return netIP.To4() == nil
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
endpointIP := utilproxy.IPPart(tc.endpoint)
|
endpointIP := utilproxy.IPPart(tc.endpoint)
|
||||||
expectCommand := fmt.Sprintf("conntrack -D --orig-dst %s --dst-nat %s -p udp", tc.svcIP, endpointIP)
|
expectCommand := fmt.Sprintf("conntrack -D --orig-dst %s --dst-nat %s -p udp", tc.svcIP, endpointIP)
|
||||||
|
@ -325,7 +325,6 @@ func (sm *ServiceMap) apply(changes *ServiceChangeTracker, UDPStaleClusterIP set
|
|||||||
// clear changes after applying them to ServiceMap.
|
// clear changes after applying them to ServiceMap.
|
||||||
changes.items = make(map[types.NamespacedName]*serviceChange)
|
changes.items = make(map[types.NamespacedName]*serviceChange)
|
||||||
metrics.ServiceChangesPending.Set(0)
|
metrics.ServiceChangesPending.Set(0)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge adds other ServiceMap's elements to current ServiceMap.
|
// merge adds other ServiceMap's elements to current ServiceMap.
|
||||||
|
@ -189,7 +189,7 @@ func (proxier *Proxier) cleanupStaleStickySessions() {
|
|||||||
},
|
},
|
||||||
Port: name.Port,
|
Port: name.Port,
|
||||||
}
|
}
|
||||||
if servicePortNameMap[servicePortName] == false {
|
if !servicePortNameMap[servicePortName] {
|
||||||
// ensure cleanup sticky sessions only gets called once per serviceportname
|
// ensure cleanup sticky sessions only gets called once per serviceportname
|
||||||
servicePortNameMap[servicePortName] = true
|
servicePortNameMap[servicePortName] = true
|
||||||
proxier.loadBalancer.CleanupStaleStickySessions(servicePortName)
|
proxier.loadBalancer.CleanupStaleStickySessions(servicePortName)
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/runtime"
|
"k8s.io/apimachinery/pkg/util/runtime"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
@ -426,7 +426,7 @@ func processDNSQueryPacket(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Query - Response bit that specifies whether this message is a query (0) or a response (1).
|
// Query - Response bit that specifies whether this message is a query (0) or a response (1).
|
||||||
if msg.MsgHdr.Response == true {
|
if msg.MsgHdr.Response {
|
||||||
return length, fmt.Errorf("DNS packet should be a query message")
|
return length, fmt.Errorf("DNS packet should be a query message")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ func processDNSResponsePacket(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Query - Response bit that specifies whether this message is a query (0) or a response (1).
|
// Query - Response bit that specifies whether this message is a query (0) or a response (1).
|
||||||
if msg.MsgHdr.Response == false {
|
if !msg.MsgHdr.Response {
|
||||||
return drop, length, fmt.Errorf("DNS packet should be a response message")
|
return drop, length, fmt.Errorf("DNS packet should be a response message")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user