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
f0f57c1e
Unverified
Commit
f0f57c1e
authored
May 09, 2019
by
Wenxuan Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow using built-in modules
Signed-off-by:
Wenxuan Zhao
<
viz@linux.com
>
parent
1d42fc97
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 @
f0f57c1e
...
...
@@ -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