MCPcopy Create free account
hub / github.com/Mirantis/cri-dockerd / Init

Method Init

network/plugins.go:208–235  ·  view source on GitHub ↗
(
	host Host,
	hairpinMode config.HairpinMode,
	nonMasqueradeCIDR string,
	mtu int,
)

Source from the content-addressed store, hash-verified

206const sysctlBridgeCallIP6Tables = "net/bridge/bridge-nf-call-ip6tables"
207
208func (plugin *NoopNetworkPlugin) Init(
209 host Host,
210 hairpinMode config.HairpinMode,
211 nonMasqueradeCIDR string,
212 mtu int,
213) error {
214 // Set bridge-nf-call-iptables=1 to maintain compatibility with older
215 // kubernetes versions to ensure the iptables-based kube proxy functions
216 // correctly. Other plugins are responsible for setting this correctly
217 // depending on whether or not they connect containers to Linux bridges
218 // or use some other mechanism (ie, SDN vswitch).
219
220 // Ensure the netfilter module is loaded on kernel >= 3.18; previously
221 // it was built-in.
222 utilexec.New().Command("modprobe", "br-netfilter").CombinedOutput()
223 if err := plugin.Sysctl.SetSysctl(sysctlBridgeCallIPTables, 1); err != nil {
224 logrus.Errorf("can't set sysctl bridge-nf-call-iptables: %v", err)
225 }
226 if val, err := plugin.Sysctl.GetSysctl(sysctlBridgeCallIP6Tables); err == nil {
227 if val != 1 {
228 if err = plugin.Sysctl.SetSysctl(sysctlBridgeCallIP6Tables, 1); err != nil {
229 logrus.Errorf("can't set sysctl bridge-nf-call-ip6tables: %v", err)
230 }
231 }
232 }
233
234 return nil
235}
236
237func (plugin *NoopNetworkPlugin) Event(name string, details map[string]interface{}) {
238}

Callers 2

InitNetworkPluginFunction · 0.95
TestInitFunction · 0.95

Calls 2

CombinedOutputMethod · 0.65
CommandMethod · 0.65

Tested by 1

TestInitFunction · 0.76