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
d4522de0
Unverified
Commit
d4522de0
authored
Jun 14, 2022
by
Manuel Buil
Committed by
GitHub
Jun 14, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5656 from manuelbuil/AddFlannelCniConfFile
Add FlannelCNIConf flag
parents
443b23e2
c705d348
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
2 deletions
+30
-2
config.go
pkg/agent/config/config.go
+1
-0
setup.go
pkg/agent/flannel/setup.go
+7
-2
file.go
pkg/agent/util/file.go
+13
-0
agent.go
pkg/cli/cmds/agent.go
+7
-0
server.go
pkg/cli/cmds/server.go
+1
-0
types.go
pkg/daemons/config/types.go
+1
-0
No files found.
pkg/agent/config/config.go
View file @
d4522de0
...
...
@@ -533,6 +533,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
}
nodeConfig
.
AgentConfig
.
CNIBinDir
=
filepath
.
Dir
(
hostLocal
)
nodeConfig
.
AgentConfig
.
CNIConfDir
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
"etc"
,
"cni"
,
"net.d"
)
nodeConfig
.
AgentConfig
.
FlannelCniConfFile
=
envInfo
.
FlannelCniConfFile
}
if
nodeConfig
.
ContainerRuntimeEndpoint
==
""
{
...
...
pkg/agent/flannel/setup.go
View file @
d4522de0
...
...
@@ -91,7 +91,7 @@ const (
)
func
Prepare
(
ctx
context
.
Context
,
nodeConfig
*
config
.
Node
)
error
{
if
err
:=
createCNIConf
(
nodeConfig
.
AgentConfig
.
CNIConfDir
);
err
!=
nil
{
if
err
:=
createCNIConf
(
nodeConfig
.
AgentConfig
.
CNIConfDir
,
nodeConfig
);
err
!=
nil
{
return
err
}
...
...
@@ -146,12 +146,17 @@ func waitForPodCIDR(ctx context.Context, nodeName string, nodes typedcorev1.Node
return
nil
}
func
createCNIConf
(
dir
string
)
error
{
func
createCNIConf
(
dir
string
,
nodeConfig
*
config
.
Node
)
error
{
logrus
.
Debugf
(
"Creating the CNI conf in directory %s"
,
dir
)
if
dir
==
""
{
return
nil
}
p
:=
filepath
.
Join
(
dir
,
"10-flannel.conflist"
)
if
nodeConfig
.
AgentConfig
.
FlannelCniConfFile
!=
""
{
logrus
.
Debugf
(
"Using %s as the flannel CNI conf"
,
nodeConfig
.
AgentConfig
.
FlannelCniConfFile
)
return
util
.
CopyFile
(
nodeConfig
.
AgentConfig
.
FlannelCniConfFile
,
p
)
}
return
util
.
WriteFile
(
p
,
cniConf
)
}
...
...
pkg/agent/util/file.go
View file @
d4522de0
...
...
@@ -16,3 +16,16 @@ func WriteFile(name string, content string) error {
}
return
nil
}
func
CopyFile
(
sourceFile
string
,
destinationFile
string
)
error
{
os
.
MkdirAll
(
filepath
.
Dir
(
destinationFile
),
0755
)
input
,
err
:=
ioutil
.
ReadFile
(
sourceFile
)
if
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"copying %s to %s"
,
sourceFile
,
destinationFile
)
}
err
=
ioutil
.
WriteFile
(
destinationFile
,
input
,
0644
)
if
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"copying %s to %s"
,
sourceFile
,
destinationFile
)
}
return
nil
}
pkg/cli/cmds/agent.go
View file @
d4522de0
...
...
@@ -31,6 +31,7 @@ type Agent struct {
NoFlannel
bool
FlannelIface
string
FlannelConf
string
FlannelCniConfFile
string
Debug
bool
Rootless
bool
RootlessAlreadyUnshared
bool
...
...
@@ -135,6 +136,11 @@ var (
Usage
:
"(agent/networking) Override default flannel config file"
,
Destination
:
&
AgentConfig
.
FlannelConf
,
}
FlannelCniConfFileFlag
=
cli
.
StringFlag
{
Name
:
"flannel-cni-conf"
,
Usage
:
"(agent/networking) Override default flannel cni config file"
,
Destination
:
&
AgentConfig
.
FlannelCniConfFile
,
}
ResolvConfFlag
=
cli
.
StringFlag
{
Name
:
"resolv-conf"
,
Usage
:
"(agent/networking) Kubelet resolv.conf file"
,
...
...
@@ -258,6 +264,7 @@ func NewAgentCommand(action func(ctx *cli.Context) error) cli.Command {
ResolvConfFlag
,
FlannelIfaceFlag
,
FlannelConfFlag
,
FlannelCniConfFileFlag
,
ExtraKubeletArgs
,
ExtraKubeProxyArgs
,
ProtectKernelDefaultsFlag
,
...
...
pkg/cli/cmds/server.go
View file @
d4522de0
...
...
@@ -445,6 +445,7 @@ var ServerFlags = []cli.Flag{
ResolvConfFlag
,
FlannelIfaceFlag
,
FlannelConfFlag
,
FlannelCniConfFileFlag
,
ExtraKubeletArgs
,
ExtraKubeProxyArgs
,
ProtectKernelDefaultsFlag
,
...
...
pkg/daemons/config/types.go
View file @
d4522de0
...
...
@@ -110,6 +110,7 @@ type Agent struct {
ImageCredProvBinDir
string
ImageCredProvConfig
string
IPSECPSK
string
FlannelCniConfFile
string
StrongSwanDir
string
PrivateRegistry
string
SystemDefaultRegistry
string
...
...
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