Code change:
procGetNetworkParams = iphlpapidll.MustFindProc("GetNetworkParams") ) <ins> func fileExists(filename string) (bool, error) { stat, err := os.Stat(filename) if os.IsNotExist(err) { return false, nil } if err != nil { return false, err } return stat.Mode().IsRegular(), nil } </ins> func getHostDNSConfig(resolverConfig string) (*runtimeapi.DNSConfig, error) { <del> if resolverConfig != "" && resolverConfig != hostResolvConf { err := fmt.Errorf(`Unexpected resolver config value: "%s". Expected "" or "%s".`, resolverConfig, hostResolvConf) </del> <ins> if resolverConfig == "" { // This handles "" by returning defaults. return getDNSConfig(resolverConfig) } isFile, err := fileExists(resolverConfig) if err != nil { err = fmt.Errorf(`Unexpected error while getting os.Stat for "%s" resolver config. Error: %w`, resolverConfig, err) </ins> klog.ErrorS(err, "Cannot get host DNS Configuration.") return nil, err } <ins> if isFile { // Get the DNS config from a resolv.conf-like file. return getDNSConfig(resolverConfig) } </ins> <del> var ( hostDNS, hostSearch []string err                 error ) </del> <ins> if resolverConfig != hostResolvConf { err := fmt.Errorf(`Unexpected resolver config value: "%s". Expected "", "%s", or a path to an existing resolv.conf file.`, resolverConfig, hostResolvConf) klog.ErrorS(err, "Cannot get host DNS Configuration.") return nil, err } // If we get here, the resolverConfig == hostResolvConf and that is not actually a file, so // it means to use the host settings. </ins> // Get host DNS settings <del> if resolverConfig == hostResolvConf { hostDNS, err = getDNSServerList() if err != nil { err = fmt.Errorf("Could not get the host's DNS Server List. Error: %w", err) klog.ErrorS(err, "Encountered error while getting host's DNS Server List.") return nil, err } hostSearch, err = getDNSSuffixList() if err != nil { err = fmt.Errorf("Could not get the host's DNS Suffix List. Error: %w", err) klog.ErrorS(err, "Encountered error while getting host's DNS Suffix List.") return nil, err } </del> <ins> hostDNS, err := getDNSServerList() if err != nil { err = fmt.Errorf("Could not get the host's DNS Server List. Error: %w", err) klog.ErrorS(err, "Encountered error while getting host's DNS Server List.") return nil, err } hostSearch, err := getDNSSuffixList() if err != nil { err = fmt.Errorf("Could not get the host's DNS Suffix List. Error: %w", err) klog.ErrorS(err, "Encountered error while getting host's DNS Suffix List.") return nil, err </ins> } return &runtimeapi.DNSConfig{ Servers:  hostDNS,

Related discussion:
text: When a --resolv-conf (DNS resolver config) is passed to kubelet on a Windows node, the config content is used as part of sandbox initialization (through getHostDNSConfig()). Now with the recent changes (), it seems now to fail with an error like: E0315 10:22:16. 4764 ] "Error syncing pod, skipping" err="failed to "CreatePodSandbox" for "img-pull-(-b40a-459d-9033-)" with CreatePodSandboxError: "Failed to generate sandbox config for pod "img-pull-(-b40a-459d-9033-)": Unexpected resolver config value: "C:etckubernetescni". Expected "" or "Host"."" pod="img-puller-3842/img-pull-" podUID=-b40a-459d-9033- This is showing on all the runs of GCE testgrid (latest): Reading/using the passed resolv config on Windows Run a Windows pool with DNS resolv config being set as part of kubelet params. No response_ 27 alpha.3 1.27 beta.0 master <detailsGCE </details<details</details<details</details<details</details<details</details
/triage accepted /milestone v1.27 /sig node /sig network
/sig windows /cc
/priority criticial-urgent as this is likely a release blocking
The label(s) cannot be applied, because the repository doesn't have them. <detailsIn response to : /priority criticial-urgent Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/priority critical-urgent
Hmm, so you're setting the [1]. This PR introduced the capability to read the DNS config options from the Windows host registries while removing the capability to read from a file, introducing a regression. I've sent a PR addressing this issue: [1]
Is the file you are pointing to a UNIX-style or something else?
Was the file changing the behavior of the node?