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
f5446f2a
Commit
f5446f2a
authored
Aug 14, 2015
by
xiejunan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix error in findPortByName
using ContainerPort instead of HostPort
parent
ea591728
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
prober.go
pkg/kubelet/prober/prober.go
+1
-1
prober_test.go
pkg/kubelet/prober/prober_test.go
+6
-6
No files found.
pkg/kubelet/prober/prober.go
View file @
f5446f2a
...
...
@@ -255,7 +255,7 @@ func extractPort(param util.IntOrString, container api.Container) (int, error) {
func
findPortByName
(
container
api
.
Container
,
portName
string
)
(
int
,
error
)
{
for
_
,
port
:=
range
container
.
Ports
{
if
port
.
Name
==
portName
{
return
port
.
Host
Port
,
nil
return
port
.
Container
Port
,
nil
}
}
return
0
,
fmt
.
Errorf
(
"port %s not found"
,
portName
)
...
...
pkg/kubelet/prober/prober_test.go
View file @
f5446f2a
...
...
@@ -48,12 +48,12 @@ func TestFindPortByName(t *testing.T) {
container
:=
api
.
Container
{
Ports
:
[]
api
.
ContainerPort
{
{
Name
:
"foo"
,
Host
Port
:
8080
,
Name
:
"foo"
,
Container
Port
:
8080
,
},
{
Name
:
"bar"
,
Host
Port
:
9000
,
Name
:
"bar"
,
Container
Port
:
9000
,
},
},
}
...
...
@@ -85,7 +85,7 @@ func TestGetURLParts(t *testing.T) {
for
_
,
test
:=
range
testCases
{
state
:=
api
.
PodStatus
{
PodIP
:
"127.0.0.1"
}
container
:=
api
.
Container
{
Ports
:
[]
api
.
ContainerPort
{{
Name
:
"found"
,
Host
Port
:
93
}},
Ports
:
[]
api
.
ContainerPort
{{
Name
:
"found"
,
Container
Port
:
93
}},
LivenessProbe
:
&
api
.
Probe
{
Handler
:
api
.
Handler
{
HTTPGet
:
test
.
probe
,
...
...
@@ -138,7 +138,7 @@ func TestGetTCPAddrParts(t *testing.T) {
for
_
,
test
:=
range
testCases
{
host
:=
"1.2.3.4"
container
:=
api
.
Container
{
Ports
:
[]
api
.
ContainerPort
{{
Name
:
"found"
,
Host
Port
:
93
}},
Ports
:
[]
api
.
ContainerPort
{{
Name
:
"found"
,
Container
Port
:
93
}},
LivenessProbe
:
&
api
.
Probe
{
Handler
:
api
.
Handler
{
TCPSocket
:
test
.
probe
,
...
...
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