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
30ea22f4
Commit
30ea22f4
authored
Aug 14, 2015
by
Dan Winship
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make kube-proxy resync its rules on firewalld restart
parent
8bc9c407
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
10 deletions
+22
-10
server.go
cmd/kube-proxy/app/server.go
+2
-0
proxier.go
pkg/proxy/iptables/proxier.go
+8
-5
types.go
pkg/proxy/types.go
+2
-0
proxier.go
pkg/proxy/userspace/proxier.go
+10
-5
No files found.
cmd/kube-proxy/app/server.go
View file @
30ea22f4
...
...
@@ -240,6 +240,8 @@ func (s *ProxyServer) Run(_ []string) error {
},
5
*
time
.
Second
,
util
.
NeverStop
)
}
ipt
.
AddReloadFunc
(
proxier
.
Sync
)
// Just loop forever for now...
proxier
.
SyncLoop
()
return
nil
...
...
pkg/proxy/iptables/proxier.go
View file @
30ea22f4
...
...
@@ -248,6 +248,13 @@ func ipsEqual(lhs, rhs []string) bool {
return
true
}
// Sync is called to immediately synchronize the proxier state to iptables
func
(
proxier
*
Proxier
)
Sync
()
{
proxier
.
mu
.
Lock
()
defer
proxier
.
mu
.
Unlock
()
proxier
.
syncProxyRules
()
}
// SyncLoop runs periodic work. This is expected to run as a goroutine or as the main loop of the app. It does not return.
func
(
proxier
*
Proxier
)
SyncLoop
()
{
t
:=
time
.
NewTicker
(
proxier
.
syncPeriod
)
...
...
@@ -255,11 +262,7 @@ func (proxier *Proxier) SyncLoop() {
for
{
<-
t
.
C
glog
.
V
(
6
)
.
Infof
(
"Periodic sync"
)
func
()
{
proxier
.
mu
.
Lock
()
defer
proxier
.
mu
.
Unlock
()
proxier
.
syncProxyRules
()
}()
proxier
.
Sync
()
}
}
...
...
pkg/proxy/types.go
View file @
30ea22f4
...
...
@@ -29,6 +29,8 @@ type ProxyProvider interface {
// Active service proxies are reinitialized if found in the update set or
// removed if missing from the update set.
OnServiceUpdate
(
services
[]
api
.
Service
)
// Sync immediately synchronizes the ProxyProvider's current state to iptables.
Sync
()
// SyncLoop runs periodic work.
// This is expected to run as a goroutine or as the main loop of the app.
// It does not return.
...
...
pkg/proxy/userspace/proxier.go
View file @
30ea22f4
...
...
@@ -222,6 +222,15 @@ func CleanupLeftovers(ipt iptables.Interface) (encounteredError bool) {
return
encounteredError
}
// Sync is called to immediately synchronize the proxier state to iptables
func
(
proxier
*
Proxier
)
Sync
()
{
if
err
:=
iptablesInit
(
proxier
.
iptables
);
err
!=
nil
{
glog
.
Errorf
(
"Failed to ensure iptables: %v"
,
err
)
}
proxier
.
ensurePortals
()
proxier
.
cleanupStaleStickySessions
()
}
// SyncLoop runs periodic work. This is expected to run as a goroutine or as the main loop of the app. It does not return.
func
(
proxier
*
Proxier
)
SyncLoop
()
{
t
:=
time
.
NewTicker
(
proxier
.
syncPeriod
)
...
...
@@ -229,11 +238,7 @@ func (proxier *Proxier) SyncLoop() {
for
{
<-
t
.
C
glog
.
V
(
6
)
.
Infof
(
"Periodic sync"
)
if
err
:=
iptablesInit
(
proxier
.
iptables
);
err
!=
nil
{
glog
.
Errorf
(
"Failed to ensure iptables: %v"
,
err
)
}
proxier
.
ensurePortals
()
proxier
.
cleanupStaleStickySessions
()
proxier
.
Sync
()
}
}
...
...
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