Merge pull request #83730 from claudiubelu/windows/containerd-etc-hosts

Windows: Fixes /etc/hosts file mounting support for containerd
This commit is contained in:
Kubernetes Prow Robot
2021-03-05 05:08:22 -08:00
committed by GitHub
5 changed files with 23 additions and 9 deletions

View File

@@ -144,7 +144,8 @@ const (
evictionMonitoringPeriod = time.Second * 10
// The path in containers' filesystems where the hosts file is mounted.
etcHostsPath = "/etc/hosts"
linuxEtcHostsPath = "/etc/hosts"
windowsEtcHostsPath = "C:\\Windows\\System32\\drivers\\etc\\hosts"
// Capacity of the channel for receiving pod lifecycle events. This number
// is a bit arbitrary and may be adjusted in the future.
@@ -177,6 +178,15 @@ const (
nodeLeaseRenewIntervalFraction = 0.25
)
var etcHostsPath = getContainerEtcHostsPath()
func getContainerEtcHostsPath() string {
if sysruntime.GOOS == "windows" {
return windowsEtcHostsPath
}
return linuxEtcHostsPath
}
// SyncHandler is an interface implemented by Kubelet, for testability
type SyncHandler interface {
HandlePodAdditions(pods []*v1.Pod)