mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Merge pull request #52073 from derekwaynecarr/fix-cross-build
Automatic merge from submit-queue Fix cross-build **What this PR does / why we need it**: The cross-build was broken by the following PRs: https://github.com/kubernetes/kubernetes/pull/51728 https://github.com/kubernetes/kubernetes/pull/51557 This PR fixes the cross-build rather than revert them. Fixes https://github.com/kubernetes/kubernetes/issues/52074 **Release note**: ```release-note NONE ```
This commit is contained in:
commit
7386f0df9c
@ -11,11 +11,13 @@ go_library(
|
|||||||
srcs = [
|
srcs = [
|
||||||
"cadvisor_unsupported.go",
|
"cadvisor_unsupported.go",
|
||||||
"doc.go",
|
"doc.go",
|
||||||
|
"helpers_unsupported.go",
|
||||||
"types.go",
|
"types.go",
|
||||||
"util.go",
|
"util.go",
|
||||||
] + select({
|
] + select({
|
||||||
"@io_bazel_rules_go//go/platform:linux_amd64": [
|
"@io_bazel_rules_go//go/platform:linux_amd64": [
|
||||||
"cadvisor_linux.go",
|
"cadvisor_linux.go",
|
||||||
|
"helpers_linux.go",
|
||||||
],
|
],
|
||||||
"@io_bazel_rules_go//go/platform:windows_amd64": [
|
"@io_bazel_rules_go//go/platform:windows_amd64": [
|
||||||
"cadvisor_windows.go",
|
"cadvisor_windows.go",
|
||||||
@ -26,7 +28,6 @@ go_library(
|
|||||||
"//pkg/api/v1/helper:go_default_library",
|
"//pkg/api/v1/helper:go_default_library",
|
||||||
"//pkg/features:go_default_library",
|
"//pkg/features:go_default_library",
|
||||||
"//vendor/github.com/google/cadvisor/events:go_default_library",
|
"//vendor/github.com/google/cadvisor/events:go_default_library",
|
||||||
"//vendor/github.com/google/cadvisor/fs:go_default_library",
|
|
||||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||||
"//vendor/github.com/google/cadvisor/info/v2:go_default_library",
|
"//vendor/github.com/google/cadvisor/info/v2:go_default_library",
|
||||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||||
@ -38,6 +39,7 @@ go_library(
|
|||||||
"//vendor/github.com/golang/glog:go_default_library",
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
"//vendor/github.com/google/cadvisor/cache/memory:go_default_library",
|
"//vendor/github.com/google/cadvisor/cache/memory:go_default_library",
|
||||||
"//vendor/github.com/google/cadvisor/container:go_default_library",
|
"//vendor/github.com/google/cadvisor/container:go_default_library",
|
||||||
|
"//vendor/github.com/google/cadvisor/fs:go_default_library",
|
||||||
"//vendor/github.com/google/cadvisor/http:go_default_library",
|
"//vendor/github.com/google/cadvisor/http:go_default_library",
|
||||||
"//vendor/github.com/google/cadvisor/manager:go_default_library",
|
"//vendor/github.com/google/cadvisor/manager:go_default_library",
|
||||||
"//vendor/github.com/google/cadvisor/metrics:go_default_library",
|
"//vendor/github.com/google/cadvisor/metrics:go_default_library",
|
||||||
|
@ -80,3 +80,7 @@ func (cu *cadvisorUnsupported) WatchEvents(request *events.Request) (*events.Eve
|
|||||||
func (cu *cadvisorUnsupported) HasDedicatedImageFs() (bool, error) {
|
func (cu *cadvisorUnsupported) HasDedicatedImageFs() (bool, error) {
|
||||||
return false, unsupportedErr
|
return false, unsupportedErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *cadvisorUnsupported) GetFsInfoByFsUUID(uuid string) (cadvisorapiv2.FsInfo, error) {
|
||||||
|
return cadvisorapiv2.FsInfo{}, nil
|
||||||
|
}
|
||||||
|
@ -77,3 +77,7 @@ func (cu *cadvisorClient) WatchEvents(request *events.Request) (*events.EventCha
|
|||||||
func (cu *cadvisorClient) HasDedicatedImageFs() (bool, error) {
|
func (cu *cadvisorClient) HasDedicatedImageFs() (bool, error) {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *cadvisorClient) GetFsInfoByFsUUID(uuid string) (cadvisorapiv2.FsInfo, error) {
|
||||||
|
return cadvisorapiv2.FsInfo{}, nil
|
||||||
|
}
|
||||||
|
54
pkg/kubelet/cadvisor/helpers_linux.go
Normal file
54
pkg/kubelet/cadvisor/helpers_linux.go
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// +build cgo,linux
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2017 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 (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
cadvisorfs "github.com/google/cadvisor/fs"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 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}
|
||||||
|
}
|
34
pkg/kubelet/cadvisor/helpers_unsupported.go
Normal file
34
pkg/kubelet/cadvisor/helpers_unsupported.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// +build !linux linux,!cgo
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2017 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 "errors"
|
||||||
|
|
||||||
|
type unsupportedImageFsInfoProvider struct{}
|
||||||
|
|
||||||
|
// ImageFsInfoLabel returns the image fs label for the configured runtime.
|
||||||
|
// For remote runtimes, it handles additional runtimes natively understood by cAdvisor.
|
||||||
|
func (i *unsupportedImageFsInfoProvider) ImageFsInfoLabel() (string, error) {
|
||||||
|
return "", errors.New("unsupported")
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewImageFsInfoProvider returns a provider for the specified runtime configuration.
|
||||||
|
func NewImageFsInfoProvider(runtime, runtimeEndpoint string) ImageFsInfoProvider {
|
||||||
|
return &unsupportedImageFsInfoProvider{}
|
||||||
|
}
|
@ -17,9 +17,6 @@ limitations under the License.
|
|||||||
package cadvisor
|
package cadvisor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
cadvisorfs "github.com/google/cadvisor/fs"
|
|
||||||
cadvisorapi "github.com/google/cadvisor/info/v1"
|
cadvisorapi "github.com/google/cadvisor/info/v1"
|
||||||
cadvisorapi2 "github.com/google/cadvisor/info/v2"
|
cadvisorapi2 "github.com/google/cadvisor/info/v2"
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
@ -29,35 +26,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/features"
|
"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 {
|
func CapacityFromMachineInfo(info *cadvisorapi.MachineInfo) v1.ResourceList {
|
||||||
c := v1.ResourceList{
|
c := v1.ResourceList{
|
||||||
v1.ResourceCPU: *resource.NewMilliQuantity(
|
v1.ResourceCPU: *resource.NewMilliQuantity(
|
||||||
|
Loading…
Reference in New Issue
Block a user