Skip to content

Commit 1fdd8fb

Browse files
authored
Merge pull request kubernetes#93263 from liggitt/windows
Fix windows kubelet startup
2 parents 275eabd + aea228f commit 1fdd8fb

File tree

6 files changed

+27
-52
lines changed

6 files changed

+27
-52
lines changed

pkg/kubelet/cm/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ go_library(
156156
],
157157
"@io_bazel_rules_go//go/platform:windows": [
158158
"//pkg/kubelet/cadvisor:go_default_library",
159-
"//pkg/kubelet/cm/devicemanager:go_default_library",
160159
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
161160
"//vendor/k8s.io/utils/mount:go_default_library",
162161
],

pkg/kubelet/cm/container_manager_windows.go

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
podresourcesapi "k8s.io/kubernetes/pkg/kubelet/apis/podresources/v1alpha1"
3737
"k8s.io/kubernetes/pkg/kubelet/cadvisor"
3838
"k8s.io/kubernetes/pkg/kubelet/cm/cpumanager"
39-
"k8s.io/kubernetes/pkg/kubelet/cm/devicemanager"
4039
"k8s.io/kubernetes/pkg/kubelet/cm/topologymanager"
4140
"k8s.io/kubernetes/pkg/kubelet/config"
4241
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
@@ -53,10 +52,6 @@ type containerManagerImpl struct {
5352
cadvisorInterface cadvisor.Interface
5453
// Config of this node.
5554
nodeConfig NodeConfig
56-
// Interface for exporting and allocating devices reported by device plugins.
57-
deviceManager devicemanager.Manager
58-
// Interface for Topology resource co-ordination
59-
topologyManager topologymanager.Manager
6055
}
6156

6257
type noopWindowsResourceAllocator struct{}
@@ -84,11 +79,6 @@ func (cm *containerManagerImpl) Start(node *v1.Node,
8479
}
8580
}
8681

87-
// Starts device manager.
88-
if err := cm.deviceManager.Start(devicemanager.ActivePodsFunc(activePods), sourcesReady); err != nil {
89-
return err
90-
}
91-
9282
return nil
9383
}
9484

@@ -103,23 +93,11 @@ func NewContainerManager(mountUtil mount.Interface, cadvisorInterface cadvisor.I
10393
}
10494
capacity := cadvisor.CapacityFromMachineInfo(machineInfo)
10595

106-
cm := &containerManagerImpl{
96+
return &containerManagerImpl{
10797
capacity: capacity,
10898
nodeConfig: nodeConfig,
10999
cadvisorInterface: cadvisorInterface,
110-
}
111-
112-
klog.Infof("Creating device plugin manager: %t", devicePluginEnabled)
113-
if devicePluginEnabled {
114-
cm.deviceManager, err = devicemanager.NewManagerImpl(nil, cm.topologyManager)
115-
} else {
116-
cm.deviceManager, err = devicemanager.NewManagerStub()
117-
}
118-
if err != nil {
119-
return nil, err
120-
}
121-
122-
return cm, nil
100+
}, nil
123101
}
124102

