Skip to content

Commit

Permalink
httpproxy uses https when CA_CERT specified
Browse files Browse the repository at this point in the history
  • Loading branch information
mgencur committed Aug 31, 2022
1 parent 8d32902 commit fb19e86
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ function install() {
if [[ "$INGRESS_CLASS" == "kourier.ingress.networking.knative.dev" ]]; then
echo "Point Kourier local gateway to custom server certificates"
toggle_feature cluster-cert-secret server-certs config-kourier
# This needs to match the name of Secret in test/config/tls/cert-secret.yaml
export CA_CERT=ca-cert
# This needs to match $san from test/config/tls/generate.sh
export SERVER_NAME=knative.dev
fi
echo "Restart activator to mount the certificates"
kubectl delete pod -n ${SYSTEM_NAMESPACE} -l app=activator
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/service_to_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func testProxyToHelloworld(t *testing.T, clients *test.Clients, helloworldURL *u
})
}

caSecretName := os.Getenv("UPSTREAM_CA_CERT")
caSecretName := os.Getenv("CA_CERT")
if caSecretName != "" {
envVars = append(envVars, []corev1.EnvVar{{Name: "CA_CERT", Value: caCertPath},
{Name: "SERVER_NAME", Value: os.Getenv("SERVER_NAME")}}...)
Expand Down
6 changes: 5 additions & 1 deletion test/test_images/httpproxy/httpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ func main() {
routedHost = gateway
}

scheme := "http"
if caCert := os.Getenv("CA_CERT"); caCert != "" {
scheme = "https"
}
target := &url.URL{
Scheme: "http",
Scheme: scheme,
Host: routedHost,
}
log.Print("target is ", target)
Expand Down

0 comments on commit fb19e86

Please sign in to comment.