Skip to content
Open
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
16 changes: 15 additions & 1 deletion cmd/openshift-install/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ func handleUnreachableAPIServer(ctx context.Context, config *rest.Config) error
if !installConfig.Config.PublicAPI() {
lbType = lbconfig.PrivateLoadBalancer
}

_, ipAddrs, err := lbConfig.ParseDNSDataFromConfig(lbType)
if err != nil {
return fmt.Errorf("failed to parse lbconfig: %w", err)
Expand All @@ -553,6 +552,21 @@ func handleUnreachableAPIServer(ctx context.Context, config *rest.Config) error
return fmt.Errorf("no ip address found in lbconfig")
}

if !installConfig.Config.PublicAPI() {
// Check for LB IP reachability from Install host.
address := net.JoinHostPort(ipAddr, "6443")
conn, err := net.DialTimeout("tcp", address, time.Second*10)
if err != nil {
// Not reachable because install host is not in the cluster network.
// Use kubeconfig without dialer context because some reachability
// mechanism like a proxy/bastion host would be put in place to access
// the cluster.
logrus.Debugf("private install with userProvisionedDNS. Install host is not in the same network as the cluster. Not updating kubeconfig for cluster access.")
return nil
}
conn.Close()
}

dialer := &net.Dialer{
Timeout: 1 * time.Minute,
KeepAlive: 1 * time.Minute,
Expand Down