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
4fe13c2a
Commit
4fe13c2a
authored
Feb 22, 2019
by
chenjun.cj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync CNI config in goroutine
parent
4f4695fe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
BUILD
pkg/kubelet/dockershim/network/cni/BUILD
+1
-0
cni.go
pkg/kubelet/dockershim/network/cni/cni.go
+10
-3
No files found.
pkg/kubelet/dockershim/network/cni/BUILD
View file @
4fe13c2a
...
...
@@ -20,6 +20,7 @@ go_library(
"//pkg/kubelet/container:go_default_library",
"//pkg/kubelet/dockershim/network:go_default_library",
"//pkg/util/bandwidth:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//vendor/github.com/containernetworking/cni/libcni:go_default_library",
"//vendor/github.com/containernetworking/cni/pkg/types:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
...
...
pkg/kubelet/dockershim/network/cni/cni.go
View file @
4fe13c2a
...
...
@@ -24,9 +24,11 @@ import (
"sort"
"strings"
"sync"
"time"
"github.com/containernetworking/cni/libcni"
cnitypes
"github.com/containernetworking/cni/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/klog"
kubeletconfig
"k8s.io/kubernetes/pkg/kubelet/apis/config"
runtimeapi
"k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
...
...
@@ -38,6 +40,10 @@ import (
const
(
CNIPluginName
=
"cni"
// defaultSyncConfigPeriod is the default period to sync CNI config
// TODO: consider making this value configurable or to be a more appropriate value.
defaultSyncConfigPeriod
=
time
.
Second
*
5
)
type
cniNetworkPlugin
struct
{
...
...
@@ -194,6 +200,10 @@ func (plugin *cniNetworkPlugin) Init(host network.Host, hairpinMode kubeletconfi
plugin
.
host
=
host
plugin
.
syncNetworkConfig
()
// start a goroutine to sync network config from confDir periodically to detect network config updates in every 5 seconds
go
wait
.
Forever
(
plugin
.
syncNetworkConfig
,
defaultSyncConfigPeriod
)
return
nil
}
...
...
@@ -264,9 +274,6 @@ func (plugin *cniNetworkPlugin) Name() string {
}
func
(
plugin
*
cniNetworkPlugin
)
Status
()
error
{
// sync network config from confDir periodically to detect network config updates
plugin
.
syncNetworkConfig
()
// Can't set up pods if we don't have any CNI network configs yet
return
plugin
.
checkInitialized
()
}
...
...
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