Skip to content

Commit

Permalink
Revert "Network: Explicit pass the api/apps and domain details of bun…
Browse files Browse the repository at this point in the history
…dle"

This reverts commit c79d568.

With CheckCRCLocalDNSReachableFromHost now moved to the 'dns' package,
the 'cyclic dependency' failure this was meant to resolve is no longer
an issue.
  • Loading branch information
cfergeau authored and openshift-merge-robot committed Nov 28, 2022
1 parent ea74e2c commit 04645c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pkg/crc/machine/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,7 @@ func (client *client) Start(ctx context.Context, startConfig types.StartConfig)

// Check DNS lookup from host to VM
logging.Info("Check DNS query from host...")
if err := dns.CheckCRCLocalDNSReachableFromHost(vm.bundle.GetAPIHostname(),
vm.bundle.GetAppHostname("foo"), vm.bundle.ClusterInfo.AppsDomain, instanceIP); err != nil {
if err := dns.CheckCRCLocalDNSReachableFromHost(vm.bundle, instanceIP); err != nil {
if !client.useVSock() {
return nil, errors.Wrap(err, "Failed to query DNS from host")
}
Expand Down
7 changes: 5 additions & 2 deletions pkg/crc/services/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/crc-org/crc/pkg/crc/constants"
"github.com/crc-org/crc/pkg/crc/errors"
"github.com/crc-org/crc/pkg/crc/logging"
"github.com/crc-org/crc/pkg/crc/machine/bundle"
"github.com/crc-org/crc/pkg/crc/network"
"github.com/crc-org/crc/pkg/crc/services"
"github.com/crc-org/crc/pkg/crc/systemd"
Expand Down Expand Up @@ -145,7 +146,8 @@ func CheckCRCPublicDNSReachable(serviceConfig services.ServicePostStartConfig) (
return stdout, err
}

func CheckCRCLocalDNSReachableFromHost(apiHostname, appsHostname, appsDomain, expectedIP string) error {
func CheckCRCLocalDNSReachableFromHost(bundle *bundle.CrcBundleInfo, expectedIP string) error {
apiHostname := bundle.GetAPIHostname()
ip, err := net.LookupIP(apiHostname)
if err != nil {
return err
Expand All @@ -161,14 +163,15 @@ func CheckCRCLocalDNSReachableFromHost(apiHostname, appsHostname, appsDomain, ex
* in this case, /etc/resolver/ will not be used, so we won't
* have wildcard DNS for our domains
*/
appsHostname := bundle.GetAppHostname("foo")
ip, err = net.LookupIP(appsHostname)
if err != nil {
// Right now admin helper fallback is not implemented on windows so
// this check should still return an error.
if runtime.GOOS == "windows" {
return err
}
logging.Warnf("Wildcard DNS resolution for %s does not appear to be working", appsDomain)
logging.Warnf("Wildcard DNS resolution for %s does not appear to be working", bundle.ClusterInfo.AppsDomain)
return nil
}
logging.Debugf("%s resolved to %s", appsHostname, ip)
Expand Down

0 comments on commit 04645c2

Please sign in to comment.