Fix cross-build

This commit is contained in:
Derek Carr
2017-09-07 00:28:58 -04:00
parent ea017719e5
commit 27365eb900
6 changed files with 99 additions and 33 deletions

View File

@@ -17,9 +17,6 @@ limitations under the License.
package cadvisor
import (
"fmt"
cadvisorfs "github.com/google/cadvisor/fs"
cadvisorapi "github.com/google/cadvisor/info/v1"
cadvisorapi2 "github.com/google/cadvisor/info/v2"
"k8s.io/api/core/v1"
@@ -29,35 +26,6 @@ import (
"k8s.io/kubernetes/pkg/features"
)
// imageFsInfoProvider knows how to translate the configured runtime
// to its file system label for images.
type imageFsInfoProvider struct {
runtime string
runtimeEndpoint string
}
// ImageFsInfoLabel returns the image fs label for the configured runtime.
// For remote runtimes, it handles additional runtimes natively understood by cAdvisor.
func (i *imageFsInfoProvider) ImageFsInfoLabel() (string, error) {
switch i.runtime {
case "docker":
return cadvisorfs.LabelDockerImages, nil
case "rkt":
return cadvisorfs.LabelRktImages, nil
case "remote":
// TODO: pending rebase including https://github.com/google/cadvisor/pull/1741
if i.runtimeEndpoint == "/var/run/crio.sock" {
return "crio-images", nil
}
}
return "", fmt.Errorf("no imagefs label for configured runtime")
}
// NewImageFsInfoProvider returns a provider for the specified runtime configuration.
func NewImageFsInfoProvider(runtime, runtimeEndpoint string) ImageFsInfoProvider {
return &imageFsInfoProvider{runtime: runtime, runtimeEndpoint: runtimeEndpoint}
}
func CapacityFromMachineInfo(info *cadvisorapi.MachineInfo) v1.ResourceList {
c := v1.ResourceList{
v1.ResourceCPU: *resource.NewMilliQuantity(