bump(github.com/google/cadvisor): cda62a43857256fbc95dd31e7c810888f00f8ec7

pull/6/head
Seth Jennings 2017-09-08 09:45:12 -05:00
parent a416534744
commit 0b05238669
11 changed files with 999 additions and 80 deletions

165
Godeps/Godeps.json generated
View File

@ -1368,203 +1368,208 @@
},
{
"ImportPath": "github.com/google/cadvisor/api",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/cache/memory",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/client/v2",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/collector",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/container",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/container/common",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/container/crio",
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/container/docker",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/container/libcontainer",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/container/raw",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/container/rkt",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/container/systemd",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/devicemapper",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/events",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/fs",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/healthz",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/http",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/http/mux",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/info/v1",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/info/v2",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/machine",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/manager",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/manager/watcher",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/manager/watcher/raw",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/manager/watcher/rkt",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/metrics",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/pages",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/pages/static",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/storage",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/summary",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/utils",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/utils/cloudinfo",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/utils/cpuload",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/utils/cpuload/netlink",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/utils/docker",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/utils/oomparser",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/utils/sysfs",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/utils/sysinfo",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/validate",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/version",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/cadvisor/zfs",
"Comment": "v0.27.0-2-g1df21ea",
"Rev": "1df21eaa592316b0889db44ab0b3c22d66846482"
"Comment": "v0.27.1",
"Rev": "cda62a43857256fbc95dd31e7c810888f00f8ec7"
},
{
"ImportPath": "github.com/google/certificate-transparency/go",

198
Godeps/LICENSES generated
View File

@ -45973,6 +45973,204 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================================================
================================================================================
= vendor/github.com/google/cadvisor/container/crio licensed under: =
Copyright 2014 The cAdvisor 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.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
= vendor/github.com/google/cadvisor/LICENSE e7790b946bfacb700e8a8f2baedb3205
================================================================================
================================================================================
= vendor/github.com/google/cadvisor/container/docker licensed under: =

View File

@ -26,6 +26,7 @@ filegroup(
srcs = [
":package-srcs",
"//vendor/github.com/google/cadvisor/container/common:all-srcs",
"//vendor/github.com/google/cadvisor/container/crio:all-srcs",
"//vendor/github.com/google/cadvisor/container/docker:all-srcs",
"//vendor/github.com/google/cadvisor/container/libcontainer:all-srcs",
"//vendor/github.com/google/cadvisor/container/raw:all-srcs",

View File

@ -34,6 +34,7 @@ const (
ContainerTypeDocker
ContainerTypeRkt
ContainerTypeSystemd
ContainerTypeCrio
)
// Interface for container operation handlers.

37
vendor/github.com/google/cadvisor/container/crio/BUILD generated vendored Normal file
View File

@ -0,0 +1,37 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"client.go",
"factory.go",
"handler.go",
],
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/github.com/google/cadvisor/container:go_default_library",
"//vendor/github.com/google/cadvisor/container/common:go_default_library",
"//vendor/github.com/google/cadvisor/container/libcontainer: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/manager/watcher:go_default_library",
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups:go_default_library",
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs:go_default_library",
"//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,130 @@
// Copyright 2017 Google Inc. 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 crio
import (
"encoding/json"
"fmt"
"net"
"net/http"
"syscall"
"time"
)
const (
CrioSocket = "/var/run/crio.sock"
maxUnixSocketPathSize = len(syscall.RawSockaddrUnix{}.Path)
)
// Info represents CRI-O information as sent by the CRI-O server
type Info struct {
StorageDriver string `json:"storage_driver"`
StorageRoot string `json:"storage_root"`
}
// ContainerInfo represents a given container information
type ContainerInfo struct {
Name string `json:"name"`
Pid int `json:"pid"`
Image string `json:"image"`
CreatedTime int64 `json:"created_time"`
Labels map[string]string `json:"labels"`
Annotations map[string]string `json:"annotations"`
LogPath string `json:"log_path"`
Root string `json:"root"`
IP string `json:"ip_address"`
}
type crioClient interface {
Info() (Info, error)
ContainerInfo(string) (*ContainerInfo, error)
}
type crioClientImpl struct {
client *http.Client
}
func configureUnixTransport(tr *http.Transport, proto, addr string) error {
if len(addr) > maxUnixSocketPathSize {
return fmt.Errorf("Unix socket path %q is too long", addr)
}
// No need for compression in local communications.
tr.DisableCompression = true
tr.Dial = func(_, _ string) (net.Conn, error) {
return net.DialTimeout(proto, addr, 32*time.Second)
}
return nil
}
// Client returns a new configured CRI-O client
func Client() (crioClient, error) {
tr := new(http.Transport)
configureUnixTransport(tr, "unix", CrioSocket)
c := &http.Client{
Transport: tr,
}
return &crioClientImpl{
client: c,
}, nil
}
func getRequest(path string) (*http.Request, error) {
req, err := http.NewRequest("GET", path, nil)
if err != nil {
return nil, err
}
// For local communications over a unix socket, it doesn't matter what
// the host is. We just need a valid and meaningful host name.
req.Host = "crio"
req.URL.Host = CrioSocket
req.URL.Scheme = "http"
return req, nil
}
// Info returns generic info from the CRI-O server
func (c *crioClientImpl) Info() (Info, error) {
info := Info{}
req, err := getRequest("/info")
if err != nil {
return info, err
}
resp, err := c.client.Do(req)
if err != nil {
return info, err
}
defer resp.Body.Close()
if err := json.NewDecoder(resp.Body).Decode(&info); err != nil {
return info, err
}
return info, nil
}
// ContainerInfo returns information about a given container
func (c *crioClientImpl) ContainerInfo(id string) (*ContainerInfo, error) {
req, err := getRequest("/containers/" + id)
if err != nil {
return nil, err
}
resp, err := c.client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
cInfo := ContainerInfo{}
if err := json.NewDecoder(resp.Body).Decode(&cInfo); err != nil {
return nil, err
}
return &cInfo, nil
}

View File

@ -0,0 +1,170 @@
// Copyright 2017 Google Inc. 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 crio
import (
"fmt"
"path"
"regexp"
"strings"
"github.com/google/cadvisor/container"
"github.com/google/cadvisor/container/libcontainer"
"github.com/google/cadvisor/fs"
info "github.com/google/cadvisor/info/v1"
"github.com/google/cadvisor/manager/watcher"
"github.com/golang/glog"
)
// The namespace under which crio aliases are unique.
const CrioNamespace = "crio"
// Regexp that identifies CRI-O cgroups
var crioCgroupRegexp = regexp.MustCompile(`([a-z0-9]{64})`)
type storageDriver string
const (
// TODO add full set of supported drivers in future..
overlayStorageDriver storageDriver = "overlay"
overlay2StorageDriver storageDriver = "overlay2"
)
type crioFactory struct {
machineInfoFactory info.MachineInfoFactory
storageDriver storageDriver
storageDir string
// Information about the mounted cgroup subsystems.
cgroupSubsystems libcontainer.CgroupSubsystems
// Information about mounted filesystems.
fsInfo fs.FsInfo
ignoreMetrics container.MetricSet
client crioClient
}
func (self *crioFactory) String() string {
return CrioNamespace
}
func (self *crioFactory) NewContainerHandler(name string, inHostNamespace bool) (handler container.ContainerHandler, err error) {
client, err := Client()
if err != nil {
return
}
// TODO are there any env vars we need to white list, if so, do it here...
metadataEnvs := []string{}
handler, err = newCrioContainerHandler(
client,
name,
self.machineInfoFactory,
self.fsInfo,
self.storageDriver,
self.storageDir,
&self.cgroupSubsystems,
inHostNamespace,
metadataEnvs,
self.ignoreMetrics,
)
return
}
// Returns the CRIO ID from the full container name.
func ContainerNameToCrioId(name string) string {
id := path.Base(name)
if matches := crioCgroupRegexp.FindStringSubmatch(id); matches != nil {
return matches[1]
}
return id
}
// isContainerName returns true if the cgroup with associated name
// corresponds to a crio container.
func isContainerName(name string) bool {
// always ignore .mount cgroup even if associated with crio and delegate to systemd
if strings.HasSuffix(name, ".mount") {
return false
}
return crioCgroupRegexp.MatchString(path.Base(name))
}
// crio handles all containers under /crio
func (self *crioFactory) CanHandleAndAccept(name string) (bool, bool, error) {
if strings.HasPrefix(path.Base(name), "crio-conmon") {
// TODO(runcom): should we include crio-conmon cgroups?
return false, false, nil
}
if !strings.HasPrefix(path.Base(name), CrioNamespace) {
return false, false, nil
}
// if the container is not associated with CRI-O, we can't handle it or accept it.
if !isContainerName(name) {
return false, false, nil
}
return true, true, nil
}
func (self *crioFactory) DebugInfo() map[string][]string {
return map[string][]string{}
}
var (
// TODO(runcom): handle versioning in CRI-O
version_regexp_string = `(\d+)\.(\d+)\.(\d+)`
version_re = regexp.MustCompile(version_regexp_string)
apiversion_regexp_string = `(\d+)\.(\d+)`
apiversion_re = regexp.MustCompile(apiversion_regexp_string)
)
// Register root container before running this function!
func Register(factory info.MachineInfoFactory, fsInfo fs.FsInfo, ignoreMetrics container.MetricSet) error {
client, err := Client()
if err != nil {
return err
}
info, err := client.Info()
if err != nil {
return err
}
// TODO determine crio version so we can work differently w/ future versions if needed
cgroupSubsystems, err := libcontainer.GetCgroupSubsystems()
if err != nil {
return fmt.Errorf("failed to get cgroup subsystems: %v", err)
}
glog.Infof("Registering CRI-O factory")
f := &crioFactory{
client: client,
cgroupSubsystems: cgroupSubsystems,
fsInfo: fsInfo,
machineInfoFactory: factory,
storageDriver: storageDriver(info.StorageDriver),
storageDir: info.StorageRoot,
ignoreMetrics: ignoreMetrics,
}
container.RegisterContainerHandlerFactory(f, []watcher.ContainerWatchSource{watcher.Raw})
return nil
}

View File

@ -0,0 +1,334 @@
// Copyright 2017 Google Inc. 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.
// Handler for CRI-O containers.
package crio
import (
"fmt"
"path"
"strconv"
"strings"
"time"
"github.com/google/cadvisor/container"
"github.com/google/cadvisor/container/common"
containerlibcontainer "github.com/google/cadvisor/container/libcontainer"
"github.com/google/cadvisor/fs"
info "github.com/google/cadvisor/info/v1"
"github.com/opencontainers/runc/libcontainer/cgroups"
cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs"
libcontainerconfigs "github.com/opencontainers/runc/libcontainer/configs"
)
type crioContainerHandler struct {
name string
id string
aliases []string
machineInfoFactory info.MachineInfoFactory
// Absolute path to the cgroup hierarchies of this container.
// (e.g.: "cpu" -> "/sys/fs/cgroup/cpu/test")
cgroupPaths map[string]string
// Manager of this container's cgroups.
cgroupManager cgroups.Manager
// the CRI-O storage driver
storageDriver storageDriver
fsInfo fs.FsInfo
rootfsStorageDir string
// Time at which this container was created.
creationTime time.Time
// Metadata associated with the container.
labels map[string]string
envs map[string]string
// TODO
// crio version handling...
// The container PID used to switch namespaces as required
pid int
// Image name used for this container.
image string
// The host root FS to read
rootFs string
// The network mode of the container
// TODO
// Filesystem handler.
fsHandler common.FsHandler
// The IP address of the container
ipAddress string
ignoreMetrics container.MetricSet
// container restart count
restartCount int
}
var _ container.ContainerHandler = &crioContainerHandler{}
// newCrioContainerHandler returns a new container.ContainerHandler
func newCrioContainerHandler(
client crioClient,
name string,
machineInfoFactory info.MachineInfoFactory,
fsInfo fs.FsInfo,
storageDriver storageDriver,
storageDir string,
cgroupSubsystems *containerlibcontainer.CgroupSubsystems,
inHostNamespace bool,
metadataEnvs []string,
ignoreMetrics container.MetricSet,
) (container.ContainerHandler, error) {
// Create the cgroup paths.
cgroupPaths := make(map[string]string, len(cgroupSubsystems.MountPoints))
for key, val := range cgroupSubsystems.MountPoints {
cgroupPaths[key] = path.Join(val, name)
}
// Generate the equivalent cgroup manager for this container.
cgroupManager := &cgroupfs.Manager{
Cgroups: &libcontainerconfigs.Cgroup{
Name: name,
},
Paths: cgroupPaths,
}
rootFs := "/"
if !inHostNamespace {
rootFs = "/rootfs"
storageDir = path.Join(rootFs, storageDir)
}
id := ContainerNameToCrioId(name)
cInfo, err := client.ContainerInfo(id)
if err != nil {
return nil, err
}
// passed to fs handler below ...
// XXX: this is using the full container logpath, as constructed by the CRI
// /var/log/pods/<pod_uuid>/container_instance.log
// It's not actually a log dir, as the CRI doesn't have per-container dirs
// under /var/log/pods/<pod_uuid>/
// We can't use /var/log/pods/<pod_uuid>/ to count per-container log usage.
// We use the container log file directly.
storageLogDir := cInfo.LogPath
// Determine the rootfs storage dir
rootfsStorageDir := cInfo.Root
// TODO(runcom): CRI-O doesn't strip /merged but we need to in order to
// get device ID from root, otherwise, it's going to error out as overlay
// mounts doesn't have fixed dev ids.
rootfsStorageDir = strings.TrimSuffix(rootfsStorageDir, "/merged")
// TODO: extract object mother method
handler := &crioContainerHandler{
id: id,
name: name,
machineInfoFactory: machineInfoFactory,
cgroupPaths: cgroupPaths,
cgroupManager: cgroupManager,
storageDriver: storageDriver,
fsInfo: fsInfo,
rootFs: rootFs,
rootfsStorageDir: rootfsStorageDir,
envs: make(map[string]string),
ignoreMetrics: ignoreMetrics,
}
handler.creationTime = time.Unix(0, cInfo.CreatedTime)
handler.pid = cInfo.Pid
handler.aliases = append(handler.aliases, cInfo.Name, id)
handler.labels = cInfo.Labels
handler.image = cInfo.Image
// TODO: we wantd to know graph driver DeviceId (dont think this is needed now)
// ignore err and get zero as default, this happens with sandboxes, not sure why...
// kube isn't sending restart count in labels for sandboxes.
restartCount, _ := strconv.Atoi(cInfo.Annotations["io.kubernetes.container.restartCount"])
handler.restartCount = restartCount
handler.ipAddress = cInfo.IP
// we optionally collect disk usage metrics
if !ignoreMetrics.Has(container.DiskUsageMetrics) {
handler.fsHandler = common.NewFsHandler(common.DefaultPeriod, rootfsStorageDir, storageLogDir, fsInfo)
}
// TODO for env vars we wanted to show from container.Config.Env from whitelist
//for _, exposedEnv := range metadataEnvs {
//glog.Infof("TODO env whitelist: %v", exposedEnv)
//}
return handler, nil
}
func (self *crioContainerHandler) Start() {
if self.fsHandler != nil {
self.fsHandler.Start()
}
}
func (self *crioContainerHandler) Cleanup() {
if self.fsHandler != nil {
self.fsHandler.Stop()
}
}
func (self *crioContainerHandler) ContainerReference() (info.ContainerReference, error) {
return info.ContainerReference{
Id: self.id,
Name: self.name,
Aliases: self.aliases,
Namespace: CrioNamespace,
Labels: self.labels,
}, nil
}
func (self *crioContainerHandler) needNet() bool {
if !self.ignoreMetrics.Has(container.NetworkUsageMetrics) {
return self.labels["io.kubernetes.container.name"] == "POD"
}
return false
}
func (self *crioContainerHandler) GetSpec() (info.ContainerSpec, error) {
hasFilesystem := !self.ignoreMetrics.Has(container.DiskUsageMetrics)
spec, err := common.GetSpec(self.cgroupPaths, self.machineInfoFactory, self.needNet(), hasFilesystem)
spec.Labels = self.labels
// Only adds restartcount label if it's greater than 0
if self.restartCount > 0 {
spec.Labels["restartcount"] = strconv.Itoa(self.restartCount)
}
spec.Envs = self.envs
spec.Image = self.image
return spec, err
}
func (self *crioContainerHandler) getFsStats(stats *info.ContainerStats) error {
mi, err := self.machineInfoFactory.GetMachineInfo()
if err != nil {
return err
}
if !self.ignoreMetrics.Has(container.DiskIOMetrics) {
common.AssignDeviceNamesToDiskStats((*common.MachineInfoNamer)(mi), &stats.DiskIo)
}
if self.ignoreMetrics.Has(container.DiskUsageMetrics) {
return nil
}
var device string
switch self.storageDriver {
case overlay2StorageDriver, overlayStorageDriver:
deviceInfo, err := self.fsInfo.GetDirFsDevice(self.rootfsStorageDir)
if err != nil {
return fmt.Errorf("unable to determine device info for dir: %v: %v", self.rootfsStorageDir, err)
}
device = deviceInfo.Device
default:
return nil
}
var (
limit uint64
fsType string
)
// crio does not impose any filesystem limits for containers. So use capacity as limit.
for _, fs := range mi.Filesystems {
if fs.Device == device {
limit = fs.Capacity
fsType = fs.Type
break
}
}
fsStat := info.FsStats{Device: device, Type: fsType, Limit: limit}
usage := self.fsHandler.Usage()
fsStat.BaseUsage = usage.BaseUsageBytes
fsStat.Usage = usage.TotalUsageBytes
fsStat.Inodes = usage.InodeUsage
stats.Filesystem = append(stats.Filesystem, fsStat)
return nil
}
func (self *crioContainerHandler) GetStats() (*info.ContainerStats, error) {
stats, err := containerlibcontainer.GetStats(self.cgroupManager, self.rootFs, self.pid, self.ignoreMetrics)
if err != nil {
return stats, err
}
// Clean up stats for containers that don't have their own network - this
// includes containers running in Kubernetes pods that use the network of the
// infrastructure container. This stops metrics being reported multiple times
// for each container in a pod.
if !self.needNet() {
stats.Network = info.NetworkStats{}
}
// Get filesystem stats.
err = self.getFsStats(stats)
if err != nil {
return stats, err
}
return stats, nil
}
func (self *crioContainerHandler) ListContainers(listType container.ListType) ([]info.ContainerReference, error) {
// No-op for Docker driver.
return []info.ContainerReference{}, nil
}
func (self *crioContainerHandler) GetCgroupPath(resource string) (string, error) {
path, ok := self.cgroupPaths[resource]
if !ok {
return "", fmt.Errorf("could not find path for resource %q for container %q\n", resource, self.name)
}
return path, nil
}
func (self *crioContainerHandler) GetContainerLabels() map[string]string {
return self.labels
}
func (self *crioContainerHandler) GetContainerIPAddress() string {
return self.ipAddress
}
func (self *crioContainerHandler) ListProcesses(listType container.ListType) ([]int, error) {
return containerlibcontainer.GetProcesses(self.cgroupManager)
}
func (self *crioContainerHandler) Exists() bool {
return common.CgroupExists(self.cgroupPaths)
}
func (self *crioContainerHandler) Type() container.ContainerType {
return container.ContainerTypeCrio
}

View File

@ -43,6 +43,7 @@ const (
LabelSystemRoot = "root"
LabelDockerImages = "docker-images"
LabelRktImages = "rkt-images"
LabelCrioImages = "crio-images"
)
// The maximum number of `du` and `find` tasks that can be running at once.
@ -91,6 +92,7 @@ type Context struct {
// docker root directory.
Docker DockerContext
RktPath string
Crio CrioContext
}
type DockerContext struct {
@ -99,6 +101,10 @@ type DockerContext struct {
DriverStatus map[string]string
}
type CrioContext struct {
Root string
}
func NewFsInfo(context Context) (FsInfo, error) {
mounts, err := mount.GetMounts()
if err != nil {
@ -128,6 +134,7 @@ func NewFsInfo(context Context) (FsInfo, error) {
// need to call this before the log line below printing out the partitions, as this function may
// add a "partition" for devicemapper to fsInfo.partitions
fsInfo.addDockerImagesLabel(context, mounts)
fsInfo.addCrioImagesLabel(context, mounts)
glog.Infof("Filesystem UUIDs: %+v", fsInfo.fsUUIDToDeviceName)
glog.Infof("Filesystem partitions: %+v", fsInfo.partitions)
@ -278,6 +285,23 @@ func (self *RealFsInfo) addDockerImagesLabel(context Context, mounts []*mount.In
}
}
func (self *RealFsInfo) addCrioImagesLabel(context Context, mounts []*mount.Info) {
if context.Crio.Root != "" {
crioPath := context.Crio.Root
crioImagePaths := map[string]struct{}{
"/": {},
}
for _, dir := range []string{"overlay", "overlay2"} {
crioImagePaths[path.Join(crioPath, dir+"-images")] = struct{}{}
}
for crioPath != "/" && crioPath != "." {
crioImagePaths[crioPath] = struct{}{}
crioPath = filepath.Dir(crioPath)
}
self.updateContainerImagesPath(LabelCrioImages, mounts, crioImagePaths)
}
}
func (self *RealFsInfo) addRktImagesLabel(context Context, mounts []*mount.Info) {
if context.RktPath != "" {
rktPath := context.RktPath

View File

@ -13,6 +13,7 @@ go_library(
"//vendor/github.com/google/cadvisor/cache/memory:go_default_library",
"//vendor/github.com/google/cadvisor/collector:go_default_library",
"//vendor/github.com/google/cadvisor/container:go_default_library",
"//vendor/github.com/google/cadvisor/container/crio:go_default_library",
"//vendor/github.com/google/cadvisor/container/docker:go_default_library",
"//vendor/github.com/google/cadvisor/container/raw:go_default_library",
"//vendor/github.com/google/cadvisor/container/rkt:go_default_library",

View File

@ -28,6 +28,7 @@ import (
"github.com/google/cadvisor/cache/memory"
"github.com/google/cadvisor/collector"
"github.com/google/cadvisor/container"
"github.com/google/cadvisor/container/crio"
"github.com/google/cadvisor/container/docker"
"github.com/google/cadvisor/container/raw"
"github.com/google/cadvisor/container/rkt"
@ -156,6 +157,15 @@ func New(memoryCache *memory.InMemoryCache, sysfs sysfs.SysFs, maxHousekeepingIn
glog.Warningf("unable to connect to Rkt api service: %v", err)
}
crioClient, err := crio.Client()
if err != nil {
return nil, err
}
crioInfo, err := crioClient.Info()
if err != nil {
glog.Warningf("unable to connect to CRI-O api service: %v", err)
}
context := fs.Context{
Docker: fs.DockerContext{
Root: docker.RootDir(),
@ -163,6 +173,9 @@ func New(memoryCache *memory.InMemoryCache, sysfs sysfs.SysFs, maxHousekeepingIn
DriverStatus: dockerStatus.DriverStatus,
},
RktPath: rktPath,
Crio: fs.CrioContext{
Root: crioInfo.StorageRoot,
},
}
fsInfo, err := fs.NewFsInfo(context)
if err != nil {
@ -258,6 +271,11 @@ func (self *manager) Start() error {
self.containerWatchers = append(self.containerWatchers, watcher)
}
err = crio.Register(self, self.fsInfo, self.ignoreMetrics)
if err != nil {
glog.Warningf("Registration of the crio container factory failed: %v", err)
}
err = systemd.Register(self, self.fsInfo, self.ignoreMetrics)
if err != nil {
glog.Warningf("Registration of the systemd container factory failed: %v", err)