Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
2d74e342
Unverified
Commit
2d74e342
authored
May 09, 2019
by
Darren Shepherd
Committed by
GitHub
May 09, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #465 from vizv/allow-builtin-kernel-modules
Allow using built-in kernel modules
parents
1d42fc97
f0f57c1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
setup.go
pkg/agent/syssetup/setup.go
+17
-12
No files found.
pkg/agent/syssetup/setup.go
View file @
2d74e342
...
...
@@ -2,6 +2,7 @@ package syssetup
import
(
"io/ioutil"
"os"
"os/exec"
"github.com/sirupsen/logrus"
...
...
@@ -12,11 +13,20 @@ var (
forward
=
"/proc/sys/net/ipv4/ip_forward"
)
func
Configure
()
error
{
if
err
:=
exec
.
Command
(
"modprobe"
,
"br_netfilter"
)
.
Run
();
err
!=
nil
{
logrus
.
Warnf
(
"failed to start br_netfilter module"
)
return
nil
func
loadKernelModule
(
moduleName
string
)
{
if
_
,
err
:=
os
.
Stat
(
"/sys/module/"
+
moduleName
);
err
==
nil
{
logrus
.
Infof
(
"module %s was already loaded"
,
moduleName
)
return
}
if
err
:=
exec
.
Command
(
"modprobe"
,
moduleName
)
.
Run
();
err
!=
nil
{
logrus
.
Warnf
(
"failed to start %s module"
,
moduleName
)
}
}
func
Configure
()
error
{
loadKernelModule
(
"br_netfilter"
)
if
err
:=
ioutil
.
WriteFile
(
callIPTablesFile
,
[]
byte
(
"1"
),
0640
);
err
!=
nil
{
logrus
.
Warnf
(
"failed to write value 1 at %s: %v"
,
callIPTablesFile
,
err
)
return
nil
...
...
@@ -26,13 +36,8 @@ func Configure() error {
return
nil
}
if
err
:=
exec
.
Command
(
"modprobe"
,
"overlay"
)
.
Run
();
err
!=
nil
{
logrus
.
Warnf
(
"failed to start overlay module"
)
return
nil
}
if
err
:=
exec
.
Command
(
"modprobe"
,
"nf_conntrack"
)
.
Run
();
err
!=
nil
{
logrus
.
Warnf
(
"failed to start nf_conntrack module"
)
return
nil
}
loadKernelModule
(
"overlay"
)
loadKernelModule
(
"nf_conntrack"
)
return
nil
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment