Skip to content

Commit

Permalink
aws: Fix proxy dial to pick all proxies
Browse files Browse the repository at this point in the history
The current proxy dial function does not consider proxy
information provided in some environment variables like
http_proxy etc when checking if the service principal
provided is reachable. Adding a function that checks a few
env variables and dials the service to see if it is reachable.
  • Loading branch information
rna-afk committed Mar 30, 2022
1 parent af9c1b8 commit 5add020
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pkg/asset/installconfig/aws/validation.go
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net"
"net/http"
"net/url"
"sort"
"strings"
Expand All @@ -14,7 +15,6 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/route53"
"github.com/pkg/errors"
"golang.org/x/net/proxy"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation/field"
Expand Down Expand Up @@ -329,12 +329,8 @@ func validateEndpointAccessibility(endpointURL string) error {
if port == "" {
port = "https"
}
conn, err := proxy.Dial(context.Background(), "tcp", net.JoinHostPort(URL.Hostname(), port))
if err != nil {
return err
}
conn.Close()
return nil
_, err = http.Head(endpointURL)
return err
}

var requiredServices = []string{
Expand Down

0 comments on commit 5add020

Please sign in to comment.