Skip to content

Commit

Permalink
dns: Pass CheckCRCLocalDNSReachableFromHost to ServicePostStartConfig
Browse files Browse the repository at this point in the history
This is consistent with the other methods in this file.
  • Loading branch information
cfergeau authored and openshift-merge-robot committed Nov 28, 2022
1 parent 04645c2 commit 725fd52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/crc/machine/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +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, instanceIP); err != nil {
if err := dns.CheckCRCLocalDNSReachableFromHost(servicePostStartConfig); err != nil {
if !client.useVSock() {
return nil, errors.Wrap(err, "Failed to query DNS from host")
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/crc/services/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ 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 @@ -146,15 +145,16 @@ func CheckCRCPublicDNSReachable(serviceConfig services.ServicePostStartConfig) (
return stdout, err
}

func CheckCRCLocalDNSReachableFromHost(bundle *bundle.CrcBundleInfo, expectedIP string) error {
func CheckCRCLocalDNSReachableFromHost(serviceConfig services.ServicePostStartConfig) error {
bundle := serviceConfig.BundleMetadata
apiHostname := bundle.GetAPIHostname()
ip, err := net.LookupIP(apiHostname)
if err != nil {
return err
}
logging.Debugf("%s resolved to %s", apiHostname, ip)
if !matchIP(ip, expectedIP) {
logging.Warnf("%s resolved to %s but %s was expected", apiHostname, ip, expectedIP)
if !matchIP(ip, serviceConfig.IP) {
logging.Warnf("%s resolved to %s but %s was expected", apiHostname, ip, serviceConfig.IP)
return fmt.Errorf("Invalid IP for %s", apiHostname)
}

Expand All @@ -175,8 +175,8 @@ func CheckCRCLocalDNSReachableFromHost(bundle *bundle.CrcBundleInfo, expectedIP
return nil
}
logging.Debugf("%s resolved to %s", appsHostname, ip)
if !matchIP(ip, expectedIP) {
logging.Warnf("%s resolved to %s but %s was expected", appsHostname, ip, expectedIP)
if !matchIP(ip, serviceConfig.IP) {
logging.Warnf("%s resolved to %s but %s was expected", appsHostname, ip, serviceConfig.IP)
return fmt.Errorf("Invalid IP for %s", appsHostname)
}
}
Expand Down

0 comments on commit 725fd52

Please sign in to comment.