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
b53b2e1d
Commit
b53b2e1d
authored
Mar 11, 2015
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add and extend timeouts.
parent
0aee25e0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
server_test.go
pkg/kubelet/server_test.go
+6
-1
roundtripper.go
pkg/util/httpstream/spdy/roundtripper.go
+19
-2
No files found.
pkg/kubelet/server_test.go
View file @
b53b2e1d
...
...
@@ -21,6 +21,7 @@ import (
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httptest"
"net/http/httputil"
...
...
@@ -639,7 +640,7 @@ func TestServeExecInContainerIdleTimeout(t *testing.T) {
url
:=
fw
.
testHTTPServer
.
URL
+
"/exec/"
+
podNamespace
+
"/"
+
podName
+
"/"
+
expectedContainerName
+
"?c=ls&c=-a&"
+
api
.
ExecStdinParam
+
"=1"
upgradeRoundTripper
:=
spdy
.
NewRoundTripper
(
nil
)
upgradeRoundTripper
:=
spdy
.
New
Spdy
RoundTripper
(
nil
)
c
:=
&
http
.
Client
{
Transport
:
upgradeRoundTripper
}
resp
,
err
:=
c
.
Get
(
url
)
...
...
@@ -648,6 +649,10 @@ func TestServeExecInContainerIdleTimeout(t *testing.T) {
}
defer
resp
.
Body
.
Close
()
upgradeRoundTripper
.
Dialer
=
&
net
.
Dialer
{
Deadline
:
time
.
Now
()
.
Add
(
60
*
time
.
Second
),
Timeout
:
60
*
time
.
Second
,
}
conn
,
err
:=
upgradeRoundTripper
.
NewConnection
(
resp
)
if
err
!=
nil
{
t
.
Fatalf
(
"Unexpected error creating streaming connection: %s"
,
err
)
...
...
pkg/util/httpstream/spdy/roundtripper.go
View file @
b53b2e1d
...
...
@@ -45,11 +45,18 @@ type SpdyRoundTripper struct {
*/
// conn is the underlying network connection to the remote server.
conn
net
.
Conn
// Dialer is the dialer used to connect. Used if non-nil.
Dialer
*
net
.
Dialer
}
// NewSpdyRoundTripper creates a new SpdyRoundTripper that will use
// the specified tlsConfig.
func
NewRoundTripper
(
tlsConfig
*
tls
.
Config
)
httpstream
.
UpgradeRoundTripper
{
return
NewSpdyRoundTripper
(
tlsConfig
)
}
func
NewSpdyRoundTripper
(
tlsConfig
*
tls
.
Config
)
*
SpdyRoundTripper
{
return
&
SpdyRoundTripper
{
tlsConfig
:
tlsConfig
}
}
...
...
@@ -58,11 +65,21 @@ func (s *SpdyRoundTripper) dial(req *http.Request) (net.Conn, error) {
dialAddr
:=
netutil
.
CanonicalAddr
(
req
.
URL
)
if
req
.
URL
.
Scheme
==
"http"
{
return
net
.
Dial
(
"tcp"
,
dialAddr
)
if
s
.
Dialer
==
nil
{
return
net
.
Dial
(
"tcp"
,
dialAddr
)
}
else
{
return
s
.
Dialer
.
Dial
(
"tcp"
,
dialAddr
)
}
}
// TODO validate the TLSClientConfig is set up?
conn
,
err
:=
tls
.
Dial
(
"tcp"
,
dialAddr
,
s
.
tlsConfig
)
var
conn
*
tls
.
Conn
var
err
error
if
s
.
Dialer
==
nil
{
conn
,
err
=
tls
.
Dial
(
"tcp"
,
dialAddr
,
s
.
tlsConfig
)
}
else
{
conn
,
err
=
tls
.
DialWithDialer
(
s
.
Dialer
,
"tcp"
,
dialAddr
,
s
.
tlsConfig
)
}
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