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
6b343439
Commit
6b343439
authored
Feb 17, 2017
by
Minhan Xia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix for hostport-syncer
parent
6d5b2ef4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
hostport_syncer.go
pkg/kubelet/network/hostport/hostport_syncer.go
+5
-3
kubenet_linux.go
pkg/kubelet/network/kubenet/kubenet_linux.go
+5
-5
No files found.
pkg/kubelet/network/hostport/hostport_syncer.go
View file @
6b343439
...
...
@@ -114,9 +114,9 @@ func getPodFullName(pod *PodPortMapping) string {
// gatherAllHostports returns all hostports that should be presented on node,
// given the list of pods running on that node and ignoring host network
// pods (which don't need hostport <-> container port mapping).
func
gatherAllHostports
(
activePodPortMapping
[]
*
PodPortMapping
)
(
map
[
*
PortMapping
]
targetPod
,
error
)
{
func
gatherAllHostports
(
activePodPortMapping
s
[]
*
PodPortMapping
)
(
map
[
*
PortMapping
]
targetPod
,
error
)
{
podHostportMap
:=
make
(
map
[
*
PortMapping
]
targetPod
)
for
_
,
pm
:=
range
activePodPortMapping
{
for
_
,
pm
:=
range
activePodPortMapping
s
{
if
pm
.
IP
.
To4
()
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Invalid or missing pod %s IP"
,
getPodFullName
(
pm
))
}
...
...
@@ -126,7 +126,9 @@ func gatherAllHostports(activePodPortMapping []*PodPortMapping) (map[*PortMappin
}
for
_
,
port
:=
range
pm
.
PortMappings
{
podHostportMap
[
port
]
=
targetPod
{
podFullName
:
getPodFullName
(
pm
),
podIP
:
pm
.
IP
.
String
()}
if
port
.
HostPort
!=
0
{
podHostportMap
[
port
]
=
targetPod
{
podFullName
:
getPodFullName
(
pm
),
podIP
:
pm
.
IP
.
String
()}
}
}
}
return
podHostportMap
,
nil
...
...
pkg/kubelet/network/kubenet/kubenet_linux.go
View file @
6b343439
...
...
@@ -376,14 +376,14 @@ func (plugin *kubenetNetworkPlugin) setup(namespace string, name string, id kube
}
}
// Open any hostport
s
the pod's containers want
activePodPortMapping
,
err
:=
plugin
.
getPodPortMapping
()
// Open any hostport the pod's containers want
activePodPortMapping
s
,
err
:=
plugin
.
getPodPortMappings
()
if
err
!=
nil
{
return
err
}
newPodPortMapping
:=
constructPodPortMapping
(
pod
,
ip4
)
if
err
:=
plugin
.
hostportSyncer
.
OpenPodHostportsAndSync
(
newPodPortMapping
,
BridgeName
,
activePodPortMapping
);
err
!=
nil
{
if
err
:=
plugin
.
hostportSyncer
.
OpenPodHostportsAndSync
(
newPodPortMapping
,
BridgeName
,
activePodPortMapping
s
);
err
!=
nil
{
return
err
}
}
else
{
...
...
@@ -486,7 +486,7 @@ func (plugin *kubenetNetworkPlugin) teardown(namespace string, name string, id k
// The host can choose to not support "legacy" features. The remote
// shim doesn't support it (#35457), but the kubelet does.
if
plugin
.
host
.
SupportsLegacyFeatures
()
{
activePodPortMapping
,
err
:=
plugin
.
getPodPortMapping
()
activePodPortMapping
,
err
:=
plugin
.
getPodPortMapping
s
()
if
err
==
nil
{
err
=
plugin
.
hostportSyncer
.
SyncHostports
(
BridgeName
,
activePodPortMapping
)
}
...
...
@@ -618,7 +618,7 @@ func (plugin *kubenetNetworkPlugin) getNonExitedPods() ([]*kubecontainer.Pod, er
return
ret
,
nil
}
func
(
plugin
*
kubenetNetworkPlugin
)
getPodPortMapping
()
([]
*
hostport
.
PodPortMapping
,
error
)
{
func
(
plugin
*
kubenetNetworkPlugin
)
getPodPortMapping
s
()
([]
*
hostport
.
PodPortMapping
,
error
)
{
pods
,
err
:=
plugin
.
getNonExitedPods
()
if
err
!=
nil
{
return
nil
,
err
...
...
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