@@ -16,7 +16,6 @@ import (
16
16
utiliptables "k8s.io/kubernetes/pkg/util/iptables"
17
17
utilexec "k8s.io/utils/exec"
18
18
utilnet "k8s.io/utils/net"
19
- utilebtables "k8s.io/utils/net/ebtables"
20
19
)
21
20
22
21
// ConfigParams lists the configuration options that can be provided to node-cache
@@ -35,7 +34,6 @@ type ConfigParams struct {
35
34
UpstreamSvcName string // Name of the service whose clusterIP is the upstream for node-cache for cluster domain
36
35
HealthPort string // port for the healthcheck
37
36
SetupIptables bool
38
- SetupEbtables bool
39
37
SkipTeardown bool // Indicates whether the iptables rules and interface should be torn down
40
38
}
41
39
@@ -45,18 +43,10 @@ type iptablesRule struct {
45
43
args []string
46
44
}
47
45
48
- type ebtablesRule struct {
49
- table utilebtables.Table
50
- chain utilebtables.Chain
51
- args []string
52
- }
53
-
54
46
// CacheApp contains all the config required to run node-cache.
55
47
type CacheApp struct {
56
48
iptables utiliptables.Interface
57
49
iptablesRules []iptablesRule
58
- ebtables utilebtables.Interface
59
- ebtablesRules []ebtablesRule
60
50
params * ConfigParams
61
51
netifHandle * netif.NetifManager
62
52
kubednsConfig * options.KubeDNSConfig
@@ -76,9 +66,6 @@ func (c *CacheApp) Init() {
76
66
if c .params .SetupIptables {
77
67
c .initIptables ()
78
68
}
79
- if c .params .SetupEbtables {
80
- c .initEbtables ()
81
- }
82
69
initMetrics (c .params .MetricsListenAddress )
83
70
// Write the config file from template.
84
71
// this is required in case there is no or erroneous kube-dns configpath specified.
@@ -153,27 +140,6 @@ func newIPTables(isIPv6 bool) utiliptables.Interface {
153
140
return utiliptables .New (execer , dbus , protocol )
154
141
}
155
142
156
- func (c * CacheApp ) initEbtables () {
157
- protocol := "IPv4"
158
- if c .isIPv6 () {
159
- protocol = "IPv6"
160
- }
161
- // using the localIPStr param since we need ip strings here
162
- for _ , localIP := range strings .Split (c .params .LocalIPStr , "," ) {
163
- c .ebtablesRules = append (c .ebtablesRules , []ebtablesRule {
164
- // Match traffic destined for localIp and use the MAC address of the bridge port as destination address
165
- {utilebtables .TableBroute , utilebtables .ChainBrouting , []string {"-p" , protocol , "--ip-dst" , localIP ,
166
- "-j" , "redirect" }},
167
- }... )
168
- }
169
- c .ebtables = newEBTables ()
170
- }
171
-
172
- func newEBTables () utilebtables.Interface {
173
- execer := utilexec .New ()
174
- return utilebtables .New (execer )
175
- }
176
-
177
143
// TeardownNetworking removes all custom iptables rules and network interface added by node-cache
178
144
func (c * CacheApp ) TeardownNetworking () error {
179
145
clog .Infof ("Tearing down" )
@@ -196,17 +162,6 @@ func (c *CacheApp) TeardownNetworking() error {
196
162
// Delete the rule one last time since EnsureRule creates the rule if it doesn't exist
197
163
c .iptables .DeleteRule (rule .table , rule .chain , rule .args ... )
198
164
}
199
- if c .params .SetupEbtables {
200
- for _ , rule := range c .ebtablesRules {
201
- exists := true
202
- for exists == true {
203
- c .ebtables .DeleteRule (rule .table , rule .chain , rule .args ... )
204
- exists , _ = c .ebtables .EnsureRule (utilebtables .Append , rule .table , rule .chain , rule .args ... )
205
- }
206
- // Delete the rule one last time since EnsureRule creates the rule if it doesn't exist
207
- c .ebtables .DeleteRule (rule .table , rule .chain , rule .args ... )
208
- }
209
- }
210
165
}
211
166
return err
212
167
}
@@ -234,25 +189,6 @@ func (c *CacheApp) setupNetworking() {
234
189
}
235
190
}
236
191
237
- if c .params .SetupEbtables {
238
- for _ , rule := range c .ebtablesRules {
239
- exists , err := c .ebtables .EnsureRule (utilebtables .Append , rule .table , rule .chain , rule .args ... )
240
- switch {
241
- case exists :
242
- // debug messages can be printed by including "debug" plugin in coreFile.
243
- clog .Debugf ("ebtables rule %v for nodelocaldns already exists" , rule )
244
- continue
245
- case err == nil :
246
- clog .Infof ("Added back ebtables rule - %v" , rule )
247
- continue
248
- // if we got here, either ebtables check failed or adding rule back failed.
249
- default :
250
- clog .Errorf ("Error adding ebtables rule %v - %s" , rule , err )
251
- setupErrCount .WithLabelValues ("ebtables" ).Inc ()
252
- }
253
- }
254
- }
255
-
256
192
if c .params .SetupInterface {
257
193
exists , err := c .netifHandle .EnsureDummyDevice (c .params .InterfaceName )
258
194
if ! exists {
0 commit comments