Skip to content

Commit

Permalink
Fixed kubelet build.
Browse files Browse the repository at this point in the history
  • Loading branch information
pires committed Nov 1, 2016
1 parent 66a1ef2 commit 9e6815e
Show file tree
Hide file tree
Showing 10 changed files with 237 additions and 77 deletions.
74 changes: 0 additions & 74 deletions pkg/kubelet/cadvisor/cadvisor_stub.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/kubelet/cadvisor/cadvisor_unsupported.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !cgo !linux
// +build !linux,!windows

/*
Copyright 2015 The Kubernetes Authors.
Expand Down
75 changes: 75 additions & 0 deletions pkg/kubelet/cadvisor/cadvisor_windows.go
Original file line number Diff line number Diff line change
@@ -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
}
64 changes: 64 additions & 0 deletions pkg/kubelet/cm/container_manager_unsupported.go
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion pkg/kubelet/cm/container_manager_unsupported_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !linux
// +build !linux,!windows

/*
Copyright 2015 The Kubernetes Authors.
Expand Down
18 changes: 17 additions & 1 deletion pkg/kubelet/cm/container_manager_windows.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build windows

/*
Copyright 2015 The Kubernetes Authors.
Expand All @@ -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"
)

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 NewStubContainerManager(), nil
return &containerManagerImpl{}, nil
}
1 change: 1 addition & 0 deletions pkg/kubelet/dockertools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 18 additions & 0 deletions pkg/kubelet/dockertools/docker_manager_linux.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
42 changes: 42 additions & 0 deletions pkg/kubelet/dockertools/docker_manager_unsupported.go
Original file line number Diff line number Diff line change
@@ -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
}
18 changes: 18 additions & 0 deletions pkg/kubelet/dockertools/docker_manager_windows.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down

0 comments on commit 9e6815e

Please sign in to comment.