diff --git a/pkg/kubelet/cadvisor/cadvisor_stub.go b/pkg/kubelet/cadvisor/cadvisor_stub.go deleted file mode 100644 index f2cb6e3e73f..00000000000 --- a/pkg/kubelet/cadvisor/cadvisor_stub.go +++ /dev/null @@ -1,74 +0,0 @@ -// +build darwin windows - -/* -Copyright 2015 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package cadvisor - -import ( - "github.com/google/cadvisor/events" - cadvisorapi "github.com/google/cadvisor/info/v1" - cadvisorapiv2 "github.com/google/cadvisor/info/v2" -) - -type cadvisorStub struct { -} - -var _ Interface = new(cadvisorStub) - -func New(port uint, runtime string) (Interface, error) { - return &cadvisorStub{}, nil -} - -func (cu *cadvisorStub) Start() error { - return nil -} - -func (cu *cadvisorStub) DockerContainer(name string, req *cadvisorapi.ContainerInfoRequest) (cadvisorapi.ContainerInfo, error) { - return cadvisorapi.ContainerInfo{}, nil -} - -func (cu *cadvisorStub) ContainerInfo(name string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error) { - return &cadvisorapi.ContainerInfo{}, nil -} - -func (cu *cadvisorStub) ContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error) { - return make(map[string]cadvisorapiv2.ContainerInfo), nil -} - -func (cu *cadvisorStub) SubcontainerInfo(name string, req *cadvisorapi.ContainerInfoRequest) (map[string]*cadvisorapi.ContainerInfo, error) { - return nil, nil -} - -func (cu *cadvisorStub) MachineInfo() (*cadvisorapi.MachineInfo, error) { - return &cadvisorapi.MachineInfo{}, nil -} - -func (cu *cadvisorStub) VersionInfo() (*cadvisorapi.VersionInfo, error) { - return &cadvisorapi.VersionInfo{}, nil -} - -func (cu *cadvisorStub) ImagesFsInfo() (cadvisorapiv2.FsInfo, error) { - return cadvisorapiv2.FsInfo{}, nil -} - -func (cu *cadvisorStub) RootFsInfo() (cadvisorapiv2.FsInfo, error) { - return cadvisorapiv2.FsInfo{}, nil -} - -func (cu *cadvisorStub) WatchEvents(request *events.Request) (*events.EventChannel, error) { - return &events.EventChannel{}, nil -} diff --git a/pkg/kubelet/cadvisor/cadvisor_unsupported.go b/pkg/kubelet/cadvisor/cadvisor_unsupported.go index fc3b3166870..dc7b9fbd4d6 100644 --- a/pkg/kubelet/cadvisor/cadvisor_unsupported.go +++ b/pkg/kubelet/cadvisor/cadvisor_unsupported.go @@ -1,4 +1,4 @@ -// +build !cgo !linux +// +build !linux,!windows /* Copyright 2015 The Kubernetes Authors. diff --git a/pkg/kubelet/cadvisor/cadvisor_windows.go b/pkg/kubelet/cadvisor/cadvisor_windows.go new file mode 100644 index 00000000000..a970f096d58 --- /dev/null +++ b/pkg/kubelet/cadvisor/cadvisor_windows.go @@ -0,0 +1,75 @@ +// +build windows + +/* +Copyright 2015 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cadvisor + +import ( + "github.com/google/cadvisor/events" + cadvisorapi "github.com/google/cadvisor/info/v1" + cadvisorapiv2 "github.com/google/cadvisor/info/v2" +) + +type cadvisorClient struct { +} + +var _ Interface = new(cadvisorClient) + +// New creates a cAdvisor and exports its API on the specified port if port > 0. +func New(port uint, runtime string, rootPath string) (Interface, error) { + return &cadvisorClient{}, nil +} + +func (cu *cadvisorClient) Start() error { + return nil +} + +func (cu *cadvisorClient) DockerContainer(name string, req *cadvisorapi.ContainerInfoRequest) (cadvisorapi.ContainerInfo, error) { + return cadvisorapi.ContainerInfo{}, nil +} + +func (cu *cadvisorClient) ContainerInfo(name string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error) { + return &cadvisorapi.ContainerInfo{}, nil +} + +func (cu *cadvisorClient) ContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error) { + return make(map[string]cadvisorapiv2.ContainerInfo), nil +} + +func (cu *cadvisorClient) SubcontainerInfo(name string, req *cadvisorapi.ContainerInfoRequest) (map[string]*cadvisorapi.ContainerInfo, error) { + return nil, nil +} + +func (cu *cadvisorClient) MachineInfo() (*cadvisorapi.MachineInfo, error) { + return &cadvisorapi.MachineInfo{}, nil +} + +func (cu *cadvisorClient) VersionInfo() (*cadvisorapi.VersionInfo, error) { + return &cadvisorapi.VersionInfo{}, nil +} + +func (cu *cadvisorClient) ImagesFsInfo() (cadvisorapiv2.FsInfo, error) { + return cadvisorapiv2.FsInfo{}, nil +} + +func (cu *cadvisorClient) RootFsInfo() (cadvisorapiv2.FsInfo, error) { + return cadvisorapiv2.FsInfo{}, nil +} + +func (cu *cadvisorClient) WatchEvents(request *events.Request) (*events.EventChannel, error) { + return &events.EventChannel{}, nil +} diff --git a/pkg/kubelet/cm/container_manager_unsupported.go b/pkg/kubelet/cm/container_manager_unsupported.go new file mode 100644 index 00000000000..0db75bd2ada --- /dev/null +++ b/pkg/kubelet/cm/container_manager_unsupported.go @@ -0,0 +1,64 @@ +// +build !linux,!windows + +/* +Copyright 2015 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package cm + +import ( + "fmt" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/kubelet/cadvisor" + "k8s.io/kubernetes/pkg/util/mount" +) + +type unsupportedContainerManager struct { +} + +var _ ContainerManager = &unsupportedContainerManager{} + +func (unsupportedContainerManager) Start(_ *api.Node) error { + return fmt.Errorf("Container Manager is unsupported in this build") +} + +func (unsupportedContainerManager) SystemCgroupsLimit() api.ResourceList { + return api.ResourceList{} +} + +func (unsupportedContainerManager) GetNodeConfig() NodeConfig { + return NodeConfig{} +} + +func (unsupportedContainerManager) GetMountedSubsystems() *CgroupSubsystems { + return &CgroupSubsystems{} +} + +func (unsupportedContainerManager) GetQOSContainersInfo() QOSContainersInfo { + return QOSContainersInfo{} +} + +func (cm *unsupportedContainerManager) Status() Status { + return Status{} +} + +func (cm *unsupportedContainerManager) NewPodContainerManager() PodContainerManager { + return &unsupportedPodContainerManager{} +} + +func NewContainerManager(_ mount.Interface, _ cadvisor.Interface, _ NodeConfig) (ContainerManager, error) { + return &unsupportedContainerManager{}, nil +} diff --git a/pkg/kubelet/cm/container_manager_unsupported_test.go b/pkg/kubelet/cm/container_manager_unsupported_test.go index 9e09d32a895..4c4e5e25d8d 100644 --- a/pkg/kubelet/cm/container_manager_unsupported_test.go +++ b/pkg/kubelet/cm/container_manager_unsupported_test.go @@ -1,4 +1,4 @@ -// +build !linux +// +build !linux,!windows /* Copyright 2015 The Kubernetes Authors. diff --git a/pkg/kubelet/cm/container_manager_windows.go b/pkg/kubelet/cm/container_manager_windows.go index 8b72179aa76..be257e8a474 100644 --- a/pkg/kubelet/cm/container_manager_windows.go +++ b/pkg/kubelet/cm/container_manager_windows.go @@ -1,3 +1,5 @@ +// +build windows + /* Copyright 2015 The Kubernetes Authors. @@ -17,10 +19,24 @@ limitations under the License. package cm import ( + "github.com/golang/glog" + + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/kubelet/cadvisor" "k8s.io/kubernetes/pkg/util/mount" ) -func NewContainerManager(mountUtil mount.Interface, cadvisorInterface cadvisor.Interface, nodeConfig NodeConfig) (ContainerManager, error) { - return NewStubContainerManager(), nil +type containerManagerImpl struct { + containerManagerStub +} + +var _ ContainerManager = &containerManagerImpl{} + +func (cm *containerManagerImpl) Start(_ *api.Node) error { + glog.V(2).Infof("Starting Windows stub container manager") + return nil +} + +func NewContainerManager(mountUtil mount.Interface, cadvisorInterface cadvisor.Interface, nodeConfig NodeConfig) (ContainerManager, error) { + return &containerManagerImpl{}, nil } diff --git a/pkg/kubelet/dockertools/BUILD b/pkg/kubelet/dockertools/BUILD index 690da58bb2b..7b919595f7b 100644 --- a/pkg/kubelet/dockertools/BUILD +++ b/pkg/kubelet/dockertools/BUILD @@ -17,6 +17,7 @@ go_library( "convert.go", "docker.go", "docker_manager.go", + "docker_manager_linux.go", "exec.go", "fake_docker_client.go", "fake_manager.go", diff --git a/pkg/kubelet/dockertools/docker_manager_linux.go b/pkg/kubelet/dockertools/docker_manager_linux.go index 3d19e94d35a..2a520468578 100644 --- a/pkg/kubelet/dockertools/docker_manager_linux.go +++ b/pkg/kubelet/dockertools/docker_manager_linux.go @@ -1,3 +1,21 @@ +// +build linux + +/* +Copyright 2015 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package dockertools import ( diff --git a/pkg/kubelet/dockertools/docker_manager_unsupported.go b/pkg/kubelet/dockertools/docker_manager_unsupported.go new file mode 100644 index 00000000000..8182784a161 --- /dev/null +++ b/pkg/kubelet/dockertools/docker_manager_unsupported.go @@ -0,0 +1,42 @@ +// +build !linux,!windows + +/* +Copyright 2015 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package dockertools + +import ( + "k8s.io/kubernetes/pkg/api" + + dockertypes "github.com/docker/engine-api/types" +) + +func getContainerIP(container *dockertypes.ContainerJSON) string { + return "" +} + +func getNetworkingMode() string { + return "" +} + +func containerProvidesPodIP(name *KubeletContainerName) bool { + return false +} + +// Returns nil as both Seccomp and AppArmor security options are not valid on Windows +func (dm *DockerManager) getSecurityOpts(pod *api.Pod, ctrName string) ([]dockerOpt, error) { + return nil, nil +} diff --git a/pkg/kubelet/dockertools/docker_manager_windows.go b/pkg/kubelet/dockertools/docker_manager_windows.go index da8b8293816..cb32cc7aa72 100644 --- a/pkg/kubelet/dockertools/docker_manager_windows.go +++ b/pkg/kubelet/dockertools/docker_manager_windows.go @@ -1,3 +1,21 @@ +// +build windows + +/* +Copyright 2015 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package dockertools import (