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

Do not use proxy settings for test route while getting cluster CA certificate #409

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pkg/deploy/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ func GetEndpointTLSCrtChain(instance *orgv1.CheCluster, endpointURL string, prox
return nil, stderrors.New("Not allowed for tests")
}

var isTestRoute bool = len(endpointURL) < 1
var requestURL string
if len(endpointURL) < 1 {
if isTestRoute {
// Create test route to get certificates chain.
// Note, it is not possible to use SyncRouteToCluster here as it may cause infinite reconcile loop.
routeSpec, err := GetSpecRoute(instance, "test", "", "test", 8080, clusterAPI)
Expand Down Expand Up @@ -149,9 +150,10 @@ func GetEndpointTLSCrtChain(instance *orgv1.CheCluster, endpointURL string, prox
requestURL = endpointURL
}

// Adding the proxy settings to the Transport object
transport := &http.Transport{}
if proxy.HttpProxy != "" {
// Adding the proxy settings to the Transport object.
// However, in case of test route we need to reach cluter directly in order to get the right certificate.
if proxy.HttpProxy != "" && !isTestRoute {
logrus.Infof("Configuring proxy with %s to extract crt from the following URL: %s", proxy.HttpProxy, requestURL)
ConfigureProxy(instance, transport, proxy)
}
Expand Down