Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an (optional) proxy to the TLS config. #4278

Merged
merged 1 commit into from
Feb 19, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/client/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ package client
import (
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
"path"
"reflect"
gruntime "runtime"
"strings"
"time"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
Expand Down Expand Up @@ -228,6 +230,12 @@ func TransportFor(config *Config) (http.RoundTripper, error) {
if tlsConfig != nil {
transport = &http.Transport{
TLSClientConfig: tlsConfig,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the exact same parameters that are in http.DefaultTransport. If you just add the TLSClientConfig to the DefaultTransport will that cause it to be applied elsewhere that we want to use the DefaultTransport (and if so, then using DefaultTransport anywhere seems like a terrible idea since it's a global variable).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be better to copy the http.DefaultTransform's fields (if these are truly the same) rather than add the new ones.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From http://golang.org/pkg/net/http/:

var DefaultTransport RoundTripper = &Transport{
Proxy: ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
TLSHandshakeTimeout: 10 * time.Second,
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be better for us to copy the attributes we want:

&Transport{
  Proxy: http.DefaultTransport.Proxy,
  Dial: http.DefaultTransport.Dial,
  TLSHandshakeTimeout: http.DefaultTransport.TLSHandshakeTimeout,
}

We can't copy the transport without sharing its pool which is verboten (i believe)

----- Original Message -----

@@ -228,6 +230,12 @@ func TransportFor(config *Config) (http.RoundTripper,
error) {
if tlsConfig != nil {
transport = &http.Transport{
TLSClientConfig: tlsConfig,

From http://golang.org/pkg/net/http/:

var DefaultTransport RoundTripper = &Transport{
Proxy: ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
TLSHandshakeTimeout: 10 * time.Second,
}


Reply to this email directly or view it on GitHub:
https://github.com/GoogleCloudPlatform/kubernetes/pull/4278/files#r24562008

Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
TLSHandshakeTimeout: 10 * time.Second,
}
} else {
transport = http.DefaultTransport
Expand Down