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
e34e7cc1
Commit
e34e7cc1
authored
Nov 20, 2021
by
Manuel Buil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve flannel logging
Signed-off-by:
Manuel Buil
<
mbuil@suse.com
>
parent
b8a1f455
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
+13
-9
config.go
pkg/agent/config/config.go
+2
-2
setup.go
pkg/agent/flannel/setup.go
+10
-6
types.go
pkg/daemons/config/types.go
+1
-1
No files found.
pkg/agent/config/config.go
View file @
e34e7cc1
...
@@ -470,9 +470,9 @@ func get(envInfo *cmds.Agent, proxy proxy.Proxy) (*config.Node, error) {
...
@@ -470,9 +470,9 @@ func get(envInfo *cmds.Agent, proxy proxy.Proxy) (*config.Node, error) {
}
}
if
envInfo
.
FlannelConf
==
""
{
if
envInfo
.
FlannelConf
==
""
{
nodeConfig
.
FlannelConf
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
"etc"
,
"flannel"
,
"net-conf.json"
)
nodeConfig
.
FlannelConf
File
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
"etc"
,
"flannel"
,
"net-conf.json"
)
}
else
{
}
else
{
nodeConfig
.
FlannelConf
=
envInfo
.
FlannelConf
nodeConfig
.
FlannelConf
File
=
envInfo
.
FlannelConf
nodeConfig
.
FlannelConfOverride
=
true
nodeConfig
.
FlannelConfOverride
=
true
}
}
nodeConfig
.
AgentConfig
.
CNIBinDir
=
filepath
.
Dir
(
hostLocal
)
nodeConfig
.
AgentConfig
.
CNIBinDir
=
filepath
.
Dir
(
hostLocal
)
...
...
pkg/agent/flannel/setup.go
View file @
e34e7cc1
...
@@ -78,6 +78,7 @@ func Prepare(ctx context.Context, nodeConfig *config.Node) error {
...
@@ -78,6 +78,7 @@ func Prepare(ctx context.Context, nodeConfig *config.Node) error {
}
}
func
Run
(
ctx
context
.
Context
,
nodeConfig
*
config
.
Node
,
nodes
v1
.
NodeInterface
)
error
{
func
Run
(
ctx
context
.
Context
,
nodeConfig
*
config
.
Node
,
nodes
v1
.
NodeInterface
)
error
{
logrus
.
Infof
(
"Starting flannel with backend %s"
,
nodeConfig
.
FlannelBackend
)
nodeName
:=
nodeConfig
.
AgentConfig
.
NodeName
nodeName
:=
nodeConfig
.
AgentConfig
.
NodeName
for
{
for
{
...
@@ -92,10 +93,10 @@ func Run(ctx context.Context, nodeConfig *config.Node, nodes v1.NodeInterface) e
...
@@ -92,10 +93,10 @@ func Run(ctx context.Context, nodeConfig *config.Node, nodes v1.NodeInterface) e
}
}
time
.
Sleep
(
2
*
time
.
Second
)
time
.
Sleep
(
2
*
time
.
Second
)
}
}
logrus
.
Info
(
"
Node
CIDR assigned for: "
+
nodeName
)
logrus
.
Info
(
"
Flannel found Pod
CIDR assigned for: "
+
nodeName
)
go
func
()
{
go
func
()
{
err
:=
flannel
(
ctx
,
nodeConfig
.
FlannelIface
,
nodeConfig
.
FlannelConf
,
nodeConfig
.
AgentConfig
.
KubeConfigKubelet
)
err
:=
flannel
(
ctx
,
nodeConfig
.
FlannelIface
,
nodeConfig
.
FlannelConf
File
,
nodeConfig
.
AgentConfig
.
KubeConfigKubelet
)
logrus
.
Fatalf
(
"flannel exited: %v"
,
err
)
logrus
.
Fatalf
(
"flannel exited: %v"
,
err
)
}()
}()
...
@@ -103,6 +104,7 @@ func Run(ctx context.Context, nodeConfig *config.Node, nodes v1.NodeInterface) e
...
@@ -103,6 +104,7 @@ func Run(ctx context.Context, nodeConfig *config.Node, nodes v1.NodeInterface) e
}
}
func
createCNIConf
(
dir
string
)
error
{
func
createCNIConf
(
dir
string
)
error
{
logrus
.
Debugf
(
"Creating the CNI conf in directory %s"
,
dir
)
if
dir
==
""
{
if
dir
==
""
{
return
nil
return
nil
}
}
...
@@ -111,11 +113,12 @@ func createCNIConf(dir string) error {
...
@@ -111,11 +113,12 @@ func createCNIConf(dir string) error {
}
}
func
createFlannelConf
(
nodeConfig
*
config
.
Node
)
error
{
func
createFlannelConf
(
nodeConfig
*
config
.
Node
)
error
{
if
nodeConfig
.
FlannelConf
==
""
{
logrus
.
Debugf
(
"Creating the flannel configuration for backend %s in file %s"
,
nodeConfig
.
FlannelBackend
,
nodeConfig
.
FlannelConfFile
)
return
nil
if
nodeConfig
.
FlannelConfFile
==
""
{
return
fmt
.
Errorf
(
"Flannel configuration not defined"
)
}
}
if
nodeConfig
.
FlannelConfOverride
{
if
nodeConfig
.
FlannelConfOverride
{
logrus
.
Infof
(
"Using custom flannel conf defined at %s"
,
nodeConfig
.
FlannelConf
)
logrus
.
Infof
(
"Using custom flannel conf defined at %s"
,
nodeConfig
.
FlannelConf
File
)
return
nil
return
nil
}
}
confJSON
:=
strings
.
Replace
(
flannelConf
,
"%CIDR%"
,
nodeConfig
.
AgentConfig
.
ClusterCIDR
.
String
(),
-
1
)
confJSON
:=
strings
.
Replace
(
flannelConf
,
"%CIDR%"
,
nodeConfig
.
AgentConfig
.
ClusterCIDR
.
String
(),
-
1
)
...
@@ -139,7 +142,8 @@ func createFlannelConf(nodeConfig *config.Node) error {
...
@@ -139,7 +142,8 @@ func createFlannelConf(nodeConfig *config.Node) error {
}
}
confJSON
=
strings
.
Replace
(
confJSON
,
"%backend%"
,
backendConf
,
-
1
)
confJSON
=
strings
.
Replace
(
confJSON
,
"%backend%"
,
backendConf
,
-
1
)
return
util
.
WriteFile
(
nodeConfig
.
FlannelConf
,
confJSON
)
logrus
.
Debugf
(
"The flannel configuration is %s"
,
confJSON
)
return
util
.
WriteFile
(
nodeConfig
.
FlannelConfFile
,
confJSON
)
}
}
func
setupStrongSwan
(
nodeConfig
*
config
.
Node
)
error
{
func
setupStrongSwan
(
nodeConfig
*
config
.
Node
)
error
{
...
...
pkg/daemons/config/types.go
View file @
e34e7cc1
...
@@ -31,7 +31,7 @@ type Node struct {
...
@@ -31,7 +31,7 @@ type Node struct {
NoFlannel
bool
NoFlannel
bool
SELinux
bool
SELinux
bool
FlannelBackend
string
FlannelBackend
string
FlannelConf
string
FlannelConf
File
string
FlannelConfOverride
bool
FlannelConfOverride
bool
FlannelIface
*
net
.
Interface
FlannelIface
*
net
.
Interface
Containerd
Containerd
Containerd
Containerd
...
...
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