Skip to content

Commit 36f5820

Browse files
committed
Remove some unused proxy args/fields
Remove the utilexec.Interface args from the iptables/ipvs constructors (which have been unused since the conntrack cleanup code was ported to netlink). Remove the EventRecorder fields from the iptables/ipvs Proxiers, which have been unused since we removed the port-opener code in 2022. Remove the strictARP field from the ipvs Proxier, which has apparently always been unused (strictARP is only looked at at construct time).
1 parent 13f0449 commit 36f5820

File tree

6 files changed

+5
-25
lines changed

6 files changed

+5
-25
lines changed

cmd/kube-proxy/app/server_linux.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ func (s *ProxyServer) createProxier(ctx context.Context, config *proxyconfigapi.
175175
ctx,
176176
ipt,
177177
utilsysctl.New(),
178-
exec.New(),
179178
config.SyncPeriod.Duration,
180179
config.MinSyncPeriod.Duration,
181180
config.Linux.MasqueradeAll,
@@ -199,7 +198,6 @@ func (s *ProxyServer) createProxier(ctx context.Context, config *proxyconfigapi.
199198
s.PrimaryIPFamily,
200199
iptInterface,
201200
utilsysctl.New(),
202-
exec.New(),
203201
config.SyncPeriod.Duration,
204202
config.MinSyncPeriod.Duration,
205203
config.Linux.MasqueradeAll,
@@ -235,7 +233,6 @@ func (s *ProxyServer) createProxier(ctx context.Context, config *proxyconfigapi.
235233
ipvsInterface,
236234
ipsetInterface,
237235
utilsysctl.New(),
238-
execer,
239236
config.SyncPeriod.Duration,
240237
config.MinSyncPeriod.Duration,
241238
config.IPVS.ExcludeCIDRs,
@@ -263,7 +260,6 @@ func (s *ProxyServer) createProxier(ctx context.Context, config *proxyconfigapi.
263260
ipvsInterface,
264261
ipsetInterface,
265262
utilsysctl.New(),
266-
execer,
267263
config.SyncPeriod.Duration,
268264
config.MinSyncPeriod.Duration,
269265
config.IPVS.ExcludeCIDRs,

pkg/proxy/iptables/proxier.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ import (
5454
"k8s.io/kubernetes/pkg/proxy/util/nfacct"
5555
"k8s.io/kubernetes/pkg/util/async"
5656
utiliptables "k8s.io/kubernetes/pkg/util/iptables"
57-
utilexec "k8s.io/utils/exec"
5857
)
5958

6059
const (
@@ -101,7 +100,6 @@ func NewDualStackProxier(
101100
ctx context.Context,
102101
ipt [2]utiliptables.Interface,
103102
sysctl utilsysctl.Interface,
104-
exec utilexec.Interface,
105103
syncPeriod time.Duration,
106104
minSyncPeriod time.Duration,
107105
masqueradeAll bool,
@@ -117,15 +115,15 @@ func NewDualStackProxier(
117115
) (proxy.Provider, error) {
118116
// Create an ipv4 instance of the single-stack proxier
119117
ipv4Proxier, err := NewProxier(ctx, v1.IPv4Protocol, ipt[0], sysctl,
120-
exec, syncPeriod, minSyncPeriod, masqueradeAll, localhostNodePorts, masqueradeBit,
118+
syncPeriod, minSyncPeriod, masqueradeAll, localhostNodePorts, masqueradeBit,
121119
localDetectors[v1.IPv4Protocol], hostname, nodeIPs[v1.IPv4Protocol],
122120
recorder, healthzServer, nodePortAddresses, initOnly)
123121
if err != nil {
124122
return nil, fmt.Errorf("unable to create ipv4 proxier: %v", err)
125123
}
126124

127125
ipv6Proxier, err := NewProxier(ctx, v1.IPv6Protocol, ipt[1], sysctl,
128-
exec, syncPeriod, minSyncPeriod, masqueradeAll, false, masqueradeBit,
126+
syncPeriod, minSyncPeriod, masqueradeAll, false, masqueradeBit,
129127
localDetectors[v1.IPv6Protocol], hostname, nodeIPs[v1.IPv6Protocol],
130128
recorder, healthzServer, nodePortAddresses, initOnly)
131129
if err != nil {
@@ -175,7 +173,6 @@ type Proxier struct {
175173
localDetector proxyutil.LocalTrafficDetector
176174
hostname string
177175
nodeIP net.IP
178-
recorder events.EventRecorder
179176

180177
serviceHealthServer healthcheck.ServiceHealthServer
181178
healthzServer *healthcheck.ProxyHealthServer
@@ -230,7 +227,6 @@ func NewProxier(ctx context.Context,
230227
ipFamily v1.IPFamily,
231228
ipt utiliptables.Interface,
232229
sysctl utilsysctl.Interface,
233-
exec utilexec.Interface,
234230
syncPeriod time.Duration,
235231
minSyncPeriod time.Duration,
236232
masqueradeAll bool,
@@ -300,7 +296,6 @@ func NewProxier(ctx context.Context,
300296
localDetector: localDetector,
301297
hostname: hostname,
302298
nodeIP: nodeIP,
303-
recorder: recorder,
304299
serviceHealthServer: serviceHealthServer,
305300
healthzServer: healthzServer,
306301
precomputedProbabilities: make([]string, 0, 1001),

pkg/proxy/ipvs/proxier.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import (
5353
"k8s.io/kubernetes/pkg/util/async"
5454
utiliptables "k8s.io/kubernetes/pkg/util/iptables"
5555
utilkernel "k8s.io/kubernetes/pkg/util/kernel"
56-
utilexec "k8s.io/utils/exec"
5756
netutils "k8s.io/utils/net"
5857
)
5958

@@ -115,7 +114,6 @@ func NewDualStackProxier(
115114
ipvs utilipvs.Interface,
116115
ipset utilipset.Interface,
117116
sysctl utilsysctl.Interface,
118-
exec utilexec.Interface,
119117
syncPeriod time.Duration,
120118
minSyncPeriod time.Duration,
121119
excludeCIDRs []string,
@@ -136,7 +134,7 @@ func NewDualStackProxier(
136134
) (proxy.Provider, error) {
137135
// Create an ipv4 instance of the single-stack proxier
138136
ipv4Proxier, err := NewProxier(ctx, v1.IPv4Protocol, ipt[0], ipvs, ipset, sysctl,
139-
exec, syncPeriod, minSyncPeriod, filterCIDRs(false, excludeCIDRs), strictARP,
137+
syncPeriod, minSyncPeriod, filterCIDRs(false, excludeCIDRs), strictARP,
140138
tcpTimeout, tcpFinTimeout, udpTimeout, masqueradeAll, masqueradeBit,
141139
localDetectors[v1.IPv4Protocol], hostname, nodeIPs[v1.IPv4Protocol], recorder,
142140
healthzServer, scheduler, nodePortAddresses, initOnly)
@@ -145,7 +143,7 @@ func NewDualStackProxier(
145143
}
146144

147145
ipv6Proxier, err := NewProxier(ctx, v1.IPv6Protocol, ipt[1], ipvs, ipset, sysctl,
148-
exec, syncPeriod, minSyncPeriod, filterCIDRs(true, excludeCIDRs), strictARP,
146+
syncPeriod, minSyncPeriod, filterCIDRs(true, excludeCIDRs), strictARP,
149147
tcpTimeout, tcpFinTimeout, udpTimeout, masqueradeAll, masqueradeBit,
150148
localDetectors[v1.IPv6Protocol], hostname, nodeIPs[v1.IPv6Protocol], recorder,
151149
healthzServer, scheduler, nodePortAddresses, initOnly)
@@ -197,8 +195,7 @@ type Proxier struct {
197195
minSyncPeriod time.Duration
198196
// Values are CIDR's to exclude when cleaning up IPVS rules.
199197
excludeCIDRs []*net.IPNet
200-
// Set to true to set sysctls arp_ignore and arp_announce
201-
strictARP bool
198+
202199
iptables utiliptables.Interface
203200
ipvs utilipvs.Interface
204201
ipset utilipset.Interface
@@ -208,7 +205,6 @@ type Proxier struct {
208205
localDetector proxyutil.LocalTrafficDetector
209206
hostname string
210207
nodeIP net.IP
211-
recorder events.EventRecorder
212208

213209
serviceHealthServer healthcheck.ServiceHealthServer
214210
healthzServer *healthcheck.ProxyHealthServer
@@ -270,7 +266,6 @@ func NewProxier(
270266
ipvs utilipvs.Interface,
271267
ipset utilipset.Interface,
272268
sysctl utilsysctl.Interface,
273-
exec utilexec.Interface,
274269
syncPeriod time.Duration,
275270
minSyncPeriod time.Duration,
276271
excludeCIDRs []string,
@@ -388,7 +383,6 @@ func NewProxier(
388383
localDetector: localDetector,
389384
hostname: hostname,
390385
nodeIP: nodeIP,
391-
recorder: recorder,
392386
serviceHealthServer: serviceHealthServer,
393387
healthzServer: healthzServer,
394388
ipvs: ipvs,

pkg/proxy/ipvs/proxier_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ func NewFakeProxier(ctx context.Context, ipt utiliptables.Interface, ipvs utilip
149149
ipvs: ipvs,
150150
ipset: ipset,
151151
conntrack: conntrack.NewFake(),
152-
strictARP: false,
153152
localDetector: proxyutil.NewNoOpLocalDetector(),
154153
hostname: testHostname,
155154
serviceHealthServer: healthcheck.NewFakeServiceHealthServer(),

pkg/proxy/nftables/proxier.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ type Proxier struct {
180180
localDetector proxyutil.LocalTrafficDetector
181181
hostname string
182182
nodeIP net.IP
183-
recorder events.EventRecorder
184183

185184
serviceHealthServer healthcheck.ServiceHealthServer
186185
healthzServer *healthcheck.ProxyHealthServer
@@ -265,7 +264,6 @@ func NewProxier(ctx context.Context,
265264
localDetector: localDetector,
266265
hostname: hostname,
267266
nodeIP: nodeIP,
268-
recorder: recorder,
269267
serviceHealthServer: serviceHealthServer,
270268
healthzServer: healthzServer,
271269
nodePortAddresses: nodePortAddresses,

pkg/proxy/winkernel/proxier.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,6 @@ type Proxier struct {
651651
// These are effectively const and do not need the mutex to be held.
652652
hostname string
653653
nodeIP net.IP
654-
recorder events.EventRecorder
655654

656655
serviceHealthServer healthcheck.ServiceHealthServer
657656
healthzServer *healthcheck.ProxyHealthServer
@@ -813,7 +812,6 @@ func NewProxier(
813812
endpointsMap: make(proxy.EndpointsMap),
814813
hostname: hostname,
815814
nodeIP: nodeIP,
816-
recorder: recorder,
817815
serviceHealthServer: serviceHealthServer,
818816
healthzServer: healthzServer,
819817
hns: hns,

0 commit comments

Comments
 (0)