125103
func (cm *containerManagerImpl) SystemCgroupsLimit() v1.ResourceList {
@@ -172,36 +150,23 @@ func (cm *containerManagerImpl) GetCapacity() v1.ResourceList {
172150
}
173151

174152
func (cm *containerManagerImpl) GetPluginRegistrationHandler() cache.PluginHandler {
175-
return cm.deviceManager.GetWatcherHandler()
153+
return nil
176154
}
177155

178156
func (cm *containerManagerImpl) GetDevicePluginResourceCapacity() (v1.ResourceList, v1.ResourceList, []string) {
179-
return cm.deviceManager.GetCapacity()
157+
return nil, nil, []string{}
180158
}
181159

182160
func (cm *containerManagerImpl) NewPodContainerManager() PodContainerManager {
183161
return &podContainerManagerStub{}
184162
}
185163

186164
func (cm *containerManagerImpl) GetResources(pod *v1.Pod, container *v1.Container) (*kubecontainer.RunContainerOptions, error) {
187-
opts := &kubecontainer.RunContainerOptions{}
188-
// Allocate should already be called during predicateAdmitHandler.Admit(),
189-
// just try to fetch device runtime information from cached state here
190-
devOpts, err := cm.deviceManager.GetDeviceRunContainerOptions(pod, container)
191-
if err != nil {
192-
return nil, err
193-
} else if devOpts == nil {
194-
return opts, nil
195-
}
196-
opts.Devices = append(opts.Devices, devOpts.Devices...)
197-
opts.Mounts = append(opts.Mounts, devOpts.Mounts...)
198-
opts.Envs = append(opts.Envs, devOpts.Envs...)
199-
opts.Annotations = append(opts.Annotations, devOpts.Annotations...)
200-
return opts, nil
165+
return &kubecontainer.RunContainerOptions{}, nil
201166
}
202167

203-
func (cm *containerManagerImpl) UpdatePluginResources(node *schedulerframework.NodeInfo, attrs *lifecycle.PodAdmitAttributes) error {
204-
return cm.deviceManager.UpdatePluginResources(node, attrs)
168+
func (cm *containerManagerImpl) UpdatePluginResources(*schedulerframework.NodeInfo, *lifecycle.PodAdmitAttributes) error {
169+
return nil
205170
}
206171

207172
func (cm *containerManagerImpl) InternalContainerLifecycle() InternalContainerLifecycle {
@@ -212,12 +177,12 @@ func (cm *containerManagerImpl) GetPodCgroupRoot() string {
212177
return ""
213178
}
214179

215-
func (cm *containerManagerImpl) GetDevices(podUID, containerName string) []*podresourcesapi.ContainerDevices {
216-
return cm.deviceManager.GetDevices(podUID, containerName)
180+
func (cm *containerManagerImpl) GetDevices(_, _ string) []*podresourcesapi.ContainerDevices {
181+
return nil
217182
}
218183

219184
func (cm *containerManagerImpl) ShouldResetExtendedResourceCapacity() bool {
220-
return cm.deviceManager.ShouldResetExtendedResourceCapacity()
185+
return false
221186
}
222187

223188
func (cm *containerManagerImpl) GetAllocateResourcesPodAdmitHandler() lifecycle.PodAdmitHandler {

pkg/kubelet/dockershim/docker_sandbox.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -666,12 +666,6 @@ func (ds *dockerService) makeSandboxDockerConfig(c *runtimeapi.PodSandboxConfig,
666666
return createConfig, nil
667667
}
668668

669-
func (ds *dockerService) getSandBoxSecurityOpts(separator rune) []string {
670-
// run sandbox with no-new-privileges and using runtime/default
671-
// sending no "seccomp=" means docker will use default profile
672-
return []string{"no-new-privileges"}
673-
}
674-
675669
// networkNamespaceMode returns the network runtimeapi.NamespaceMode for this container.
676670
// Supports: POD, NODE
677671
func networkNamespaceMode(container *dockertypes.ContainerJSON) runtimeapi.NamespaceMode {

pkg/kubelet/dockershim/helpers_linux.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ func (ds *dockerService) getSecurityOpts(seccompProfile string, separator rune)
4848
return seccompSecurityOpts, nil
4949
}
5050

51+
func (ds *dockerService) getSandBoxSecurityOpts(separator rune) []string {
52+
// run sandbox with no-new-privileges and using runtime/default
53+
// sending no "seccomp=" means docker will use default profile
54+
return []string{"no-new-privileges"}
55+
}
56+
5157
func getSeccompDockerOpts(seccompProfile string) ([]dockerOpt, error) {
5258
if seccompProfile == "" || seccompProfile == v1.SeccompProfileNameUnconfined {
5359
// return early the default

pkg/kubelet/dockershim/helpers_unsupported.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ func (ds *dockerService) getSecurityOpts(seccompProfile string, separator rune)
3636
return nil, nil
3737
}
3838

39+
func (ds *dockerService) getSandBoxSecurityOpts(separator rune) []string {
40+
klog.Warningf("getSandBoxSecurityOpts is unsupported in this build")
41+
return nil
42+
}
43+
3944
func (ds *dockerService) updateCreateConfig(
4045
createConfig *dockertypes.ContainerCreateConfig,
4146
config *runtimeapi.ContainerConfig,

pkg/kubelet/dockershim/helpers_windows.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ func (ds *dockerService) getSecurityOpts(seccompProfile string, separator rune)
4343
return nil, nil
4444
}
4545

46+
func (ds *dockerService) getSandBoxSecurityOpts(separator rune) []string {
47+
// Currently, Windows container does not support privileged mode, so no no-new-privileges flag can be returned directly like Linux
48+
// If the future Windows container has new support for privileged mode, we can adjust it here
49+
return nil
50+
}
51+
4652
// applyExperimentalCreateConfig applys experimental configures from sandbox annotations.
4753
func applyExperimentalCreateConfig(createConfig *dockertypes.ContainerCreateConfig, annotations map[string]string) {
4854
if kubeletapis.ShouldIsolatedByHyperV(annotations) {

0 commit comments

Comments
 (0)