Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
27365eb9
Commit
27365eb9
authored
Sep 07, 2017
by
Derek Carr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cross-build
parent
ea017719
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
33 deletions
+99
-33
BUILD
pkg/kubelet/cadvisor/BUILD
+3
-1
cadvisor_unsupported.go
pkg/kubelet/cadvisor/cadvisor_unsupported.go
+4
-0
cadvisor_windows.go
pkg/kubelet/cadvisor/cadvisor_windows.go
+4
-0
helpers_linux.go
pkg/kubelet/cadvisor/helpers_linux.go
+54
-0
helpers_unsupported.go
pkg/kubelet/cadvisor/helpers_unsupported.go
+34
-0
util.go
pkg/kubelet/cadvisor/util.go
+0
-32
No files found.
pkg/kubelet/cadvisor/BUILD
View file @
27365eb9
...
...
@@ -11,11 +11,13 @@ go_library(
srcs = [
"cadvisor_unsupported.go",
"doc.go",
"helpers_unsupported.go",
"types.go",
"util.go",
] + select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"cadvisor_linux.go",
"helpers_linux.go",
],
"@io_bazel_rules_go//go/platform:windows_amd64": [
"cadvisor_windows.go",
...
...
@@ -26,7 +28,6 @@ go_library(
"//pkg/api/v1/helper:go_default_library",
"//pkg/features: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/v2: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/google/cadvisor/cache/memory: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/manager:go_default_library",
"//vendor/github.com/google/cadvisor/metrics:go_default_library",
...
...
pkg/kubelet/cadvisor/cadvisor_unsupported.go
View file @
27365eb9
...
...
@@ -80,3 +80,7 @@ func (cu *cadvisorUnsupported) WatchEvents(request *events.Request) (*events.Eve
func
(
cu
*
cadvisorUnsupported
)
HasDedicatedImageFs
()
(
bool
,
error
)
{
return
false
,
unsupportedErr
}
func
(
c
*
cadvisorUnsupported
)
GetFsInfoByFsUUID
(
uuid
string
)
(
cadvisorapiv2
.
FsInfo
,
error
)
{
return
cadvisorapiv2
.
FsInfo
{},
nil
}
pkg/kubelet/cadvisor/cadvisor_windows.go
View file @
27365eb9
...
...
@@ -77,3 +77,7 @@ func (cu *cadvisorClient) WatchEvents(request *events.Request) (*events.EventCha
func
(
cu
*
cadvisorClient
)
HasDedicatedImageFs
()
(
bool
,
error
)
{
return
false
,
nil
}
func
(
c
*
cadvisorClient
)
GetFsInfoByFsUUID
(
uuid
string
)
(
cadvisorapiv2
.
FsInfo
,
error
)
{
return
cadvisorapiv2
.
FsInfo
{},
nil
}
pkg/kubelet/cadvisor/helpers_linux.go
0 → 100644
View file @
27365eb9
// +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
}
}
pkg/kubelet/cadvisor/helpers_unsupported.go
0 → 100644
View file @
27365eb9
// +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
{}
}
pkg/kubelet/cadvisor/util.go
View file @
27365eb9
...
...
@@ -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
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment