Commit 4df5bd09 authored by David Ashpole's avatar David Ashpole

update cadvisor godeps to v0.30.0

parent 2d629ce5
...@@ -287,6 +287,7 @@ filegroup( ...@@ -287,6 +287,7 @@ filegroup(
"//vendor/github.com/mailru/easyjson/jlexer:all-srcs", "//vendor/github.com/mailru/easyjson/jlexer:all-srcs",
"//vendor/github.com/mailru/easyjson/jwriter:all-srcs", "//vendor/github.com/mailru/easyjson/jwriter:all-srcs",
"//vendor/github.com/marstr/guid:all-srcs", "//vendor/github.com/marstr/guid:all-srcs",
"//vendor/github.com/mattn/go-shellwords:all-srcs",
"//vendor/github.com/matttproud/golang_protobuf_extensions/pbutil:all-srcs", "//vendor/github.com/matttproud/golang_protobuf_extensions/pbutil:all-srcs",
"//vendor/github.com/mholt/caddy/caddyfile:all-srcs", "//vendor/github.com/mholt/caddy/caddyfile:all-srcs",
"//vendor/github.com/miekg/dns:all-srcs", "//vendor/github.com/miekg/dns:all-srcs",
......
...@@ -12,11 +12,9 @@ go_library( ...@@ -12,11 +12,9 @@ go_library(
importpath = "github.com/containerd/containerd/api/services/containers/v1", importpath = "github.com/containerd/containerd/api/services/containers/v1",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/gogo/protobuf/gogoproto:go_default_library",
"//vendor/github.com/gogo/protobuf/proto:go_default_library", "//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/gogo/protobuf/sortkeys:go_default_library", "//vendor/github.com/gogo/protobuf/sortkeys:go_default_library",
"//vendor/github.com/gogo/protobuf/types:go_default_library", "//vendor/github.com/gogo/protobuf/types:go_default_library",
"//vendor/github.com/golang/protobuf/ptypes/empty:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library", "//vendor/golang.org/x/net/context:go_default_library",
"//vendor/google.golang.org/grpc:go_default_library", "//vendor/google.golang.org/grpc:go_default_library",
], ],
......
...@@ -2,7 +2,7 @@ syntax = "proto3"; ...@@ -2,7 +2,7 @@ syntax = "proto3";
package containerd.services.containers.v1; package containerd.services.containers.v1;
import "gogoproto/gogo.proto"; import weak "gogoproto/gogo.proto";
import "google/protobuf/any.proto"; import "google/protobuf/any.proto";
import "google/protobuf/empty.proto"; import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto"; import "google/protobuf/field_mask.proto";
......
...@@ -14,10 +14,8 @@ go_library( ...@@ -14,10 +14,8 @@ go_library(
deps = [ deps = [
"//vendor/github.com/containerd/containerd/api/types:go_default_library", "//vendor/github.com/containerd/containerd/api/types:go_default_library",
"//vendor/github.com/containerd/containerd/api/types/task:go_default_library", "//vendor/github.com/containerd/containerd/api/types/task:go_default_library",
"//vendor/github.com/gogo/protobuf/gogoproto:go_default_library",
"//vendor/github.com/gogo/protobuf/proto:go_default_library", "//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/gogo/protobuf/types:go_default_library", "//vendor/github.com/gogo/protobuf/types:go_default_library",
"//vendor/github.com/golang/protobuf/ptypes/empty:go_default_library",
"//vendor/github.com/opencontainers/go-digest:go_default_library", "//vendor/github.com/opencontainers/go-digest:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library", "//vendor/golang.org/x/net/context:go_default_library",
"//vendor/google.golang.org/grpc:go_default_library", "//vendor/google.golang.org/grpc:go_default_library",
......
...@@ -4,7 +4,7 @@ package containerd.services.tasks.v1; ...@@ -4,7 +4,7 @@ package containerd.services.tasks.v1;
import "google/protobuf/empty.proto"; import "google/protobuf/empty.proto";
import "google/protobuf/any.proto"; import "google/protobuf/any.proto";
import "gogoproto/gogo.proto"; import weak "gogoproto/gogo.proto";
import "github.com/containerd/containerd/api/types/mount.proto"; import "github.com/containerd/containerd/api/types/mount.proto";
import "github.com/containerd/containerd/api/types/metrics.proto"; import "github.com/containerd/containerd/api/types/metrics.proto";
import "github.com/containerd/containerd/api/types/descriptor.proto"; import "github.com/containerd/containerd/api/types/descriptor.proto";
......
...@@ -12,9 +12,8 @@ go_library( ...@@ -12,9 +12,8 @@ go_library(
importpath = "github.com/containerd/containerd/api/services/version/v1", importpath = "github.com/containerd/containerd/api/services/version/v1",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/gogo/protobuf/gogoproto:go_default_library",
"//vendor/github.com/gogo/protobuf/proto:go_default_library", "//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/golang/protobuf/ptypes/empty:go_default_library", "//vendor/github.com/gogo/protobuf/types:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library", "//vendor/golang.org/x/net/context:go_default_library",
"//vendor/google.golang.org/grpc:go_default_library", "//vendor/google.golang.org/grpc:go_default_library",
], ],
......
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: github.com/containerd/containerd/api/services/version/v1/version.proto // source: github.com/containerd/containerd/api/services/version/v1/version.proto
// DO NOT EDIT!
/* /*
Package version is a generated protocol buffer package. Package version is a generated protocol buffer package.
...@@ -16,8 +15,9 @@ package version ...@@ -16,8 +15,9 @@ package version
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import google_protobuf "github.com/golang/protobuf/ptypes/empty" import google_protobuf "github.com/gogo/protobuf/types"
import _ "github.com/gogo/protobuf/gogoproto"
// skipping weak import gogoproto "github.com/gogo/protobuf/gogoproto"
import ( import (
context "golang.org/x/net/context" context "golang.org/x/net/context"
...@@ -155,24 +155,6 @@ func (m *VersionResponse) MarshalTo(dAtA []byte) (int, error) { ...@@ -155,24 +155,6 @@ func (m *VersionResponse) MarshalTo(dAtA []byte) (int, error) {
return i, nil return i, nil
} }
func encodeFixed64Version(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
dAtA[offset+4] = uint8(v >> 32)
dAtA[offset+5] = uint8(v >> 40)
dAtA[offset+6] = uint8(v >> 48)
dAtA[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Version(dAtA []byte, offset int, v uint32) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintVersion(dAtA []byte, offset int, v uint64) int { func encodeVarintVersion(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
...@@ -446,7 +428,7 @@ func init() { ...@@ -446,7 +428,7 @@ func init() {
} }
var fileDescriptorVersion = []byte{ var fileDescriptorVersion = []byte{
// 241 bytes of a gzipped FileDescriptorProto // 243 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x4b, 0xcf, 0x2c, 0xc9, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x4b, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d,
0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x16, 0xeb, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x16, 0xeb,
...@@ -460,7 +442,7 @@ var fileDescriptorVersion = []byte{ ...@@ -460,7 +442,7 @@ var fileDescriptorVersion = []byte{
0x76, 0xa8, 0x41, 0x42, 0x41, 0x08, 0xa6, 0x98, 0x1e, 0xc4, 0x49, 0x7a, 0x30, 0x27, 0xe9, 0xb9, 0x76, 0xa8, 0x41, 0x42, 0x41, 0x08, 0xa6, 0x98, 0x1e, 0xc4, 0x49, 0x7a, 0x30, 0x27, 0xe9, 0xb9,
0x82, 0x9c, 0x24, 0xa5, 0xaf, 0x87, 0xdf, 0x2b, 0x7a, 0x68, 0x8e, 0x72, 0x8a, 0x3a, 0xf1, 0x50, 0x82, 0x9c, 0x24, 0xa5, 0xaf, 0x87, 0xdf, 0x2b, 0x7a, 0x68, 0x8e, 0x72, 0x8a, 0x3a, 0xf1, 0x50,
0x8e, 0xe1, 0xc6, 0x43, 0x39, 0x86, 0x86, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x8e, 0xe1, 0xc6, 0x43, 0x39, 0x86, 0x86, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78,
0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0x63, 0x94, 0x03, 0xb9, 0x81, 0x6b, 0x0d, 0x65, 0x26, 0xb1, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0x63, 0x94, 0x03, 0xb9, 0x81, 0x6b, 0x0d, 0x65, 0x46, 0x30,
0x81, 0x1d, 0x67, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xb6, 0x37, 0xd8, 0xc6, 0xa7, 0x01, 0x00, 0x26, 0xb1, 0x81, 0x9d, 0x67, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x95, 0x0d, 0x52, 0x23, 0xa9,
0x00, 0x01, 0x00, 0x00,
} }
...@@ -3,7 +3,7 @@ syntax = "proto3"; ...@@ -3,7 +3,7 @@ syntax = "proto3";
package containerd.services.version.v1; package containerd.services.version.v1;
import "google/protobuf/empty.proto"; import "google/protobuf/empty.proto";
import "gogoproto/gogo.proto"; import weak "gogoproto/gogo.proto";
// TODO(stevvooe): Should version service actually be versioned? // TODO(stevvooe): Should version service actually be versioned?
option go_package = "github.com/containerd/containerd/api/services/version/v1;version"; option go_package = "github.com/containerd/containerd/api/services/version/v1;version";
......
...@@ -23,7 +23,6 @@ go_library( ...@@ -23,7 +23,6 @@ go_library(
importpath = "github.com/containerd/containerd/api/types", importpath = "github.com/containerd/containerd/api/types",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/gogo/protobuf/gogoproto:go_default_library",
"//vendor/github.com/gogo/protobuf/proto:go_default_library", "//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/gogo/protobuf/types:go_default_library", "//vendor/github.com/gogo/protobuf/types:go_default_library",
"//vendor/github.com/opencontainers/go-digest:go_default_library", "//vendor/github.com/opencontainers/go-digest:go_default_library",
......
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: github.com/containerd/containerd/api/types/descriptor.proto // source: github.com/containerd/containerd/api/types/descriptor.proto
// DO NOT EDIT!
/* /*
Package types is a generated protocol buffer package. Package types is a generated protocol buffer package.
...@@ -22,7 +21,8 @@ package types ...@@ -22,7 +21,8 @@ package types
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
// skipping weak import gogoproto "github.com/gogo/protobuf/gogoproto"
import github_com_opencontainers_go_digest "github.com/opencontainers/go-digest" import github_com_opencontainers_go_digest "github.com/opencontainers/go-digest"
...@@ -95,24 +95,6 @@ func (m *Descriptor) MarshalTo(dAtA []byte) (int, error) { ...@@ -95,24 +95,6 @@ func (m *Descriptor) MarshalTo(dAtA []byte) (int, error) {
return i, nil return i, nil
} }
func encodeFixed64Descriptor(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
dAtA[offset+4] = uint8(v >> 32)
dAtA[offset+5] = uint8(v >> 40)
dAtA[offset+6] = uint8(v >> 48)
dAtA[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Descriptor(dAtA []byte, offset int, v uint32) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintDescriptor(dAtA []byte, offset int, v uint64) int { func encodeVarintDescriptor(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
...@@ -409,7 +391,7 @@ func init() { ...@@ -409,7 +391,7 @@ func init() {
} }
var fileDescriptorDescriptor = []byte{ var fileDescriptorDescriptor = []byte{
// 232 bytes of a gzipped FileDescriptorProto // 234 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x4e, 0xcf, 0x2c, 0xc9, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x4e, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d,
0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0xa4, 0x16, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0xa4, 0x16,
...@@ -423,6 +405,6 @@ var fileDescriptorDescriptor = []byte{ ...@@ -423,6 +405,6 @@ var fileDescriptorDescriptor = []byte{
0x4d, 0x10, 0x12, 0xe2, 0x62, 0x29, 0xce, 0xac, 0x4a, 0x95, 0x60, 0x56, 0x60, 0xd4, 0x60, 0x0e, 0x4d, 0x10, 0x12, 0xe2, 0x62, 0x29, 0xce, 0xac, 0x4a, 0x95, 0x60, 0x56, 0x60, 0xd4, 0x60, 0x0e,
0x02, 0xb3, 0x9d, 0xbc, 0x4e, 0x3c, 0x94, 0x63, 0xb8, 0xf1, 0x50, 0x8e, 0xa1, 0xe1, 0x91, 0x1c, 0x02, 0xb3, 0x9d, 0xbc, 0x4e, 0x3c, 0x94, 0x63, 0xb8, 0xf1, 0x50, 0x8e, 0xa1, 0xe1, 0x91, 0x1c,
0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x18, 0x65, 0x40, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x18, 0x65, 0x40,
0x7c, 0x60, 0x58, 0x83, 0xc9, 0x24, 0x36, 0xb0, 0x07, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x60, 0x58, 0x83, 0xc9, 0x08, 0x86, 0x24, 0x36, 0xb0, 0x17, 0x8d, 0x01, 0x01, 0x00, 0x00,
0x23, 0x14, 0xc9, 0x7c, 0x47, 0x01, 0x00, 0x00, 0xff, 0xff, 0xea, 0xac, 0x78, 0x9a, 0x49, 0x01, 0x00, 0x00,
} }
...@@ -2,7 +2,7 @@ syntax = "proto3"; ...@@ -2,7 +2,7 @@ syntax = "proto3";
package containerd.types; package containerd.types;
import "gogoproto/gogo.proto"; import weak "gogoproto/gogo.proto";
option go_package = "github.com/containerd/containerd/api/types;types"; option go_package = "github.com/containerd/containerd/api/types;types";
......
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: github.com/containerd/containerd/api/types/metrics.proto // source: github.com/containerd/containerd/api/types/metrics.proto
// DO NOT EDIT!
package types package types
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
// skipping weak import gogoproto "github.com/gogo/protobuf/gogoproto"
import google_protobuf1 "github.com/gogo/protobuf/types" import google_protobuf1 "github.com/gogo/protobuf/types"
import _ "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types"
...@@ -81,24 +81,6 @@ func (m *Metric) MarshalTo(dAtA []byte) (int, error) { ...@@ -81,24 +81,6 @@ func (m *Metric) MarshalTo(dAtA []byte) (int, error) {
return i, nil return i, nil
} }
func encodeFixed64Metrics(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
dAtA[offset+4] = uint8(v >> 32)
dAtA[offset+5] = uint8(v >> 40)
dAtA[offset+6] = uint8(v >> 48)
dAtA[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Metrics(dAtA []byte, offset int, v uint32) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintMetrics(dAtA []byte, offset int, v uint64) int { func encodeVarintMetrics(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
...@@ -409,7 +391,7 @@ func init() { ...@@ -409,7 +391,7 @@ func init() {
} }
var fileDescriptorMetrics = []byte{ var fileDescriptorMetrics = []byte{
// 256 bytes of a gzipped FileDescriptorProto // 258 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x48, 0xcf, 0x2c, 0xc9, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x48, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d,
0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xe7, 0xa6, 0x96, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xe7, 0xa6, 0x96,
...@@ -424,6 +406,7 @@ var fileDescriptorMetrics = []byte{ ...@@ -424,6 +406,7 @@ var fileDescriptorMetrics = []byte{
0x5d, 0x82, 0x98, 0x32, 0x53, 0x84, 0x34, 0xb8, 0x58, 0x52, 0x12, 0x4b, 0x12, 0x25, 0x98, 0xc1, 0x5d, 0x82, 0x98, 0x32, 0x53, 0x84, 0x34, 0xb8, 0x58, 0x52, 0x12, 0x4b, 0x12, 0x25, 0x98, 0xc1,
0xc6, 0x8a, 0x60, 0x18, 0xeb, 0x98, 0x57, 0x19, 0x04, 0x56, 0xe1, 0xe4, 0x75, 0xe2, 0xa1, 0x1c, 0xc6, 0x8a, 0x60, 0x18, 0xeb, 0x98, 0x57, 0x19, 0x04, 0x56, 0xe1, 0xe4, 0x75, 0xe2, 0xa1, 0x1c,
0xc3, 0x8d, 0x87, 0x72, 0x0c, 0x0d, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0xc3, 0x8d, 0x87, 0x72, 0x0c, 0x0d, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48,
0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x28, 0x03, 0xe2, 0x03, 0xd2, 0x1a, 0x4c, 0x26, 0xb1, 0x81, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x28, 0x03, 0xe2, 0x03, 0xd2, 0x1a, 0x4c, 0x46, 0x30, 0x24,
0xcd, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x51, 0x36, 0x74, 0x83, 0x01, 0x00, 0x00, 0xb1, 0x81, 0x6d, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xde, 0x0d, 0x02, 0xfe, 0x85, 0x01,
0x00, 0x00,
} }
...@@ -2,7 +2,7 @@ syntax = "proto3"; ...@@ -2,7 +2,7 @@ syntax = "proto3";
package containerd.types; package containerd.types;
import "gogoproto/gogo.proto"; import weak "gogoproto/gogo.proto";
import "google/protobuf/any.proto"; import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
......
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: github.com/containerd/containerd/api/types/mount.proto // source: github.com/containerd/containerd/api/types/mount.proto
// DO NOT EDIT!
package types package types
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
// skipping weak import gogoproto "github.com/gogo/protobuf/gogoproto"
import strings "strings" import strings "strings"
import reflect "reflect" import reflect "reflect"
...@@ -96,24 +96,6 @@ func (m *Mount) MarshalTo(dAtA []byte) (int, error) { ...@@ -96,24 +96,6 @@ func (m *Mount) MarshalTo(dAtA []byte) (int, error) {
return i, nil return i, nil
} }
func encodeFixed64Mount(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
dAtA[offset+4] = uint8(v >> 32)
dAtA[offset+5] = uint8(v >> 40)
dAtA[offset+6] = uint8(v >> 48)
dAtA[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Mount(dAtA []byte, offset int, v uint32) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintMount(dAtA []byte, offset int, v uint64) int { func encodeVarintMount(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
...@@ -457,7 +439,7 @@ func init() { ...@@ -457,7 +439,7 @@ func init() {
} }
var fileDescriptorMount = []byte{ var fileDescriptorMount = []byte{
// 200 bytes of a gzipped FileDescriptorProto // 202 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4b, 0xcf, 0x2c, 0xc9, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4b, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d,
0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xe7, 0xe6, 0x97, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xe7, 0xe6, 0x97,
...@@ -469,6 +451,6 @@ var fileDescriptorMount = []byte{ ...@@ -469,6 +451,6 @@ var fileDescriptorMount = []byte{
0x82, 0x8b, 0x3d, 0xbf, 0xa0, 0x24, 0x33, 0x3f, 0xaf, 0x58, 0x82, 0x45, 0x81, 0x59, 0x83, 0x33, 0x82, 0x8b, 0x3d, 0xbf, 0xa0, 0x24, 0x33, 0x3f, 0xaf, 0x58, 0x82, 0x45, 0x81, 0x59, 0x83, 0x33,
0x08, 0xc6, 0x75, 0xf2, 0x3a, 0xf1, 0x50, 0x8e, 0xe1, 0xc6, 0x43, 0x39, 0x86, 0x86, 0x47, 0x72, 0x08, 0xc6, 0x75, 0xf2, 0x3a, 0xf1, 0x50, 0x8e, 0xe1, 0xc6, 0x43, 0x39, 0x86, 0x86, 0x47, 0x72,
0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0x63, 0x94, 0x01, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0x63, 0x94, 0x01,
0xf1, 0x1e, 0xb4, 0x06, 0x93, 0x49, 0x6c, 0x60, 0x97, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x1e, 0xb4, 0x06, 0x93, 0x11, 0x0c, 0x49, 0x6c, 0x60, 0xb7, 0x1b, 0x03, 0x02, 0x00, 0x00,
0xe5, 0xc7, 0x07, 0x3f, 0x1b, 0x01, 0x00, 0x00, 0xff, 0xff, 0x82, 0x1c, 0x02, 0x18, 0x1d, 0x01, 0x00, 0x00,
} }
...@@ -2,7 +2,7 @@ syntax = "proto3"; ...@@ -2,7 +2,7 @@ syntax = "proto3";
package containerd.types; package containerd.types;
import "gogoproto/gogo.proto"; import weak "gogoproto/gogo.proto";
option go_package = "github.com/containerd/containerd/api/types;types"; option go_package = "github.com/containerd/containerd/api/types;types";
......
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: github.com/containerd/containerd/api/types/platform.proto // source: github.com/containerd/containerd/api/types/platform.proto
// DO NOT EDIT!
package types package types
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
// skipping weak import gogoproto "github.com/gogo/protobuf/gogoproto"
import strings "strings" import strings "strings"
import reflect "reflect" import reflect "reflect"
...@@ -70,24 +70,6 @@ func (m *Platform) MarshalTo(dAtA []byte) (int, error) { ...@@ -70,24 +70,6 @@ func (m *Platform) MarshalTo(dAtA []byte) (int, error) {
return i, nil return i, nil
} }
func encodeFixed64Platform(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
dAtA[offset+4] = uint8(v >> 32)
dAtA[offset+5] = uint8(v >> 40)
dAtA[offset+6] = uint8(v >> 48)
dAtA[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Platform(dAtA []byte, offset int, v uint32) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintPlatform(dAtA []byte, offset int, v uint64) int { func encodeVarintPlatform(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
...@@ -395,7 +377,7 @@ func init() { ...@@ -395,7 +377,7 @@ func init() {
} }
var fileDescriptorPlatform = []byte{ var fileDescriptorPlatform = []byte{
// 203 bytes of a gzipped FileDescriptorProto // 205 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x4c, 0xcf, 0x2c, 0xc9, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x4c, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d,
0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0x17, 0xe4, 0x24, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0x17, 0xe4, 0x24,
...@@ -407,6 +389,6 @@ var fileDescriptorPlatform = []byte{ ...@@ -407,6 +389,6 @@ var fileDescriptorPlatform = []byte{
0x40, 0x2a, 0x82, 0x50, 0xc4, 0x84, 0x24, 0xb8, 0xd8, 0xcb, 0x12, 0x8b, 0x32, 0x13, 0xf3, 0x4a, 0x40, 0x2a, 0x82, 0x50, 0xc4, 0x84, 0x24, 0xb8, 0xd8, 0xcb, 0x12, 0x8b, 0x32, 0x13, 0xf3, 0x4a,
0x24, 0x98, 0xc1, 0xd2, 0x30, 0xae, 0x93, 0xd7, 0x89, 0x87, 0x72, 0x0c, 0x37, 0x1e, 0xca, 0x31, 0x24, 0x98, 0xc1, 0xd2, 0x30, 0xae, 0x93, 0xd7, 0x89, 0x87, 0x72, 0x0c, 0x37, 0x1e, 0xca, 0x31,
0x34, 0x3c, 0x92, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x34, 0x3c, 0x92, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4,
0x18, 0xa3, 0x0c, 0x88, 0xf7, 0x9e, 0x35, 0x98, 0x4c, 0x62, 0x03, 0x3b, 0xda, 0x18, 0x10, 0x00, 0x18, 0xa3, 0x0c, 0x88, 0xf7, 0x9e, 0x35, 0x98, 0x8c, 0x60, 0x48, 0x62, 0x03, 0x3b, 0xdb, 0x18,
0x00, 0xff, 0xff, 0x97, 0xa1, 0x99, 0x56, 0x19, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0xff, 0xff, 0x05, 0xaa, 0xda, 0xa1, 0x1b, 0x01, 0x00, 0x00,
} }
...@@ -2,7 +2,7 @@ syntax = "proto3"; ...@@ -2,7 +2,7 @@ syntax = "proto3";
package containerd.types; package containerd.types;
import "gogoproto/gogo.proto"; import weak "gogoproto/gogo.proto";
option go_package = "github.com/containerd/containerd/api/types;types"; option go_package = "github.com/containerd/containerd/api/types;types";
......
...@@ -6,7 +6,6 @@ go_library( ...@@ -6,7 +6,6 @@ go_library(
importpath = "github.com/containerd/containerd/api/types/task", importpath = "github.com/containerd/containerd/api/types/task",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/gogo/protobuf/gogoproto:go_default_library",
"//vendor/github.com/gogo/protobuf/proto:go_default_library", "//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/gogo/protobuf/types:go_default_library", "//vendor/github.com/gogo/protobuf/types:go_default_library",
], ],
......
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: github.com/containerd/containerd/api/types/task/task.proto // source: github.com/containerd/containerd/api/types/task/task.proto
// DO NOT EDIT!
/* /*
Package task is a generated protocol buffer package. Package task is a generated protocol buffer package.
...@@ -17,7 +16,8 @@ package task ...@@ -17,7 +16,8 @@ package task
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
// skipping weak import gogoproto "github.com/gogo/protobuf/gogoproto"
import _ "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types"
import google_protobuf2 "github.com/gogo/protobuf/types" import google_protobuf2 "github.com/gogo/protobuf/types"
...@@ -224,24 +224,6 @@ func (m *ProcessInfo) MarshalTo(dAtA []byte) (int, error) { ...@@ -224,24 +224,6 @@ func (m *ProcessInfo) MarshalTo(dAtA []byte) (int, error) {
return i, nil return i, nil
} }
func encodeFixed64Task(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
dAtA[offset+4] = uint8(v >> 32)
dAtA[offset+5] = uint8(v >> 40)
dAtA[offset+6] = uint8(v >> 48)
dAtA[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Task(dAtA []byte, offset int, v uint32) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintTask(dAtA []byte, offset int, v uint64) int { func encodeVarintTask(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
...@@ -869,39 +851,40 @@ func init() { ...@@ -869,39 +851,40 @@ func init() {
} }
var fileDescriptorTask = []byte{ var fileDescriptorTask = []byte{
// 543 bytes of a gzipped FileDescriptorProto // 545 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xcf, 0x6e, 0xd3, 0x4c, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x3f, 0x6f, 0xd3, 0x40,
0x14, 0xc5, 0x33, 0x6e, 0xe3, 0x24, 0xe3, 0xb6, 0x9f, 0x3f, 0x13, 0x55, 0xc6, 0x20, 0xdb, 0xea, 0x18, 0xc6, 0x7d, 0x6e, 0xeb, 0xa6, 0xe7, 0xb6, 0x18, 0x13, 0x55, 0xc6, 0x20, 0xdb, 0xea, 0x64,
0xca, 0x62, 0x61, 0x8b, 0x74, 0xc7, 0x2e, 0xff, 0x84, 0x2c, 0x24, 0x37, 0x72, 0x12, 0xb1, 0x8c, 0x31, 0xd8, 0x22, 0xdd, 0xd8, 0xf2, 0x4f, 0xc8, 0x42, 0x72, 0x23, 0x27, 0x11, 0x6c, 0x91, 0x13,
0x9c, 0x78, 0x62, 0x46, 0x6d, 0x66, 0x2c, 0x7b, 0x0c, 0x64, 0xc7, 0x12, 0x75, 0xc5, 0x0b, 0x74, 0x5f, 0xcc, 0xa9, 0xcd, 0x9d, 0x65, 0x9f, 0x81, 0x6c, 0x8c, 0xa8, 0x13, 0x5f, 0xa0, 0x13, 0x7c,
0x05, 0x4f, 0xc1, 0x13, 0x64, 0xc9, 0x0a, 0xb1, 0x0a, 0xd4, 0x4f, 0x82, 0xc6, 0x76, 0xd2, 0x08, 0x0a, 0x3e, 0x41, 0x46, 0x26, 0xc4, 0x14, 0xa8, 0x3f, 0x09, 0x3a, 0xdb, 0x49, 0x23, 0x60, 0x39,
0xd8, 0x8c, 0xee, 0x3d, 0xbf, 0x33, 0x77, 0xee, 0x1c, 0xf8, 0x22, 0xc2, 0xec, 0x4d, 0x36, 0xb7, 0xbd, 0xef, 0xf3, 0x7b, 0xee, 0xbd, 0xf7, 0x1e, 0xf8, 0x22, 0xc6, 0xec, 0x6d, 0x3e, 0x75, 0x66,
0x17, 0x74, 0xe5, 0x2c, 0x28, 0x61, 0x01, 0x26, 0x28, 0x09, 0x0f, 0xcb, 0x20, 0xc6, 0x0e, 0x5b, 0x74, 0xe1, 0xce, 0x28, 0x61, 0x21, 0x26, 0x28, 0x8d, 0x76, 0xcb, 0x30, 0xc1, 0x2e, 0x5b, 0x26,
0xc7, 0x28, 0x75, 0x58, 0x90, 0x5e, 0x17, 0x87, 0x1d, 0x27, 0x94, 0x51, 0xe5, 0xd1, 0x83, 0xcb, 0x28, 0x73, 0x59, 0x98, 0x5d, 0x95, 0x87, 0x93, 0xa4, 0x94, 0x51, 0xf5, 0xd1, 0xbd, 0xcb, 0x79,
0x7e, 0xfb, 0xdc, 0x2e, 0x4c, 0x5a, 0x3b, 0xa2, 0x11, 0x2d, 0xb8, 0xc3, 0xab, 0xd2, 0xaa, 0x19, 0xf7, 0xdc, 0x29, 0x4d, 0x7a, 0x33, 0xa6, 0x31, 0x2d, 0xb9, 0xcb, 0xab, 0xca, 0xaa, 0x9b, 0x31,
0x11, 0xa5, 0xd1, 0x0d, 0x72, 0x8a, 0x6e, 0x9e, 0x2d, 0x1d, 0x86, 0x57, 0x28, 0x65, 0xc1, 0x2a, 0xa5, 0xf1, 0x35, 0x72, 0xcb, 0x6e, 0x9a, 0xcf, 0x5d, 0x86, 0x17, 0x28, 0x63, 0xe1, 0x22, 0xa9,
0xae, 0x0c, 0x8f, 0xff, 0x34, 0x04, 0x64, 0x5d, 0xa2, 0x8b, 0x5c, 0x80, 0x8d, 0x51, 0x42, 0x17, 0x0d, 0x8f, 0xff, 0x36, 0x84, 0x64, 0x59, 0xa1, 0xf3, 0x42, 0x84, 0x87, 0x83, 0x94, 0xce, 0x50,
0x28, 0x4d, 0x95, 0x0e, 0x3c, 0xd9, 0x3f, 0x3a, 0xc3, 0xa1, 0x0a, 0x4c, 0x60, 0xb5, 0x7a, 0xff, 0x96, 0xa9, 0x2d, 0x78, 0xbc, 0x7d, 0x74, 0x82, 0x23, 0x0d, 0x58, 0xc0, 0x3e, 0xea, 0x3c, 0x28,
0xe5, 0x5b, 0x43, 0xea, 0xef, 0x74, 0x77, 0xe0, 0x4b, 0x7b, 0x93, 0x1b, 0x2a, 0xe7, 0x50, 0xc0, 0xd6, 0xa6, 0xdc, 0xdd, 0xe8, 0x5e, 0x2f, 0x90, 0xb7, 0x26, 0x2f, 0x52, 0xcf, 0xa0, 0x88, 0x23,
0xa1, 0x2a, 0x14, 0x4e, 0x31, 0xdf, 0x1a, 0x82, 0x3b, 0xf0, 0x05, 0x1c, 0x2a, 0x32, 0x3c, 0x8a, 0x4d, 0x2c, 0x9d, 0x52, 0xb1, 0x36, 0x45, 0xaf, 0x17, 0x88, 0x38, 0x52, 0x15, 0xb8, 0x97, 0xe0,
0x71, 0xa8, 0x1e, 0x99, 0xc0, 0x3a, 0xf5, 0x79, 0xa9, 0x5c, 0x42, 0x31, 0x65, 0x01, 0xcb, 0x52, 0x48, 0xdb, 0xb3, 0x80, 0x7d, 0x12, 0xf0, 0x52, 0xbd, 0x80, 0x52, 0xc6, 0x42, 0x96, 0x67, 0xda,
0xf5, 0xd8, 0x04, 0xd6, 0x59, 0xe7, 0x89, 0xfd, 0x8f, 0x1f, 0xda, 0xe3, 0xc2, 0xe2, 0x57, 0x56, 0xbe, 0x05, 0xec, 0xd3, 0xd6, 0x13, 0xe7, 0x3f, 0x3f, 0x74, 0x86, 0xa5, 0x25, 0xa8, 0xad, 0x6a,
0xa5, 0x0d, 0xeb, 0x29, 0x0b, 0x31, 0x51, 0xeb, 0xfc, 0x05, 0xbf, 0x6c, 0x94, 0x73, 0x3e, 0x2a, 0x13, 0x1e, 0x64, 0x2c, 0xc2, 0x44, 0x3b, 0xe0, 0x2f, 0x04, 0x55, 0xa3, 0x9e, 0xf1, 0x51, 0x11,
0xa4, 0x19, 0x53, 0xc5, 0x42, 0xae, 0xba, 0x4a, 0x47, 0x49, 0xa2, 0x36, 0xf6, 0x3a, 0x4a, 0x12, 0xcd, 0x99, 0x26, 0x95, 0x72, 0xdd, 0xd5, 0x3a, 0x4a, 0x53, 0xed, 0x70, 0xab, 0xa3, 0x34, 0x55,
0x45, 0x83, 0x4d, 0x86, 0x92, 0x15, 0x26, 0xc1, 0x8d, 0xda, 0x34, 0x81, 0xd5, 0xf4, 0xf7, 0xbd, 0x75, 0xd8, 0x60, 0x28, 0x5d, 0x60, 0x12, 0x5e, 0x6b, 0x0d, 0x0b, 0xd8, 0x8d, 0x60, 0xdb, 0xab,
0x62, 0x40, 0x09, 0xbd, 0xc7, 0x6c, 0x56, 0xed, 0xd6, 0x2a, 0x16, 0x86, 0x5c, 0x2a, 0x57, 0x51, 0x26, 0x94, 0xd1, 0x07, 0xcc, 0x26, 0xf5, 0x6e, 0x47, 0xe5, 0xc2, 0x90, 0x4b, 0xd5, 0x2a, 0x6a,
0xba, 0xb0, 0xc5, 0x3b, 0x14, 0xce, 0x02, 0xa6, 0x42, 0x13, 0x58, 0x52, 0x47, 0xb3, 0xcb, 0x40, 0x1b, 0x1e, 0xf1, 0x0e, 0x45, 0x93, 0x90, 0x69, 0xd0, 0x02, 0xb6, 0xdc, 0xd2, 0x9d, 0x2a, 0x50,
0xed, 0x5d, 0xa0, 0xf6, 0x64, 0x97, 0x78, 0xaf, 0xb9, 0xd9, 0x1a, 0xb5, 0x4f, 0x3f, 0x0d, 0xe0, 0x67, 0x13, 0xa8, 0x33, 0xda, 0x24, 0xde, 0x69, 0xac, 0xd6, 0xa6, 0xf0, 0xf9, 0x97, 0x09, 0x82,
0x37, 0xcb, 0x6b, 0x5d, 0x76, 0xe1, 0x42, 0xa9, 0xca, 0xd8, 0x25, 0x4b, 0xba, 0xcb, 0x06, 0x3c, 0x46, 0x75, 0xad, 0xcd, 0xce, 0x3d, 0x28, 0xd7, 0x19, 0x7b, 0x64, 0x4e, 0x37, 0xd9, 0x80, 0xfb,
0x64, 0x63, 0xc1, 0x63, 0x4c, 0x96, 0xb4, 0xc8, 0x51, 0xea, 0xb4, 0xff, 0x1a, 0xdf, 0x25, 0x6b, 0x6c, 0x6c, 0xb8, 0x8f, 0xc9, 0x9c, 0x96, 0x39, 0xca, 0xad, 0xe6, 0x3f, 0xe3, 0xdb, 0x64, 0x19,
0xbf, 0x70, 0x3c, 0xfb, 0x0e, 0xa0, 0x58, 0x2d, 0xa6, 0xc3, 0xc6, 0xd4, 0x7b, 0xe5, 0x5d, 0xbd, 0x94, 0x8e, 0x67, 0x3f, 0x00, 0x94, 0xea, 0xc5, 0x0c, 0x78, 0x38, 0xf6, 0x5f, 0xf9, 0x97, 0xaf,
0xf6, 0xe4, 0x9a, 0xf6, 0xff, 0xed, 0x9d, 0x79, 0x5a, 0x82, 0x29, 0xb9, 0x26, 0xf4, 0x1d, 0xe1, 0x7d, 0x45, 0xd0, 0x1f, 0xde, 0xdc, 0x5a, 0x27, 0x15, 0x18, 0x93, 0x2b, 0x42, 0xdf, 0x13, 0xce,
0xbc, 0xef, 0x0f, 0xbb, 0x93, 0xe1, 0x40, 0x06, 0x87, 0xbc, 0x9f, 0xa0, 0x80, 0xa1, 0x90, 0x73, 0xbb, 0x41, 0xbf, 0x3d, 0xea, 0xf7, 0x14, 0xb0, 0xcb, 0xbb, 0x29, 0x0a, 0x19, 0x8a, 0x38, 0x0f,
0x7f, 0xea, 0x79, 0xae, 0xf7, 0x52, 0x16, 0x0e, 0xb9, 0x9f, 0x11, 0x82, 0x49, 0xc4, 0xf9, 0x78, 0xc6, 0xbe, 0xef, 0xf9, 0x2f, 0x15, 0x71, 0x97, 0x07, 0x39, 0x21, 0x98, 0xc4, 0x9c, 0x0f, 0x47,
0x72, 0x35, 0x1a, 0x0d, 0x07, 0xf2, 0xd1, 0x21, 0x1f, 0x33, 0x1a, 0xc7, 0x28, 0x54, 0x9e, 0x42, 0x97, 0x83, 0x41, 0xbf, 0xa7, 0xec, 0xed, 0xf2, 0x21, 0xa3, 0x49, 0x82, 0x22, 0xf5, 0x29, 0x94,
0x71, 0xd4, 0x9d, 0x8e, 0x87, 0x03, 0xf9, 0x58, 0x93, 0x6f, 0xef, 0xcc, 0x93, 0x12, 0x8f, 0x82, 0x06, 0xed, 0xf1, 0xb0, 0xdf, 0x53, 0xf6, 0x75, 0xe5, 0xe6, 0xd6, 0x3a, 0xae, 0xf0, 0x20, 0xcc,
0x2c, 0x2d, 0xa7, 0x73, 0xca, 0xa7, 0xd7, 0x0f, 0x6f, 0x73, 0x8c, 0x49, 0xa4, 0x9d, 0x7d, 0xfc, 0xb3, 0x6a, 0x3a, 0xa7, 0x7c, 0xfa, 0xc1, 0xee, 0x6d, 0x8e, 0x31, 0x89, 0xf5, 0xd3, 0x4f, 0x5f,
0xac, 0xd7, 0xbe, 0x7e, 0xd1, 0xab, 0xdf, 0xf4, 0xd4, 0xcd, 0xbd, 0x5e, 0xfb, 0x71, 0xaf, 0xd7, 0x0c, 0xe1, 0xdb, 0x57, 0xa3, 0xfe, 0x4d, 0x47, 0x5b, 0xdd, 0x19, 0xc2, 0xcf, 0x3b, 0x43, 0xf8,
0x3e, 0xe4, 0x3a, 0xd8, 0xe4, 0x3a, 0xf8, 0x96, 0xeb, 0xe0, 0x57, 0xae, 0x83, 0xb9, 0x58, 0xc4, 0x58, 0x18, 0x60, 0x55, 0x18, 0xe0, 0x7b, 0x61, 0x80, 0xdf, 0x85, 0x01, 0xde, 0x08, 0x53, 0xa9,
0x70, 0xf9, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x19, 0xf7, 0x5b, 0x8f, 0x4e, 0x03, 0x00, 0x00, 0x0c, 0xe2, 0xe2, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x32, 0xd2, 0x86, 0x50, 0x03, 0x00,
0x00,
} }
...@@ -2,7 +2,7 @@ syntax = "proto3"; ...@@ -2,7 +2,7 @@ syntax = "proto3";
package containerd.v1.types; package containerd.v1.types;
import "gogoproto/gogo.proto"; import weak "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto"; import "google/protobuf/any.proto";
......
...@@ -42,7 +42,7 @@ func Dialer(address string, timeout time.Duration) (net.Conn, error) { ...@@ -42,7 +42,7 @@ func Dialer(address string, timeout time.Duration) (net.Conn, error) {
close(stopC) close(stopC)
go func() { go func() {
dr := <-synC dr := <-synC
if dr != nil { if dr != nil && dr.c != nil {
dr.c.Close() dr.c.Close()
} }
}() }()
......
...@@ -10,7 +10,6 @@ go_library( ...@@ -10,7 +10,6 @@ go_library(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/pkg/errors:go_default_library", "//vendor/github.com/pkg/errors:go_default_library",
"//vendor/google.golang.org/grpc:go_default_library",
"//vendor/google.golang.org/grpc/codes:go_default_library", "//vendor/google.golang.org/grpc/codes:go_default_library",
"//vendor/google.golang.org/grpc/status:go_default_library", "//vendor/google.golang.org/grpc/status:go_default_library",
], ],
......
...@@ -4,7 +4,6 @@ import ( ...@@ -4,7 +4,6 @@ import (
"strings" "strings"
"github.com/pkg/errors" "github.com/pkg/errors"
"google.golang.org/grpc"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
) )
...@@ -61,7 +60,7 @@ func FromGRPC(err error) error { ...@@ -61,7 +60,7 @@ func FromGRPC(err error) error {
var cls error // divide these into error classes, becomes the cause var cls error // divide these into error classes, becomes the cause
switch grpc.Code(err) { switch code(err) {
case codes.InvalidArgument: case codes.InvalidArgument:
cls = ErrInvalidArgument cls = ErrInvalidArgument
case codes.AlreadyExists: case codes.AlreadyExists:
...@@ -94,7 +93,7 @@ func FromGRPC(err error) error { ...@@ -94,7 +93,7 @@ func FromGRPC(err error) error {
// Effectively, we just remove the string of cls from the end of err if it // Effectively, we just remove the string of cls from the end of err if it
// appears there. // appears there.
func rebaseMessage(cls error, err error) string { func rebaseMessage(cls error, err error) string {
desc := grpc.ErrorDesc(err) desc := errDesc(err)
clss := cls.Error() clss := cls.Error()
if desc == clss { if desc == clss {
return "" return ""
...@@ -107,3 +106,17 @@ func isGRPCError(err error) bool { ...@@ -107,3 +106,17 @@ func isGRPCError(err error) bool {
_, ok := status.FromError(err) _, ok := status.FromError(err)
return ok return ok
} }
func code(err error) codes.Code {
if s, ok := status.FromError(err); ok {
return s.Code()
}
return codes.Unknown
}
func errDesc(err error) string {
if s, ok := status.FromError(err); ok {
return s.Message()
}
return err.Error()
}
...@@ -16,7 +16,10 @@ filegroup( ...@@ -16,7 +16,10 @@ filegroup(
filegroup( filegroup(
name = "all-srcs", name = "all-srcs",
srcs = [":package-srcs"], srcs = [
":package-srcs",
"//vendor/github.com/docker/docker/pkg/parsers/operatingsystem:all-srcs",
],
tags = ["automanaged"], tags = ["automanaged"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
...@@ -2,9 +2,36 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") ...@@ -2,9 +2,36 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library( go_library(
name = "go_default_library", name = "go_default_library",
srcs = ["doc.go"], srcs = select({
importpath = "google.golang.org/grpc/grpclb/grpc_lb_v1", "@io_bazel_rules_go//go/platform:darwin": [
"operatingsystem_unix.go",
],
"@io_bazel_rules_go//go/platform:freebsd": [
"operatingsystem_unix.go",
],
"@io_bazel_rules_go//go/platform:linux": [
"operatingsystem_linux.go",
],
"@io_bazel_rules_go//go/platform:solaris": [
"operatingsystem_solaris.go",
],
"@io_bazel_rules_go//go/platform:windows": [
"operatingsystem_windows.go",
],
"//conditions:default": [],
}),
cgo = True,
importpath = "github.com/docker/docker/pkg/parsers/operatingsystem",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = select({
"@io_bazel_rules_go//go/platform:linux": [
"//vendor/github.com/mattn/go-shellwords:go_default_library",
],
"@io_bazel_rules_go//go/platform:windows": [
"//vendor/golang.org/x/sys/windows:go_default_library",
],
"//conditions:default": [],
}),
) )
filegroup( filegroup(
...@@ -16,10 +43,7 @@ filegroup( ...@@ -16,10 +43,7 @@ filegroup(
filegroup( filegroup(
name = "all-srcs", name = "all-srcs",
srcs = [ srcs = [":package-srcs"],
":package-srcs",
"//vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages:all-srcs",
],
tags = ["automanaged"], tags = ["automanaged"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
// Package operatingsystem provides helper function to get the operating system
// name for different platforms.
package operatingsystem
import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/mattn/go-shellwords"
)
var (
// file to use to detect if the daemon is running in a container
proc1Cgroup = "/proc/1/cgroup"
// file to check to determine Operating System
etcOsRelease = "/etc/os-release"
// used by stateless systems like Clear Linux
altOsRelease = "/usr/lib/os-release"
)
// GetOperatingSystem gets the name of the current operating system.
func GetOperatingSystem() (string, error) {
osReleaseFile, err := os.Open(etcOsRelease)
if err != nil {
if !os.IsNotExist(err) {
return "", fmt.Errorf("Error opening %s: %v", etcOsRelease, err)
}
osReleaseFile, err = os.Open(altOsRelease)
if err != nil {
return "", fmt.Errorf("Error opening %s: %v", altOsRelease, err)
}
}
defer osReleaseFile.Close()
var prettyName string
scanner := bufio.NewScanner(osReleaseFile)
for scanner.Scan() {
line := scanner.Text()
if strings.HasPrefix(line, "PRETTY_NAME=") {
data := strings.SplitN(line, "=", 2)
prettyNames, err := shellwords.Parse(data[1])
if err != nil {
return "", fmt.Errorf("PRETTY_NAME is invalid: %s", err.Error())
}
if len(prettyNames) != 1 {
return "", fmt.Errorf("PRETTY_NAME needs to be enclosed by quotes if they have spaces: %s", data[1])
}
prettyName = prettyNames[0]
}
}
if prettyName != "" {
return prettyName, nil
}
// If not set, defaults to PRETTY_NAME="Linux"
// c.f. http://www.freedesktop.org/software/systemd/man/os-release.html
return "Linux", nil
}
// IsContainerized returns true if we are running inside a container.
func IsContainerized() (bool, error) {
b, err := ioutil.ReadFile(proc1Cgroup)
if err != nil {
return false, err
}
for _, line := range bytes.Split(b, []byte{'\n'}) {
if len(line) > 0 && !bytes.HasSuffix(line, []byte{'/'}) && !bytes.HasSuffix(line, []byte("init.scope")) {
return true, nil
}
}
return false, nil
}
// +build solaris,cgo
package operatingsystem
/*
#include <zone.h>
*/
import "C"
import (
"bytes"
"errors"
"io/ioutil"
)
var etcOsRelease = "/etc/release"
// GetOperatingSystem gets the name of the current operating system.
func GetOperatingSystem() (string, error) {
b, err := ioutil.ReadFile(etcOsRelease)
if err != nil {
return "", err
}
if i := bytes.Index(b, []byte("\n")); i >= 0 {
b = bytes.Trim(b[:i], " ")
return string(b), nil
}
return "", errors.New("release not found")
}
// IsContainerized returns true if we are running inside a container.
func IsContainerized() (bool, error) {
if C.getzoneid() != 0 {
return true, nil
}
return false, nil
}
// +build freebsd darwin
package operatingsystem
import (
"errors"
"os/exec"
)
// GetOperatingSystem gets the name of the current operating system.
func GetOperatingSystem() (string, error) {
cmd := exec.Command("uname", "-s")
osName, err := cmd.Output()
if err != nil {
return "", err
}
return string(osName), nil
}
// IsContainerized returns true if we are running inside a container.
// No-op on FreeBSD and Darwin, always returns false.
func IsContainerized() (bool, error) {
// TODO: Implement jail detection for freeBSD
return false, errors.New("Cannot detect if we are in container")
}
package operatingsystem
import (
"unsafe"
"golang.org/x/sys/windows"
)
// See https://code.google.com/p/go/source/browse/src/pkg/mime/type_windows.go?r=d14520ac25bf6940785aabb71f5be453a286f58c
// for a similar sample
// GetOperatingSystem gets the name of the current operating system.
func GetOperatingSystem() (string, error) {
var h windows.Handle
// Default return value
ret := "Unknown Operating System"
if err := windows.RegOpenKeyEx(windows.HKEY_LOCAL_MACHINE,
windows.StringToUTF16Ptr(`SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\`),
0,
windows.KEY_READ,
&h); err != nil {
return ret, err
}
defer windows.RegCloseKey(h)
var buf [1 << 10]uint16
var typ uint32
n := uint32(len(buf) * 2) // api expects array of bytes, not uint16
if err := windows.RegQueryValueEx(h,
windows.StringToUTF16Ptr("ProductName"),
nil,
&typ,
(*byte)(unsafe.Pointer(&buf[0])),
&n); err != nil {
return ret, err
}
ret = windows.UTF16ToString(buf[:])
return ret, nil
}
// IsContainerized returns true if we are running inside a container.
// No-op on Windows, always returns false.
func IsContainerized() (bool, error) {
return false, nil
}
...@@ -31,7 +31,6 @@ filegroup( ...@@ -31,7 +31,6 @@ filegroup(
":package-srcs", ":package-srcs",
"//vendor/github.com/golang/protobuf/ptypes/any:all-srcs", "//vendor/github.com/golang/protobuf/ptypes/any:all-srcs",
"//vendor/github.com/golang/protobuf/ptypes/duration:all-srcs", "//vendor/github.com/golang/protobuf/ptypes/duration:all-srcs",
"//vendor/github.com/golang/protobuf/ptypes/empty:all-srcs",
"//vendor/github.com/golang/protobuf/ptypes/struct:all-srcs", "//vendor/github.com/golang/protobuf/ptypes/struct:all-srcs",
"//vendor/github.com/golang/protobuf/ptypes/timestamp:all-srcs", "//vendor/github.com/golang/protobuf/ptypes/timestamp:all-srcs",
"//vendor/github.com/golang/protobuf/ptypes/wrappers:all-srcs", "//vendor/github.com/golang/protobuf/ptypes/wrappers:all-srcs",
......
load("@io_bazel_rules_go//go:def.bzl", "go_library")
filegroup(
name = "go_default_library_protos",
srcs = ["empty.proto"],
visibility = ["//visibility:public"],
)
go_library(
name = "go_default_library",
srcs = ["empty.pb.go"],
importpath = "github.com/golang/protobuf/ptypes/empty",
visibility = ["//visibility:public"],
deps = ["//vendor/github.com/golang/protobuf/proto: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"],
)
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/empty.proto
package empty
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// A generic empty message that you can re-use to avoid defining duplicated
// empty messages in your APIs. A typical example is to use it as the request
// or the response type of an API method. For instance:
//
// service Foo {
// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
// }
//
// The JSON representation for `Empty` is empty JSON object `{}`.
type Empty struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) {
return fileDescriptor_empty_39e6d6db0632e5b2, []int{0}
}
func (*Empty) XXX_WellKnownType() string { return "Empty" }
func (m *Empty) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Empty.Unmarshal(m, b)
}
func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Empty.Marshal(b, m, deterministic)
}
func (dst *Empty) XXX_Merge(src proto.Message) {
xxx_messageInfo_Empty.Merge(dst, src)
}
func (m *Empty) XXX_Size() int {
return xxx_messageInfo_Empty.Size(m)
}
func (m *Empty) XXX_DiscardUnknown() {
xxx_messageInfo_Empty.DiscardUnknown(m)
}
var xxx_messageInfo_Empty proto.InternalMessageInfo
func init() {
proto.RegisterType((*Empty)(nil), "google.protobuf.Empty")
}
func init() { proto.RegisterFile("google/protobuf/empty.proto", fileDescriptor_empty_39e6d6db0632e5b2) }
var fileDescriptor_empty_39e6d6db0632e5b2 = []byte{
// 148 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xcf, 0xcf, 0x4f,
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcd, 0x2d, 0x28,
0xa9, 0xd4, 0x03, 0x73, 0x85, 0xf8, 0x21, 0x92, 0x7a, 0x30, 0x49, 0x25, 0x76, 0x2e, 0x56, 0x57,
0x90, 0xbc, 0x53, 0x19, 0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x9a, 0xbc, 0x13, 0x17, 0x58, 0x36,
0x00, 0xc4, 0x0d, 0x60, 0x8c, 0x52, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf,
0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0x47, 0x58, 0x53, 0x50, 0x52, 0x59, 0x90, 0x5a, 0x0c,
0xb1, 0xed, 0x07, 0x23, 0xe3, 0x22, 0x26, 0x66, 0xf7, 0x00, 0xa7, 0x55, 0x4c, 0x72, 0xee, 0x10,
0x13, 0x03, 0xa0, 0xea, 0xf4, 0xc2, 0x53, 0x73, 0x72, 0xbc, 0xf3, 0xf2, 0xcb, 0xf3, 0x42, 0x40,
0xea, 0x93, 0xd8, 0xc0, 0x06, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x64, 0xd4, 0xb3, 0xa6,
0xb7, 0x00, 0x00, 0x00,
}
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package google.protobuf;
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option go_package = "github.com/golang/protobuf/ptypes/empty";
option java_package = "com.google.protobuf";
option java_outer_classname = "EmptyProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option cc_enable_arenas = true;
// A generic empty message that you can re-use to avoid defining duplicated
// empty messages in your APIs. A typical example is to use it as the request
// or the response type of an API method. For instance:
//
// service Foo {
// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
// }
//
// The JSON representation for `Empty` is empty JSON object `{}`.
message Empty {}
...@@ -70,16 +70,16 @@ type InMemoryCache struct { ...@@ -70,16 +70,16 @@ type InMemoryCache struct {
backend storage.StorageDriver backend storage.StorageDriver
} }
func (self *InMemoryCache) AddStats(ref info.ContainerReference, stats *info.ContainerStats) error { func (self *InMemoryCache) AddStats(cInfo *info.ContainerInfo, stats *info.ContainerStats) error {
var cstore *containerCache var cstore *containerCache
var ok bool var ok bool
func() { func() {
self.lock.Lock() self.lock.Lock()
defer self.lock.Unlock() defer self.lock.Unlock()
if cstore, ok = self.containerCacheMap[ref.Name]; !ok { if cstore, ok = self.containerCacheMap[cInfo.ContainerReference.Name]; !ok {
cstore = newContainerStore(ref, self.maxAge) cstore = newContainerStore(cInfo.ContainerReference, self.maxAge)
self.containerCacheMap[ref.Name] = cstore self.containerCacheMap[cInfo.ContainerReference.Name] = cstore
} }
}() }()
...@@ -87,7 +87,7 @@ func (self *InMemoryCache) AddStats(ref info.ContainerReference, stats *info.Con ...@@ -87,7 +87,7 @@ func (self *InMemoryCache) AddStats(ref info.ContainerReference, stats *info.Con
// TODO(monnand): To deal with long delay write operations, we // TODO(monnand): To deal with long delay write operations, we
// may want to start a pool of goroutines to do write // may want to start a pool of goroutines to do write
// operations. // operations.
if err := self.backend.AddStats(ref, stats); err != nil { if err := self.backend.AddStats(cInfo, stats); err != nil {
glog.Error(err) glog.Error(err)
} }
} }
......
...@@ -5,18 +5,18 @@ go_library( ...@@ -5,18 +5,18 @@ go_library(
srcs = [ srcs = [
"container_hints.go", "container_hints.go",
"fsHandler.go", "fsHandler.go",
"fsnotify_watcher.go",
"helpers.go", "helpers.go",
"inotify_watcher.go",
], ],
importpath = "github.com/google/cadvisor/container/common", importpath = "github.com/google/cadvisor/container/common",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/fsnotify/fsnotify:go_default_library",
"//vendor/github.com/golang/glog:go_default_library", "//vendor/github.com/golang/glog: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/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/utils:go_default_library", "//vendor/github.com/google/cadvisor/utils:go_default_library",
"//vendor/golang.org/x/exp/inotify:go_default_library",
], ],
) )
......
...@@ -17,15 +17,15 @@ package common ...@@ -17,15 +17,15 @@ package common
import ( import (
"sync" "sync"
"golang.org/x/exp/inotify" "github.com/fsnotify/fsnotify"
) )
// Watcher for container-related inotify events in the cgroup hierarchy. // Watcher for container-related fsnotify events in the cgroup hierarchy.
// //
// Implementation is thread-safe. // Implementation is thread-safe.
type InotifyWatcher struct { type FsnotifyWatcher struct {
// Underlying inotify watcher. // Underlying fsnotify watcher.
watcher *inotify.Watcher watcher *fsnotify.Watcher
// Map of containers being watched to cgroup paths watched for that container. // Map of containers being watched to cgroup paths watched for that container.
containersWatched map[string]map[string]bool containersWatched map[string]map[string]bool
...@@ -34,28 +34,28 @@ type InotifyWatcher struct { ...@@ -34,28 +34,28 @@ type InotifyWatcher struct {
lock sync.Mutex lock sync.Mutex
} }
func NewInotifyWatcher() (*InotifyWatcher, error) { func NewFsnotifyWatcher() (*FsnotifyWatcher, error) {
w, err := inotify.NewWatcher() w, err := fsnotify.NewWatcher()
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &InotifyWatcher{ return &FsnotifyWatcher{
watcher: w, watcher: w,
containersWatched: make(map[string]map[string]bool), containersWatched: make(map[string]map[string]bool),
}, nil }, nil
} }
// Add a watch to the specified directory. Returns if the container was already being watched. // Add a watch to the specified directory. Returns if the container was already being watched.
func (iw *InotifyWatcher) AddWatch(containerName, dir string) (bool, error) { func (iw *FsnotifyWatcher) AddWatch(containerName, dir string) (bool, error) {
iw.lock.Lock() iw.lock.Lock()
defer iw.lock.Unlock() defer iw.lock.Unlock()
cgroupsWatched, alreadyWatched := iw.containersWatched[containerName] cgroupsWatched, alreadyWatched := iw.containersWatched[containerName]
// Register an inotify notification. // Register an fsnotify notification.
if !cgroupsWatched[dir] { if !cgroupsWatched[dir] {
err := iw.watcher.AddWatch(dir, inotify.IN_CREATE|inotify.IN_DELETE|inotify.IN_MOVE) err := iw.watcher.Add(dir)
if err != nil { if err != nil {
return alreadyWatched, err return alreadyWatched, err
} }
...@@ -74,7 +74,7 @@ func (iw *InotifyWatcher) AddWatch(containerName, dir string) (bool, error) { ...@@ -74,7 +74,7 @@ func (iw *InotifyWatcher) AddWatch(containerName, dir string) (bool, error) {
} }
// Remove watch from the specified directory. Returns if this was the last watch on the specified container. // Remove watch from the specified directory. Returns if this was the last watch on the specified container.
func (iw *InotifyWatcher) RemoveWatch(containerName, dir string) (bool, error) { func (iw *FsnotifyWatcher) RemoveWatch(containerName, dir string) (bool, error) {
iw.lock.Lock() iw.lock.Lock()
defer iw.lock.Unlock() defer iw.lock.Unlock()
...@@ -84,9 +84,9 @@ func (iw *InotifyWatcher) RemoveWatch(containerName, dir string) (bool, error) { ...@@ -84,9 +84,9 @@ func (iw *InotifyWatcher) RemoveWatch(containerName, dir string) (bool, error) {
return false, nil return false, nil
} }
// Remove the inotify watch if it exists. // Remove the fsnotify watch if it exists.
if cgroupsWatched[dir] { if cgroupsWatched[dir] {
err := iw.watcher.RemoveWatch(dir) err := iw.watcher.Remove(dir)
if err != nil { if err != nil {
return false, nil return false, nil
} }
...@@ -103,22 +103,22 @@ func (iw *InotifyWatcher) RemoveWatch(containerName, dir string) (bool, error) { ...@@ -103,22 +103,22 @@ func (iw *InotifyWatcher) RemoveWatch(containerName, dir string) (bool, error) {
} }
// Errors are returned on this channel. // Errors are returned on this channel.
func (iw *InotifyWatcher) Error() chan error { func (iw *FsnotifyWatcher) Error() chan error {
return iw.watcher.Error return iw.watcher.Errors
} }
// Events are returned on this channel. // Events are returned on this channel.
func (iw *InotifyWatcher) Event() chan *inotify.Event { func (iw *FsnotifyWatcher) Event() chan fsnotify.Event {
return iw.watcher.Event return iw.watcher.Events
} }
// Closes the inotify watcher. // Closes the fsnotify watcher.
func (iw *InotifyWatcher) Close() error { func (iw *FsnotifyWatcher) Close() error {
return iw.watcher.Close() return iw.watcher.Close()
} }
// Returns a map of containers to the cgroup paths being watched. // Returns a map of containers to the cgroup paths being watched.
func (iw *InotifyWatcher) GetWatches() map[string][]string { func (iw *FsnotifyWatcher) GetWatches() map[string][]string {
out := make(map[string][]string, len(iw.containersWatched)) out := make(map[string][]string, len(iw.containersWatched))
for k, v := range iw.containersWatched { for k, v := range iw.containersWatched {
out[k] = mapToSlice(v) out[k] = mapToSlice(v)
......
...@@ -40,7 +40,7 @@ func DebugInfo(watches map[string][]string) map[string][]string { ...@@ -40,7 +40,7 @@ func DebugInfo(watches map[string][]string) map[string][]string {
lines = append(lines, fmt.Sprintf("\t%s", cg)) lines = append(lines, fmt.Sprintf("\t%s", cg))
} }
} }
out["Inotify watches"] = lines out["Fsnotify watches"] = lines
return out return out
} }
......
...@@ -18,15 +18,14 @@ go_library( ...@@ -18,15 +18,14 @@ go_library(
"//vendor/github.com/containerd/containerd/dialer:go_default_library", "//vendor/github.com/containerd/containerd/dialer:go_default_library",
"//vendor/github.com/containerd/containerd/errdefs:go_default_library", "//vendor/github.com/containerd/containerd/errdefs:go_default_library",
"//vendor/github.com/containerd/containerd/namespaces:go_default_library", "//vendor/github.com/containerd/containerd/namespaces:go_default_library",
"//vendor/github.com/gogo/protobuf/types:go_default_library",
"//vendor/github.com/golang/glog:go_default_library", "//vendor/github.com/golang/glog:go_default_library",
"//vendor/github.com/golang/protobuf/ptypes/empty: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/container/common: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/container/libcontainer:go_default_library",
"//vendor/github.com/google/cadvisor/fs: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/manager/watcher: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/cgroups/fs:go_default_library",
"//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library", "//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
"//vendor/github.com/opencontainers/runtime-spec/specs-go:go_default_library", "//vendor/github.com/opencontainers/runtime-spec/specs-go:go_default_library",
......
...@@ -16,6 +16,8 @@ package containerd ...@@ -16,6 +16,8 @@ package containerd
import ( import (
"context" "context"
"fmt"
"net"
"sync" "sync"
"time" "time"
...@@ -25,7 +27,7 @@ import ( ...@@ -25,7 +27,7 @@ import (
"github.com/containerd/containerd/containers" "github.com/containerd/containerd/containers"
"github.com/containerd/containerd/dialer" "github.com/containerd/containerd/dialer"
"github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/errdefs"
pempty "github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
...@@ -49,16 +51,29 @@ type containerdClient interface { ...@@ -49,16 +51,29 @@ type containerdClient interface {
var once sync.Once var once sync.Once
var ctrdClient containerdClient = nil var ctrdClient containerdClient = nil
const (
address = "/run/containerd/containerd.sock"
maxBackoffDelay = 3 * time.Second
connectionTimeout = 2 * time.Second
)
// Client creates a containerd client // Client creates a containerd client
func Client() (containerdClient, error) { func Client() (containerdClient, error) {
var retErr error var retErr error
once.Do(func() { once.Do(func() {
tryConn, err := net.DialTimeout("unix", address, connectionTimeout)
if err != nil {
retErr = fmt.Errorf("containerd: cannot unix dial containerd api service: %v", err)
return
}
tryConn.Close()
gopts := []grpc.DialOption{ gopts := []grpc.DialOption{
grpc.WithInsecure(), grpc.WithInsecure(),
grpc.WithDialer(dialer.Dialer), grpc.WithDialer(dialer.Dialer),
grpc.WithBlock(), grpc.WithBlock(),
grpc.WithTimeout(2 * time.Second), grpc.WithBackoffMaxDelay(maxBackoffDelay),
grpc.WithBackoffMaxDelay(3 * time.Second), grpc.WithTimeout(connectionTimeout),
} }
unary, stream := newNSInterceptors(k8sNamespace) unary, stream := newNSInterceptors(k8sNamespace)
gopts = append(gopts, gopts = append(gopts,
...@@ -66,7 +81,7 @@ func Client() (containerdClient, error) { ...@@ -66,7 +81,7 @@ func Client() (containerdClient, error) {
grpc.WithStreamInterceptor(stream), grpc.WithStreamInterceptor(stream),
) )
conn, err := grpc.Dial(dialer.DialAddress("/var/run/containerd/containerd.sock"), gopts...) conn, err := grpc.Dial(dialer.DialAddress(address), gopts...)
if err != nil { if err != nil {
retErr = err retErr = err
return return
...@@ -101,7 +116,7 @@ func (c *client) TaskPid(ctx context.Context, id string) (uint32, error) { ...@@ -101,7 +116,7 @@ func (c *client) TaskPid(ctx context.Context, id string) (uint32, error) {
} }
func (c *client) Version(ctx context.Context) (string, error) { func (c *client) Version(ctx context.Context) (string, error) {
response, err := c.versionService.Version(ctx, &pempty.Empty{}) response, err := c.versionService.Version(ctx, &ptypes.Empty{})
if err != nil { if err != nil {
return "", errdefs.FromGRPC(err) return "", errdefs.FromGRPC(err)
} }
......
...@@ -23,7 +23,6 @@ import ( ...@@ -23,7 +23,6 @@ import (
"time" "time"
"github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/errdefs"
"github.com/opencontainers/runc/libcontainer/cgroups"
cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs" cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs"
libcontainerconfigs "github.com/opencontainers/runc/libcontainer/configs" libcontainerconfigs "github.com/opencontainers/runc/libcontainer/configs"
"golang.org/x/net/context" "golang.org/x/net/context"
...@@ -37,31 +36,21 @@ import ( ...@@ -37,31 +36,21 @@ import (
) )
type containerdContainerHandler struct { type containerdContainerHandler struct {
client containerdClient
name string
id string
aliases []string
machineInfoFactory info.MachineInfoFactory machineInfoFactory info.MachineInfoFactory
// Absolute path to the cgroup hierarchies of this container. // Absolute path to the cgroup hierarchies of this container.
// (e.g.: "cpu" -> "/sys/fs/cgroup/cpu/test") // (e.g.: "cpu" -> "/sys/fs/cgroup/cpu/test")
cgroupPaths map[string]string cgroupPaths map[string]string
// Manager of this container's cgroups. fsInfo fs.FsInfo
cgroupManager cgroups.Manager
fsInfo fs.FsInfo
poolName string
// Time at which this container was created.
creationTime time.Time
// Metadata associated with the container. // Metadata associated with the container.
labels map[string]string reference info.ContainerReference
envs map[string]string envs map[string]string
// The container PID used to switch namespaces as required labels map[string]string
pid int
// Image name used for this container. // Image name used for this container.
image string image string
// The host root FS to read
rootFs string
// Filesystem handler. // Filesystem handler.
ignoreMetrics container.MetricSet ignoreMetrics container.MetricSet
libcontainerHandler *containerlibcontainer.Handler
} }
var _ container.ContainerHandler = &containerdContainerHandler{} var _ container.ContainerHandler = &containerdContainerHandler{}
...@@ -131,25 +120,27 @@ func newContainerdContainerHandler( ...@@ -131,25 +120,27 @@ func newContainerdContainerHandler(
rootfs = "/rootfs" rootfs = "/rootfs"
} }
containerReference := info.ContainerReference{
Id: id,
Name: name,
Namespace: k8sContainerdNamespace,
Aliases: []string{id, name},
}
libcontainerHandler := containerlibcontainer.NewHandler(cgroupManager, rootfs, int(taskPid), ignoreMetrics)
handler := &containerdContainerHandler{ handler := &containerdContainerHandler{
id: id, machineInfoFactory: machineInfoFactory,
client: client, cgroupPaths: cgroupPaths,
name: name, fsInfo: fsInfo,
machineInfoFactory: machineInfoFactory, envs: make(map[string]string),
cgroupPaths: cgroupPaths, labels: cntr.Labels,
cgroupManager: cgroupManager, ignoreMetrics: ignoreMetrics,
rootFs: rootfs, reference: containerReference,
fsInfo: fsInfo, libcontainerHandler: libcontainerHandler,
envs: make(map[string]string),
labels: make(map[string]string),
ignoreMetrics: ignoreMetrics,
pid: int(taskPid),
creationTime: cntr.CreatedAt,
} }
// Add the name and bare ID as aliases of the container. // Add the name and bare ID as aliases of the container.
handler.labels = cntr.Labels
handler.image = cntr.Image handler.image = cntr.Image
handler.aliases = []string{id, name}
for _, envVar := range spec.Process.Env { for _, envVar := range spec.Process.Env {
if envVar != "" { if envVar != "" {
splits := strings.SplitN(envVar, "=", 2) splits := strings.SplitN(envVar, "=", 2)
...@@ -163,13 +154,7 @@ func newContainerdContainerHandler( ...@@ -163,13 +154,7 @@ func newContainerdContainerHandler(
} }
func (self *containerdContainerHandler) ContainerReference() (info.ContainerReference, error) { func (self *containerdContainerHandler) ContainerReference() (info.ContainerReference, error) {
return info.ContainerReference{ return self.reference, nil
Id: self.id,
Name: self.name,
Namespace: k8sContainerdNamespace,
Labels: self.labels,
Aliases: self.aliases,
}, nil
} }
func (self *containerdContainerHandler) needNet() bool { func (self *containerdContainerHandler) needNet() bool {
...@@ -208,7 +193,7 @@ func (self *containerdContainerHandler) getFsStats(stats *info.ContainerStats) e ...@@ -208,7 +193,7 @@ func (self *containerdContainerHandler) getFsStats(stats *info.ContainerStats) e
} }
func (self *containerdContainerHandler) GetStats() (*info.ContainerStats, error) { func (self *containerdContainerHandler) GetStats() (*info.ContainerStats, error) {
stats, err := containerlibcontainer.GetStats(self.cgroupManager, self.rootFs, self.pid, self.ignoreMetrics) stats, err := self.libcontainerHandler.GetStats()
if err != nil { if err != nil {
return stats, err return stats, err
} }
...@@ -232,7 +217,7 @@ func (self *containerdContainerHandler) ListContainers(listType container.ListTy ...@@ -232,7 +217,7 @@ func (self *containerdContainerHandler) ListContainers(listType container.ListTy
func (self *containerdContainerHandler) GetCgroupPath(resource string) (string, error) { func (self *containerdContainerHandler) GetCgroupPath(resource string) (string, error) {
path, ok := self.cgroupPaths[resource] path, ok := self.cgroupPaths[resource]
if !ok { if !ok {
return "", fmt.Errorf("could not find path for resource %q for container %q\n", resource, self.name) return "", fmt.Errorf("could not find path for resource %q for container %q\n", resource, self.reference.Name)
} }
return path, nil return path, nil
} }
...@@ -242,7 +227,7 @@ func (self *containerdContainerHandler) GetContainerLabels() map[string]string { ...@@ -242,7 +227,7 @@ func (self *containerdContainerHandler) GetContainerLabels() map[string]string {
} }
func (self *containerdContainerHandler) ListProcesses(listType container.ListType) ([]int, error) { func (self *containerdContainerHandler) ListProcesses(listType container.ListType) ([]int, error) {
return containerlibcontainer.GetProcesses(self.cgroupManager) return self.libcontainerHandler.GetProcesses()
} }
func (self *containerdContainerHandler) Exists() bool { func (self *containerdContainerHandler) Exists() bool {
......
...@@ -17,7 +17,6 @@ go_library( ...@@ -17,7 +17,6 @@ go_library(
"//vendor/github.com/google/cadvisor/fs: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/manager/watcher: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/cgroups/fs:go_default_library",
"//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library", "//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
], ],
......
...@@ -21,7 +21,6 @@ import ( ...@@ -21,7 +21,6 @@ import (
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
"time"
"github.com/google/cadvisor/container" "github.com/google/cadvisor/container"
"github.com/google/cadvisor/container/common" "github.com/google/cadvisor/container/common"
...@@ -29,48 +28,32 @@ import ( ...@@ -29,48 +28,32 @@ import (
"github.com/google/cadvisor/fs" "github.com/google/cadvisor/fs"
info "github.com/google/cadvisor/info/v1" info "github.com/google/cadvisor/info/v1"
"github.com/opencontainers/runc/libcontainer/cgroups"
cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs" cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs"
libcontainerconfigs "github.com/opencontainers/runc/libcontainer/configs" libcontainerconfigs "github.com/opencontainers/runc/libcontainer/configs"
) )
type crioContainerHandler struct { type crioContainerHandler struct {
name string
id string
aliases []string
machineInfoFactory info.MachineInfoFactory machineInfoFactory info.MachineInfoFactory
// Absolute path to the cgroup hierarchies of this container. // Absolute path to the cgroup hierarchies of this container.
// (e.g.: "cpu" -> "/sys/fs/cgroup/cpu/test") // (e.g.: "cpu" -> "/sys/fs/cgroup/cpu/test")
cgroupPaths map[string]string cgroupPaths map[string]string
// Manager of this container's cgroups.
cgroupManager cgroups.Manager
// the CRI-O storage driver // the CRI-O storage driver
storageDriver storageDriver storageDriver storageDriver
fsInfo fs.FsInfo fsInfo fs.FsInfo
rootfsStorageDir string rootfsStorageDir string
// Time at which this container was created.
creationTime time.Time
// Metadata associated with the container. // Metadata associated with the container.
labels map[string]string
envs map[string]string envs map[string]string
labels map[string]string
// TODO // TODO
// crio version handling... // crio version handling...
// The container PID used to switch namespaces as required
pid int
// Image name used for this container. // Image name used for this container.
image string image string
// The host root FS to read
rootFs string
// The network mode of the container // The network mode of the container
// TODO // TODO
...@@ -84,6 +67,10 @@ type crioContainerHandler struct { ...@@ -84,6 +67,10 @@ type crioContainerHandler struct {
// container restart count // container restart count
restartCount int restartCount int
reference info.ContainerReference
libcontainerHandler *containerlibcontainer.Handler
} }
var _ container.ContainerHandler = &crioContainerHandler{} var _ container.ContainerHandler = &crioContainerHandler{}
...@@ -150,25 +137,29 @@ func newCrioContainerHandler( ...@@ -150,25 +137,29 @@ func newCrioContainerHandler(
rootfsStorageDir = filepath.Join(rootfsStorageDir, "diff") rootfsStorageDir = filepath.Join(rootfsStorageDir, "diff")
} }
containerReference := info.ContainerReference{
Id: id,
Name: name,
Aliases: []string{cInfo.Name, id},
Namespace: CrioNamespace,
}
libcontainerHandler := containerlibcontainer.NewHandler(cgroupManager, rootFs, cInfo.Pid, ignoreMetrics)
// TODO: extract object mother method // TODO: extract object mother method
handler := &crioContainerHandler{ handler := &crioContainerHandler{
id: id, machineInfoFactory: machineInfoFactory,
name: name, cgroupPaths: cgroupPaths,
machineInfoFactory: machineInfoFactory, storageDriver: storageDriver,
cgroupPaths: cgroupPaths, fsInfo: fsInfo,
cgroupManager: cgroupManager, rootfsStorageDir: rootfsStorageDir,
storageDriver: storageDriver, envs: make(map[string]string),
fsInfo: fsInfo, labels: cInfo.Labels,
rootFs: rootFs, ignoreMetrics: ignoreMetrics,
rootfsStorageDir: rootfsStorageDir, reference: containerReference,
envs: make(map[string]string), libcontainerHandler: libcontainerHandler,
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 handler.image = cInfo.Image
// TODO: we wantd to know graph driver DeviceId (dont think this is needed now) // TODO: we wantd to know graph driver DeviceId (dont think this is needed now)
...@@ -204,13 +195,7 @@ func (self *crioContainerHandler) Cleanup() { ...@@ -204,13 +195,7 @@ func (self *crioContainerHandler) Cleanup() {
} }
func (self *crioContainerHandler) ContainerReference() (info.ContainerReference, error) { func (self *crioContainerHandler) ContainerReference() (info.ContainerReference, error) {
return info.ContainerReference{ return self.reference, nil
Id: self.id,
Name: self.name,
Aliases: self.aliases,
Namespace: CrioNamespace,
Labels: self.labels,
}, nil
} }
func (self *crioContainerHandler) needNet() bool { func (self *crioContainerHandler) needNet() bool {
...@@ -286,7 +271,7 @@ func (self *crioContainerHandler) getFsStats(stats *info.ContainerStats) error { ...@@ -286,7 +271,7 @@ func (self *crioContainerHandler) getFsStats(stats *info.ContainerStats) error {
} }
func (self *crioContainerHandler) GetStats() (*info.ContainerStats, error) { func (self *crioContainerHandler) GetStats() (*info.ContainerStats, error) {
stats, err := containerlibcontainer.GetStats(self.cgroupManager, self.rootFs, self.pid, self.ignoreMetrics) stats, err := self.libcontainerHandler.GetStats()
if err != nil { if err != nil {
return stats, err return stats, err
} }
...@@ -315,7 +300,7 @@ func (self *crioContainerHandler) ListContainers(listType container.ListType) ([ ...@@ -315,7 +300,7 @@ func (self *crioContainerHandler) ListContainers(listType container.ListType) ([
func (self *crioContainerHandler) GetCgroupPath(resource string) (string, error) { func (self *crioContainerHandler) GetCgroupPath(resource string) (string, error) {
path, ok := self.cgroupPaths[resource] path, ok := self.cgroupPaths[resource]
if !ok { if !ok {
return "", fmt.Errorf("could not find path for resource %q for container %q\n", resource, self.name) return "", fmt.Errorf("could not find path for resource %q for container %q\n", resource, self.reference.Name)
} }
return path, nil return path, nil
} }
...@@ -329,7 +314,7 @@ func (self *crioContainerHandler) GetContainerIPAddress() string { ...@@ -329,7 +314,7 @@ func (self *crioContainerHandler) GetContainerIPAddress() string {
} }
func (self *crioContainerHandler) ListProcesses(listType container.ListType) ([]int, error) { func (self *crioContainerHandler) ListProcesses(listType container.ListType) ([]int, error) {
return containerlibcontainer.GetProcesses(self.cgroupManager) return self.libcontainerHandler.GetProcesses()
} }
func (self *crioContainerHandler) Exists() bool { func (self *crioContainerHandler) Exists() bool {
......
...@@ -27,7 +27,6 @@ go_library( ...@@ -27,7 +27,6 @@ go_library(
"//vendor/github.com/google/cadvisor/manager/watcher:go_default_library", "//vendor/github.com/google/cadvisor/manager/watcher:go_default_library",
"//vendor/github.com/google/cadvisor/utils/docker:go_default_library", "//vendor/github.com/google/cadvisor/utils/docker:go_default_library",
"//vendor/github.com/google/cadvisor/zfs:go_default_library", "//vendor/github.com/google/cadvisor/zfs: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/cgroups/fs:go_default_library",
"//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library", "//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library", "//vendor/golang.org/x/net/context:go_default_library",
......
...@@ -35,7 +35,6 @@ import ( ...@@ -35,7 +35,6 @@ import (
dockercontainer "github.com/docker/docker/api/types/container" dockercontainer "github.com/docker/docker/api/types/container"
docker "github.com/docker/docker/client" docker "github.com/docker/docker/client"
"github.com/golang/glog" "github.com/golang/glog"
"github.com/opencontainers/runc/libcontainer/cgroups"
cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs" cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs"
libcontainerconfigs "github.com/opencontainers/runc/libcontainer/configs" libcontainerconfigs "github.com/opencontainers/runc/libcontainer/configs"
"golang.org/x/net/context" "golang.org/x/net/context"
...@@ -52,53 +51,29 @@ const ( ...@@ -52,53 +51,29 @@ const (
) )
type dockerContainerHandler struct { type dockerContainerHandler struct {
client *docker.Client
name string // machineInfoFactory provides info.MachineInfo
id string
aliases []string
machineInfoFactory info.MachineInfoFactory machineInfoFactory info.MachineInfoFactory
// Absolute path to the cgroup hierarchies of this container. // Absolute path to the cgroup hierarchies of this container.
// (e.g.: "cpu" -> "/sys/fs/cgroup/cpu/test") // (e.g.: "cpu" -> "/sys/fs/cgroup/cpu/test")
cgroupPaths map[string]string cgroupPaths map[string]string
// Manager of this container's cgroups.
cgroupManager cgroups.Manager
// the docker storage driver // the docker storage driver
storageDriver storageDriver storageDriver storageDriver
fsInfo fs.FsInfo fsInfo fs.FsInfo
rootfsStorageDir string rootfsStorageDir string
// devicemapper state
// the devicemapper poolname
poolName string
// the devicemapper device id for the container
deviceID string
// zfs Filesystem
zfsFilesystem string
// zfsParent is the parent for docker zfs
zfsParent string
// Time at which this container was created. // Time at which this container was created.
creationTime time.Time creationTime time.Time
// Metadata associated with the container. // Metadata associated with the container.
labels map[string]string
envs map[string]string envs map[string]string
labels map[string]string
// The container PID used to switch namespaces as required
pid int
// Image name used for this container. // Image name used for this container.
image string image string
// The host root FS to read
rootFs string
// The network mode of the container // The network mode of the container
networkMode dockercontainer.NetworkMode networkMode dockercontainer.NetworkMode
...@@ -110,14 +85,19 @@ type dockerContainerHandler struct { ...@@ -110,14 +85,19 @@ type dockerContainerHandler struct {
ignoreMetrics container.MetricSet ignoreMetrics container.MetricSet
// thin pool watcher // the devicemapper poolname
thinPoolWatcher *devicemapper.ThinPoolWatcher poolName string
// zfs watcher // zfsParent is the parent for docker zfs
zfsWatcher *zfs.ZfsWatcher zfsParent string
// container restart count // container restart count
restartCount int restartCount int
// Reference to the container
reference info.ContainerReference
libcontainerHandler *containerlibcontainer.Handler
} }
var _ container.ContainerHandler = &dockerContainerHandler{} var _ container.ContainerHandler = &dockerContainerHandler{}
...@@ -210,46 +190,42 @@ func newDockerContainerHandler( ...@@ -210,46 +190,42 @@ func newDockerContainerHandler(
zfsFilesystem = path.Join(zfsParent, rwLayerID) zfsFilesystem = path.Join(zfsParent, rwLayerID)
} }
// We assume that if Inspect fails then the container is not known to docker.
ctnr, err := client.ContainerInspect(context.Background(), id)
if err != nil {
return nil, fmt.Errorf("failed to inspect container %q: %v", id, err)
}
// TODO: extract object mother method // TODO: extract object mother method
handler := &dockerContainerHandler{ handler := &dockerContainerHandler{
id: id,
client: client,
name: name,
machineInfoFactory: machineInfoFactory, machineInfoFactory: machineInfoFactory,
cgroupPaths: cgroupPaths, cgroupPaths: cgroupPaths,
cgroupManager: cgroupManager,
storageDriver: storageDriver,
fsInfo: fsInfo, fsInfo: fsInfo,
rootFs: rootFs, storageDriver: storageDriver,
poolName: thinPoolName, poolName: thinPoolName,
zfsFilesystem: zfsFilesystem,
rootfsStorageDir: rootfsStorageDir, rootfsStorageDir: rootfsStorageDir,
envs: make(map[string]string), envs: make(map[string]string),
labels: ctnr.Config.Labels,
ignoreMetrics: ignoreMetrics, ignoreMetrics: ignoreMetrics,
thinPoolWatcher: thinPoolWatcher,
zfsWatcher: zfsWatcher,
zfsParent: zfsParent, zfsParent: zfsParent,
} }
// We assume that if Inspect fails then the container is not known to docker.
ctnr, err := client.ContainerInspect(context.Background(), id)
if err != nil {
return nil, fmt.Errorf("failed to inspect container %q: %v", id, err)
}
// Timestamp returned by Docker is in time.RFC3339Nano format. // Timestamp returned by Docker is in time.RFC3339Nano format.
handler.creationTime, err = time.Parse(time.RFC3339Nano, ctnr.Created) handler.creationTime, err = time.Parse(time.RFC3339Nano, ctnr.Created)
if err != nil { if err != nil {
// This should not happen, report the error just in case // This should not happen, report the error just in case
return nil, fmt.Errorf("failed to parse the create timestamp %q for container %q: %v", ctnr.Created, id, err) return nil, fmt.Errorf("failed to parse the create timestamp %q for container %q: %v", ctnr.Created, id, err)
} }
handler.pid = ctnr.State.Pid handler.libcontainerHandler = containerlibcontainer.NewHandler(cgroupManager, rootFs, ctnr.State.Pid, ignoreMetrics)
// Add the name and bare ID as aliases of the container. // Add the name and bare ID as aliases of the container.
handler.aliases = append(handler.aliases, strings.TrimPrefix(ctnr.Name, "/"), id) handler.reference = info.ContainerReference{
handler.labels = ctnr.Config.Labels Id: id,
Name: name,
Aliases: []string{strings.TrimPrefix(ctnr.Name, "/"), id},
Namespace: DockerNamespace,
}
handler.image = ctnr.Config.Image handler.image = ctnr.Config.Image
handler.networkMode = ctnr.HostConfig.NetworkMode handler.networkMode = ctnr.HostConfig.NetworkMode
handler.deviceID = ctnr.GraphDriver.Data["DeviceId"]
handler.restartCount = ctnr.RestartCount handler.restartCount = ctnr.RestartCount
// Obtain the IP address for the contianer. // Obtain the IP address for the contianer.
...@@ -273,7 +249,7 @@ func newDockerContainerHandler( ...@@ -273,7 +249,7 @@ func newDockerContainerHandler(
fsHandler: common.NewFsHandler(common.DefaultPeriod, rootfsStorageDir, otherStorageDir, fsInfo), fsHandler: common.NewFsHandler(common.DefaultPeriod, rootfsStorageDir, otherStorageDir, fsInfo),
thinPoolWatcher: thinPoolWatcher, thinPoolWatcher: thinPoolWatcher,
zfsWatcher: zfsWatcher, zfsWatcher: zfsWatcher,
deviceID: handler.deviceID, deviceID: ctnr.GraphDriver.Data["DeviceId"],
zfsFilesystem: zfsFilesystem, zfsFilesystem: zfsFilesystem,
} }
} }
...@@ -365,13 +341,7 @@ func (self *dockerContainerHandler) Cleanup() { ...@@ -365,13 +341,7 @@ func (self *dockerContainerHandler) Cleanup() {
} }
func (self *dockerContainerHandler) ContainerReference() (info.ContainerReference, error) { func (self *dockerContainerHandler) ContainerReference() (info.ContainerReference, error) {
return info.ContainerReference{ return self.reference, nil
Id: self.id,
Name: self.name,
Aliases: self.aliases,
Namespace: DockerNamespace,
Labels: self.labels,
}, nil
} }
func (self *dockerContainerHandler) needNet() bool { func (self *dockerContainerHandler) needNet() bool {
...@@ -455,7 +425,7 @@ func (self *dockerContainerHandler) getFsStats(stats *info.ContainerStats) error ...@@ -455,7 +425,7 @@ func (self *dockerContainerHandler) getFsStats(stats *info.ContainerStats) error
// TODO(vmarmol): Get from libcontainer API instead of cgroup manager when we don't have to support older Dockers. // TODO(vmarmol): Get from libcontainer API instead of cgroup manager when we don't have to support older Dockers.
func (self *dockerContainerHandler) GetStats() (*info.ContainerStats, error) { func (self *dockerContainerHandler) GetStats() (*info.ContainerStats, error) {
stats, err := containerlibcontainer.GetStats(self.cgroupManager, self.rootFs, self.pid, self.ignoreMetrics) stats, err := self.libcontainerHandler.GetStats()
if err != nil { if err != nil {
return stats, err return stats, err
} }
...@@ -484,7 +454,7 @@ func (self *dockerContainerHandler) ListContainers(listType container.ListType) ...@@ -484,7 +454,7 @@ func (self *dockerContainerHandler) ListContainers(listType container.ListType)
func (self *dockerContainerHandler) GetCgroupPath(resource string) (string, error) { func (self *dockerContainerHandler) GetCgroupPath(resource string) (string, error) {
path, ok := self.cgroupPaths[resource] path, ok := self.cgroupPaths[resource]
if !ok { if !ok {
return "", fmt.Errorf("could not find path for resource %q for container %q\n", resource, self.name) return "", fmt.Errorf("could not find path for resource %q for container %q\n", resource, self.reference.Name)
} }
return path, nil return path, nil
} }
...@@ -498,7 +468,7 @@ func (self *dockerContainerHandler) GetContainerIPAddress() string { ...@@ -498,7 +468,7 @@ func (self *dockerContainerHandler) GetContainerIPAddress() string {
} }
func (self *dockerContainerHandler) ListProcesses(listType container.ListType) ([]int, error) { func (self *dockerContainerHandler) ListProcesses(listType container.ListType) ([]int, error) {
return containerlibcontainer.GetProcesses(self.cgroupManager) return self.libcontainerHandler.GetProcesses()
} }
func (self *dockerContainerHandler) Exists() bool { func (self *dockerContainerHandler) Exists() bool {
......
...@@ -41,16 +41,17 @@ type ContainerHandlerFactory interface { ...@@ -41,16 +41,17 @@ type ContainerHandlerFactory interface {
type MetricKind string type MetricKind string
const ( const (
CpuUsageMetrics MetricKind = "cpu" CpuUsageMetrics MetricKind = "cpu"
PerCpuUsageMetrics MetricKind = "percpu" ProcessSchedulerMetrics MetricKind = "sched"
MemoryUsageMetrics MetricKind = "memory" PerCpuUsageMetrics MetricKind = "percpu"
CpuLoadMetrics MetricKind = "cpuLoad" MemoryUsageMetrics MetricKind = "memory"
DiskIOMetrics MetricKind = "diskIO" CpuLoadMetrics MetricKind = "cpuLoad"
DiskUsageMetrics MetricKind = "disk" DiskIOMetrics MetricKind = "diskIO"
NetworkUsageMetrics MetricKind = "network" DiskUsageMetrics MetricKind = "disk"
NetworkTcpUsageMetrics MetricKind = "tcp" NetworkUsageMetrics MetricKind = "network"
NetworkUdpUsageMetrics MetricKind = "udp" NetworkTcpUsageMetrics MetricKind = "tcp"
AppMetrics MetricKind = "app" NetworkUdpUsageMetrics MetricKind = "udp"
AppMetrics MetricKind = "app"
) )
func (mk MetricKind) String() string { func (mk MetricKind) String() string {
......
...@@ -2,7 +2,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") ...@@ -2,7 +2,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library( go_library(
name = "go_default_library", name = "go_default_library",
srcs = ["helpers.go"], srcs = [
"handler.go",
"helpers.go",
],
cgo = True, cgo = True,
importpath = "github.com/google/cadvisor/container/libcontainer", importpath = "github.com/google/cadvisor/container/libcontainer",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
......
...@@ -17,7 +17,6 @@ go_library( ...@@ -17,7 +17,6 @@ go_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/machine:go_default_library", "//vendor/github.com/google/cadvisor/machine:go_default_library",
"//vendor/github.com/google/cadvisor/manager/watcher: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/cgroups/fs:go_default_library",
"//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library", "//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
], ],
......
...@@ -40,8 +40,8 @@ type rawFactory struct { ...@@ -40,8 +40,8 @@ type rawFactory struct {
// Information about mounted filesystems. // Information about mounted filesystems.
fsInfo fs.FsInfo fsInfo fs.FsInfo
// Watcher for inotify events. // Watcher for fsnotify events.
watcher *common.InotifyWatcher watcher *common.FsnotifyWatcher
// List of metrics to be ignored. // List of metrics to be ignored.
ignoreMetrics map[container.MetricKind]struct{} ignoreMetrics map[container.MetricKind]struct{}
...@@ -78,7 +78,7 @@ func Register(machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, igno ...@@ -78,7 +78,7 @@ func Register(machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, igno
return fmt.Errorf("failed to find supported cgroup mounts for the raw factory") return fmt.Errorf("failed to find supported cgroup mounts for the raw factory")
} }
watcher, err := common.NewInotifyWatcher() watcher, err := common.NewFsnotifyWatcher()
if err != nil { if err != nil {
return err return err
} }
......
...@@ -26,7 +26,6 @@ import ( ...@@ -26,7 +26,6 @@ import (
"github.com/google/cadvisor/machine" "github.com/google/cadvisor/machine"
"github.com/golang/glog" "github.com/golang/glog"
"github.com/opencontainers/runc/libcontainer/cgroups"
cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs" cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs"
"github.com/opencontainers/runc/libcontainer/configs" "github.com/opencontainers/runc/libcontainer/configs"
) )
...@@ -34,32 +33,23 @@ import ( ...@@ -34,32 +33,23 @@ import (
type rawContainerHandler struct { type rawContainerHandler struct {
// Name of the container for this handler. // Name of the container for this handler.
name string name string
cgroupSubsystems *libcontainer.CgroupSubsystems
machineInfoFactory info.MachineInfoFactory machineInfoFactory info.MachineInfoFactory
// Absolute path to the cgroup hierarchies of this container. // Absolute path to the cgroup hierarchies of this container.
// (e.g.: "cpu" -> "/sys/fs/cgroup/cpu/test") // (e.g.: "cpu" -> "/sys/fs/cgroup/cpu/test")
cgroupPaths map[string]string cgroupPaths map[string]string
// Manager of this container's cgroups.
cgroupManager cgroups.Manager
fsInfo fs.FsInfo fsInfo fs.FsInfo
externalMounts []common.Mount externalMounts []common.Mount
rootFs string libcontainerHandler *libcontainer.Handler
// Metrics to be ignored.
ignoreMetrics container.MetricSet
pid int
} }
func isRootCgroup(name string) bool { func isRootCgroup(name string) bool {
return name == "/" return name == "/"
} }
func newRawContainerHandler(name string, cgroupSubsystems *libcontainer.CgroupSubsystems, machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, watcher *common.InotifyWatcher, rootFs string, ignoreMetrics container.MetricSet) (container.ContainerHandler, error) { func newRawContainerHandler(name string, cgroupSubsystems *libcontainer.CgroupSubsystems, machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, watcher *common.FsnotifyWatcher, rootFs string, ignoreMetrics container.MetricSet) (container.ContainerHandler, error) {
cgroupPaths := common.MakeCgroupPaths(cgroupSubsystems.MountPoints, name) cgroupPaths := common.MakeCgroupPaths(cgroupSubsystems.MountPoints, name)
cHints, err := common.GetContainerHintsFromFile(*common.ArgContainerHints) cHints, err := common.GetContainerHintsFromFile(*common.ArgContainerHints)
...@@ -88,17 +78,15 @@ func newRawContainerHandler(name string, cgroupSubsystems *libcontainer.CgroupSu ...@@ -88,17 +78,15 @@ func newRawContainerHandler(name string, cgroupSubsystems *libcontainer.CgroupSu
pid = 1 pid = 1
} }
handler := libcontainer.NewHandler(cgroupManager, rootFs, pid, ignoreMetrics)
return &rawContainerHandler{ return &rawContainerHandler{
name: name, name: name,
cgroupSubsystems: cgroupSubsystems, machineInfoFactory: machineInfoFactory,
machineInfoFactory: machineInfoFactory, cgroupPaths: cgroupPaths,
cgroupPaths: cgroupPaths, fsInfo: fsInfo,
cgroupManager: cgroupManager, externalMounts: externalMounts,
fsInfo: fsInfo, libcontainerHandler: handler,
externalMounts: externalMounts,
rootFs: rootFs,
ignoreMetrics: ignoreMetrics,
pid: pid,
}, nil }, nil
} }
...@@ -231,7 +219,7 @@ func (self *rawContainerHandler) getFsStats(stats *info.ContainerStats) error { ...@@ -231,7 +219,7 @@ func (self *rawContainerHandler) getFsStats(stats *info.ContainerStats) error {
} }
func (self *rawContainerHandler) GetStats() (*info.ContainerStats, error) { func (self *rawContainerHandler) GetStats() (*info.ContainerStats, error) {
stats, err := libcontainer.GetStats(self.cgroupManager, self.rootFs, self.pid, self.ignoreMetrics) stats, err := self.libcontainerHandler.GetStats()
if err != nil { if err != nil {
return stats, err return stats, err
} }
...@@ -267,7 +255,7 @@ func (self *rawContainerHandler) ListContainers(listType container.ListType) ([] ...@@ -267,7 +255,7 @@ func (self *rawContainerHandler) ListContainers(listType container.ListType) ([]
} }
func (self *rawContainerHandler) ListProcesses(listType container.ListType) ([]int, error) { func (self *rawContainerHandler) ListProcesses(listType container.ListType) ([]int, error) {
return libcontainer.GetProcesses(self.cgroupManager) return self.libcontainerHandler.GetProcesses()
} }
func (self *rawContainerHandler) Exists() bool { func (self *rawContainerHandler) Exists() bool {
......
...@@ -20,7 +20,6 @@ go_library( ...@@ -20,7 +20,6 @@ go_library(
"//vendor/github.com/google/cadvisor/fs: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/manager/watcher: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/cgroups/fs:go_default_library",
"//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library", "//vendor/github.com/opencontainers/runc/libcontainer/configs:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library", "//vendor/golang.org/x/net/context:go_default_library",
......
...@@ -28,48 +28,35 @@ import ( ...@@ -28,48 +28,35 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
"github.com/golang/glog" "github.com/golang/glog"
"github.com/opencontainers/runc/libcontainer/cgroups"
cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs" cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs"
"github.com/opencontainers/runc/libcontainer/configs" "github.com/opencontainers/runc/libcontainer/configs"
) )
type rktContainerHandler struct { type rktContainerHandler struct {
rktClient rktapi.PublicAPIClient
// Name of the container for this handler.
name string
cgroupSubsystems *libcontainer.CgroupSubsystems
machineInfoFactory info.MachineInfoFactory machineInfoFactory info.MachineInfoFactory
// Absolute path to the cgroup hierarchies of this container. // Absolute path to the cgroup hierarchies of this container.
// (e.g.: "cpu" -> "/sys/fs/cgroup/cpu/test") // (e.g.: "cpu" -> "/sys/fs/cgroup/cpu/test")
cgroupPaths map[string]string cgroupPaths map[string]string
// Manager of this container's cgroups.
cgroupManager cgroups.Manager
// Whether this container has network isolation enabled.
hasNetwork bool
fsInfo fs.FsInfo fsInfo fs.FsInfo
rootFs string
isPod bool isPod bool
aliases []string
pid int
rootfsStorageDir string rootfsStorageDir string
labels map[string]string
// Filesystem handler. // Filesystem handler.
fsHandler common.FsHandler fsHandler common.FsHandler
ignoreMetrics container.MetricSet ignoreMetrics container.MetricSet
apiPod *rktapi.Pod apiPod *rktapi.Pod
labels map[string]string
reference info.ContainerReference
libcontainerHandler *libcontainer.Handler
} }
func newRktContainerHandler(name string, rktClient rktapi.PublicAPIClient, rktPath string, cgroupSubsystems *libcontainer.CgroupSubsystems, machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, rootFs string, ignoreMetrics container.MetricSet) (container.ContainerHandler, error) { func newRktContainerHandler(name string, rktClient rktapi.PublicAPIClient, rktPath string, cgroupSubsystems *libcontainer.CgroupSubsystems, machineInfoFactory info.MachineInfoFactory, fsInfo fs.FsInfo, rootFs string, ignoreMetrics container.MetricSet) (container.ContainerHandler, error) {
...@@ -122,30 +109,27 @@ func newRktContainerHandler(name string, rktClient rktapi.PublicAPIClient, rktPa ...@@ -122,30 +109,27 @@ func newRktContainerHandler(name string, rktClient rktapi.PublicAPIClient, rktPa
Paths: cgroupPaths, Paths: cgroupPaths,
} }
hasNetwork := false libcontainerHandler := libcontainer.NewHandler(cgroupManager, rootFs, pid, ignoreMetrics)
if isPod {
hasNetwork = true
}
rootfsStorageDir := getRootFs(rktPath, parsed) rootfsStorageDir := getRootFs(rktPath, parsed)
containerReference := info.ContainerReference{
Name: name,
Aliases: aliases,
Namespace: RktNamespace,
}
handler := &rktContainerHandler{ handler := &rktContainerHandler{
name: name, machineInfoFactory: machineInfoFactory,
rktClient: rktClient, cgroupPaths: cgroupPaths,
cgroupSubsystems: cgroupSubsystems, fsInfo: fsInfo,
machineInfoFactory: machineInfoFactory, isPod: isPod,
cgroupPaths: cgroupPaths, rootfsStorageDir: rootfsStorageDir,
cgroupManager: cgroupManager, ignoreMetrics: ignoreMetrics,
fsInfo: fsInfo, apiPod: apiPod,
hasNetwork: hasNetwork, labels: labels,
rootFs: rootFs, reference: containerReference,
isPod: isPod, libcontainerHandler: libcontainerHandler,
aliases: aliases,
pid: pid,
labels: labels,
rootfsStorageDir: rootfsStorageDir,
ignoreMetrics: ignoreMetrics,
apiPod: apiPod,
} }
if !ignoreMetrics.Has(container.DiskUsageMetrics) { if !ignoreMetrics.Has(container.DiskUsageMetrics) {
...@@ -174,12 +158,7 @@ func createLabels(annotations []*rktapi.KeyValue) map[string]string { ...@@ -174,12 +158,7 @@ func createLabels(annotations []*rktapi.KeyValue) map[string]string {
} }
func (handler *rktContainerHandler) ContainerReference() (info.ContainerReference, error) { func (handler *rktContainerHandler) ContainerReference() (info.ContainerReference, error) {
return info.ContainerReference{ return handler.reference, nil
Name: handler.name,
Aliases: handler.aliases,
Namespace: RktNamespace,
Labels: handler.labels,
}, nil
} }
func (handler *rktContainerHandler) Start() { func (handler *rktContainerHandler) Start() {
...@@ -191,7 +170,7 @@ func (handler *rktContainerHandler) Cleanup() { ...@@ -191,7 +170,7 @@ func (handler *rktContainerHandler) Cleanup() {
} }
func (handler *rktContainerHandler) GetSpec() (info.ContainerSpec, error) { func (handler *rktContainerHandler) GetSpec() (info.ContainerSpec, error) {
hasNetwork := handler.hasNetwork && !handler.ignoreMetrics.Has(container.NetworkUsageMetrics) hasNetwork := handler.isPod && !handler.ignoreMetrics.Has(container.NetworkUsageMetrics)
hasFilesystem := !handler.ignoreMetrics.Has(container.DiskUsageMetrics) hasFilesystem := !handler.ignoreMetrics.Has(container.DiskUsageMetrics)
spec, err := common.GetSpec(handler.cgroupPaths, handler.machineInfoFactory, hasNetwork, hasFilesystem) spec, err := common.GetSpec(handler.cgroupPaths, handler.machineInfoFactory, hasNetwork, hasFilesystem)
...@@ -243,7 +222,7 @@ func (handler *rktContainerHandler) getFsStats(stats *info.ContainerStats) error ...@@ -243,7 +222,7 @@ func (handler *rktContainerHandler) getFsStats(stats *info.ContainerStats) error
} }
func (handler *rktContainerHandler) GetStats() (*info.ContainerStats, error) { func (handler *rktContainerHandler) GetStats() (*info.ContainerStats, error) {
stats, err := libcontainer.GetStats(handler.cgroupManager, handler.rootFs, handler.pid, handler.ignoreMetrics) stats, err := handler.libcontainerHandler.GetStats()
if err != nil { if err != nil {
return stats, err return stats, err
} }
...@@ -275,7 +254,7 @@ func (self *rktContainerHandler) GetContainerIPAddress() string { ...@@ -275,7 +254,7 @@ func (self *rktContainerHandler) GetContainerIPAddress() string {
func (handler *rktContainerHandler) GetCgroupPath(resource string) (string, error) { func (handler *rktContainerHandler) GetCgroupPath(resource string) (string, error) {
path, ok := handler.cgroupPaths[resource] path, ok := handler.cgroupPaths[resource]
if !ok { if !ok {
return "", fmt.Errorf("could not find path for resource %q for container %q\n", resource, handler.name) return "", fmt.Errorf("could not find path for resource %q for container %q\n", resource, handler.reference.Name)
} }
return path, nil return path, nil
} }
...@@ -285,11 +264,11 @@ func (handler *rktContainerHandler) GetContainerLabels() map[string]string { ...@@ -285,11 +264,11 @@ func (handler *rktContainerHandler) GetContainerLabels() map[string]string {
} }
func (handler *rktContainerHandler) ListContainers(listType container.ListType) ([]info.ContainerReference, error) { func (handler *rktContainerHandler) ListContainers(listType container.ListType) ([]info.ContainerReference, error) {
return common.ListContainers(handler.name, handler.cgroupPaths, listType) return common.ListContainers(handler.reference.Name, handler.cgroupPaths, listType)
} }
func (handler *rktContainerHandler) ListProcesses(listType container.ListType) ([]int, error) { func (handler *rktContainerHandler) ListProcesses(listType container.ListType) ([]int, error) {
return libcontainer.GetProcesses(handler.cgroupManager) return handler.libcontainerHandler.GetProcesses()
} }
func (handler *rktContainerHandler) Exists() bool { func (handler *rktContainerHandler) Exists() bool {
......
...@@ -554,7 +554,7 @@ func GetDirDiskUsage(dir string, timeout time.Duration) (uint64, error) { ...@@ -554,7 +554,7 @@ func GetDirDiskUsage(dir string, timeout time.Duration) (uint64, error) {
if dir == "" { if dir == "" {
return 0, fmt.Errorf("invalid directory") return 0, fmt.Errorf("invalid directory")
} }
cmd := exec.Command("nice", "-n", "19", "du", "-s", dir) cmd := exec.Command("ionice", "-c3", "nice", "-n", "19", "du", "-s", dir)
stdoutp, err := cmd.StdoutPipe() stdoutp, err := cmd.StdoutPipe()
if err != nil { if err != nil {
return 0, fmt.Errorf("failed to setup stdout for cmd %v - %v", cmd.Args, err) return 0, fmt.Errorf("failed to setup stdout for cmd %v - %v", cmd.Args, err)
...@@ -601,7 +601,7 @@ func GetDirInodeUsage(dir string, timeout time.Duration) (uint64, error) { ...@@ -601,7 +601,7 @@ func GetDirInodeUsage(dir string, timeout time.Duration) (uint64, error) {
} }
var counter byteCounter var counter byteCounter
var stderr bytes.Buffer var stderr bytes.Buffer
findCmd := exec.Command("find", dir, "-xdev", "-printf", ".") findCmd := exec.Command("ionice", "-c3", "nice", "-n", "19", "find", dir, "-xdev", "-printf", ".")
findCmd.Stdout, findCmd.Stderr = &counter, &stderr findCmd.Stdout, findCmd.Stderr = &counter, &stderr
if err := findCmd.Start(); err != nil { if err := findCmd.Start(); err != nil {
return 0, fmt.Errorf("failed to exec cmd %v - %v; stderr: %v", findCmd.Args, err, stderr.String()) return 0, fmt.Errorf("failed to exec cmd %v - %v; stderr: %v", findCmd.Args, err, stderr.String())
......
...@@ -85,8 +85,6 @@ type ContainerReference struct { ...@@ -85,8 +85,6 @@ type ContainerReference struct {
// Namespace under which the aliases of a container are unique. // Namespace under which the aliases of a container are unique.
// An example of a namespace is "docker" for Docker containers. // An example of a namespace is "docker" for Docker containers.
Namespace string `json:"namespace,omitempty"` Namespace string `json:"namespace,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
} }
// Sorts by container name. // Sorts by container name.
...@@ -295,10 +293,23 @@ type CpuCFS struct { ...@@ -295,10 +293,23 @@ type CpuCFS struct {
ThrottledTime uint64 `json:"throttled_time"` ThrottledTime uint64 `json:"throttled_time"`
} }
// Cpu Aggregated scheduler statistics
type CpuSchedstat struct {
// https://www.kernel.org/doc/Documentation/scheduler/sched-stats.txt
// time spent on the cpu
RunTime uint64 `json:"run_time"`
// time spent waiting on a runqueue
RunqueueTime uint64 `json:"runqueue_time"`
// # of timeslices run on this cpu
RunPeriods uint64 `json:"run_periods"`
}
// All CPU usage metrics are cumulative from the creation of the container // All CPU usage metrics are cumulative from the creation of the container
type CpuStats struct { type CpuStats struct {
Usage CpuUsage `json:"usage"` Usage CpuUsage `json:"usage"`
CFS CpuCFS `json:"cfs"` CFS CpuCFS `json:"cfs"`
Schedstat CpuSchedstat `json:"schedstat"`
// Smoothed average of number of runnable threads x 1000. // Smoothed average of number of runnable threads x 1000.
// We multiply by thousand to avoid using floats, but preserving precision. // We multiply by thousand to avoid using floats, but preserving precision.
// Load is smoothed over the last 10 seconds. Instantaneous value can be read // Load is smoothed over the last 10 seconds. Instantaneous value can be read
......
...@@ -9,6 +9,7 @@ go_library( ...@@ -9,6 +9,7 @@ go_library(
importpath = "github.com/google/cadvisor/machine", importpath = "github.com/google/cadvisor/machine",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/docker/docker/pkg/parsers/operatingsystem:go_default_library",
"//vendor/github.com/golang/glog:go_default_library", "//vendor/github.com/golang/glog:go_default_library",
"//vendor/github.com/google/cadvisor/fs: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",
......
...@@ -23,6 +23,7 @@ import ( ...@@ -23,6 +23,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/docker/docker/pkg/parsers/operatingsystem"
"github.com/google/cadvisor/fs" "github.com/google/cadvisor/fs"
info "github.com/google/cadvisor/info/v1" info "github.com/google/cadvisor/info/v1"
"github.com/google/cadvisor/utils/cloudinfo" "github.com/google/cadvisor/utils/cloudinfo"
...@@ -173,20 +174,11 @@ func Info(sysFs sysfs.SysFs, fsInfo fs.FsInfo, inHostNamespace bool) (*info.Mach ...@@ -173,20 +174,11 @@ func Info(sysFs sysfs.SysFs, fsInfo fs.FsInfo, inHostNamespace bool) (*info.Mach
} }
func ContainerOsVersion() string { func ContainerOsVersion() string {
container_os := "Unknown" os, err := operatingsystem.GetOperatingSystem()
os_release, err := ioutil.ReadFile("/etc/os-release") if err != nil {
if err == nil { os = "Unknown"
// We might be running in a busybox or some hand-crafted image.
// It's useful to know why cadvisor didn't come up.
for _, line := range strings.Split(string(os_release), "\n") {
parsed := strings.Split(line, "\"")
if len(parsed) == 3 && parsed[0] == "PRETTY_NAME=" {
container_os = parsed[1]
break
}
}
} }
return container_os return os
} }
func KernelVersion() string { func KernelVersion() string {
......
...@@ -615,7 +615,12 @@ func (c *containerData) updateStats() error { ...@@ -615,7 +615,12 @@ func (c *containerData) updateStats() error {
} }
return err return err
} }
err = c.memoryCache.AddStats(ref, stats)
cInfo := info.ContainerInfo{
ContainerReference: ref,
}
err = c.memoryCache.AddStats(&cInfo, stats)
if err != nil { if err != nil {
return err return err
} }
......
...@@ -242,7 +242,7 @@ func retryDockerStatus() info.DockerStatus { ...@@ -242,7 +242,7 @@ func retryDockerStatus() info.DockerStatus {
for { for {
ctx, _ := context.WithTimeout(context.Background(), startupTimeout) ctx, _ := context.WithTimeout(context.Background(), startupTimeout)
dockerStatus, err := docker.StatusWithContext(ctx) dockerStatus, err := docker.StatusWithContext(ctx)
if err != nil { if err == nil {
return dockerStatus return dockerStatus
} }
......
...@@ -6,11 +6,11 @@ go_library( ...@@ -6,11 +6,11 @@ go_library(
importpath = "github.com/google/cadvisor/manager/watcher/raw", importpath = "github.com/google/cadvisor/manager/watcher/raw",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/fsnotify/fsnotify:go_default_library",
"//vendor/github.com/golang/glog:go_default_library", "//vendor/github.com/golang/glog:go_default_library",
"//vendor/github.com/google/cadvisor/container/common: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/container/libcontainer:go_default_library",
"//vendor/github.com/google/cadvisor/manager/watcher:go_default_library", "//vendor/github.com/google/cadvisor/manager/watcher:go_default_library",
"//vendor/golang.org/x/exp/inotify:go_default_library",
], ],
) )
......
...@@ -27,8 +27,8 @@ import ( ...@@ -27,8 +27,8 @@ import (
"github.com/google/cadvisor/container/libcontainer" "github.com/google/cadvisor/container/libcontainer"
"github.com/google/cadvisor/manager/watcher" "github.com/google/cadvisor/manager/watcher"
"github.com/fsnotify/fsnotify"
"github.com/golang/glog" "github.com/golang/glog"
"golang.org/x/exp/inotify"
) )
type rawContainerWatcher struct { type rawContainerWatcher struct {
...@@ -37,8 +37,8 @@ type rawContainerWatcher struct { ...@@ -37,8 +37,8 @@ type rawContainerWatcher struct {
cgroupSubsystems *libcontainer.CgroupSubsystems cgroupSubsystems *libcontainer.CgroupSubsystems
// Inotify event watcher. // Fsnotify event watcher.
watcher *common.InotifyWatcher watcher *common.FsnotifyWatcher
// Signal for watcher thread to stop. // Signal for watcher thread to stop.
stopWatcher chan error stopWatcher chan error
...@@ -53,7 +53,7 @@ func NewRawContainerWatcher() (watcher.ContainerWatcher, error) { ...@@ -53,7 +53,7 @@ func NewRawContainerWatcher() (watcher.ContainerWatcher, error) {
return nil, fmt.Errorf("failed to find supported cgroup mounts for the raw factory") return nil, fmt.Errorf("failed to find supported cgroup mounts for the raw factory")
} }
watcher, err := common.NewInotifyWatcher() watcher, err := common.NewFsnotifyWatcher()
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -71,7 +71,7 @@ func NewRawContainerWatcher() (watcher.ContainerWatcher, error) { ...@@ -71,7 +71,7 @@ func NewRawContainerWatcher() (watcher.ContainerWatcher, error) {
func (self *rawContainerWatcher) Start(events chan watcher.ContainerEvent) error { func (self *rawContainerWatcher) Start(events chan watcher.ContainerEvent) error {
// Watch this container (all its cgroups) and all subdirectories. // Watch this container (all its cgroups) and all subdirectories.
for _, cgroupPath := range self.cgroupPaths { for _, cgroupPath := range self.cgroupPaths {
_, err := self.watchDirectory(cgroupPath, "/") _, err := self.watchDirectory(events, cgroupPath, "/")
if err != nil { if err != nil {
return err return err
} }
...@@ -109,7 +109,7 @@ func (self *rawContainerWatcher) Stop() error { ...@@ -109,7 +109,7 @@ func (self *rawContainerWatcher) Stop() error {
// Watches the specified directory and all subdirectories. Returns whether the path was // Watches the specified directory and all subdirectories. Returns whether the path was
// already being watched and an error (if any). // already being watched and an error (if any).
func (self *rawContainerWatcher) watchDirectory(dir string, containerName string) (bool, error) { func (self *rawContainerWatcher) watchDirectory(events chan watcher.ContainerEvent, dir string, containerName string) (bool, error) {
alreadyWatching, err := self.watcher.AddWatch(containerName, dir) alreadyWatching, err := self.watcher.AddWatch(containerName, dir)
if err != nil { if err != nil {
return alreadyWatching, err return alreadyWatching, err
...@@ -121,7 +121,7 @@ func (self *rawContainerWatcher) watchDirectory(dir string, containerName string ...@@ -121,7 +121,7 @@ func (self *rawContainerWatcher) watchDirectory(dir string, containerName string
if cleanup { if cleanup {
_, err := self.watcher.RemoveWatch(containerName, dir) _, err := self.watcher.RemoveWatch(containerName, dir)
if err != nil { if err != nil {
glog.Warningf("Failed to remove inotify watch for %q: %v", dir, err) glog.Warningf("Failed to remove fsnotify watch for %q: %v", dir, err)
} }
} }
}() }()
...@@ -135,7 +135,8 @@ func (self *rawContainerWatcher) watchDirectory(dir string, containerName string ...@@ -135,7 +135,8 @@ func (self *rawContainerWatcher) watchDirectory(dir string, containerName string
for _, entry := range entries { for _, entry := range entries {
if entry.IsDir() { if entry.IsDir() {
entryPath := path.Join(dir, entry.Name()) entryPath := path.Join(dir, entry.Name())
_, err = self.watchDirectory(entryPath, path.Join(containerName, entry.Name())) subcontainerName := path.Join(containerName, entry.Name())
alreadyWatchingSubDir, err := self.watchDirectory(events, entryPath, subcontainerName)
if err != nil { if err != nil {
glog.Errorf("Failed to watch directory %q: %v", entryPath, err) glog.Errorf("Failed to watch directory %q: %v", entryPath, err)
if os.IsNotExist(err) { if os.IsNotExist(err) {
...@@ -145,6 +146,16 @@ func (self *rawContainerWatcher) watchDirectory(dir string, containerName string ...@@ -145,6 +146,16 @@ func (self *rawContainerWatcher) watchDirectory(dir string, containerName string
} }
return alreadyWatching, err return alreadyWatching, err
} }
// since we already missed the creation event for this directory, publish an event here.
if !alreadyWatchingSubDir {
go func() {
events <- watcher.ContainerEvent{
EventType: watcher.ContainerAdd,
Name: subcontainerName,
WatchSource: watcher.Raw,
}
}()
}
} }
} }
...@@ -152,18 +163,16 @@ func (self *rawContainerWatcher) watchDirectory(dir string, containerName string ...@@ -152,18 +163,16 @@ func (self *rawContainerWatcher) watchDirectory(dir string, containerName string
return alreadyWatching, nil return alreadyWatching, nil
} }
func (self *rawContainerWatcher) processEvent(event *inotify.Event, events chan watcher.ContainerEvent) error { func (self *rawContainerWatcher) processEvent(event fsnotify.Event, events chan watcher.ContainerEvent) error {
// Convert the inotify event type to a container create or delete. // Convert the fsnotify event type to a container create or delete.
var eventType watcher.ContainerEventType var eventType watcher.ContainerEventType
switch { switch {
case (event.Mask & inotify.IN_CREATE) > 0: case event.Op == fsnotify.Create:
eventType = watcher.ContainerAdd eventType = watcher.ContainerAdd
case (event.Mask & inotify.IN_DELETE) > 0: case event.Op == fsnotify.Remove:
eventType = watcher.ContainerDelete eventType = watcher.ContainerDelete
case (event.Mask & inotify.IN_MOVED_FROM) > 0: case event.Op == fsnotify.Rename:
eventType = watcher.ContainerDelete eventType = watcher.ContainerDelete
case (event.Mask & inotify.IN_MOVED_TO) > 0:
eventType = watcher.ContainerAdd
default: default:
// Ignore other events. // Ignore other events.
return nil return nil
...@@ -186,7 +195,7 @@ func (self *rawContainerWatcher) processEvent(event *inotify.Event, events chan ...@@ -186,7 +195,7 @@ func (self *rawContainerWatcher) processEvent(event *inotify.Event, events chan
switch eventType { switch eventType {
case watcher.ContainerAdd: case watcher.ContainerAdd:
// New container was created, watch it. // New container was created, watch it.
alreadyWatched, err := self.watchDirectory(event.Name, containerName) alreadyWatched, err := self.watchDirectory(events, event.Name, containerName)
if err != nil { if err != nil {
return err return err
} }
......
...@@ -198,6 +198,27 @@ func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc) *PrometheusCo ...@@ -198,6 +198,27 @@ func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc) *PrometheusCo
return metricValues{{value: float64(s.Cpu.CFS.ThrottledTime) / float64(time.Second)}} return metricValues{{value: float64(s.Cpu.CFS.ThrottledTime) / float64(time.Second)}}
}, },
}, { }, {
name: "container_cpu_schedstat_run_seconds_total",
help: "Time duration the processes of the container have run on the CPU.",
valueType: prometheus.CounterValue,
getValues: func(s *info.ContainerStats) metricValues {
return metricValues{{value: float64(s.Cpu.Schedstat.RunTime) / float64(time.Second)}}
},
}, {
name: "container_cpu_schedstat_runqueue_seconds_total",
help: "Time duration processes of the container have been waiting on a runqueue.",
valueType: prometheus.CounterValue,
getValues: func(s *info.ContainerStats) metricValues {
return metricValues{{value: float64(s.Cpu.Schedstat.RunqueueTime) / float64(time.Second)}}
},
}, {
name: "container_cpu_schedstat_run_periods_total",
help: "Number of times processes of the cgroup have run on the cpu",
valueType: prometheus.CounterValue,
getValues: func(s *info.ContainerStats) metricValues {
return metricValues{{value: float64(s.Cpu.Schedstat.RunPeriods)}}
},
}, {
name: "container_cpu_load_average_10s", name: "container_cpu_load_average_10s",
help: "Value of container cpu load average over the last 10 seconds.", help: "Value of container cpu load average over the last 10 seconds.",
valueType: prometheus.GaugeValue, valueType: prometheus.GaugeValue,
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ import (
) )
type StorageDriver interface { type StorageDriver interface {
AddStats(ref info.ContainerReference, stats *info.ContainerStats) error AddStats(cInfo *info.ContainerInfo, stats *info.ContainerStats) error
// Close will clear the state of the storage driver. The elements // Close will clear the state of the storage driver. The elements
// stored in the underlying storage may or may not be deleted depending // stored in the underlying storage may or may not be deleted depending
......
...@@ -22,6 +22,7 @@ import ( ...@@ -22,6 +22,7 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
"net/http" "net/http"
"os"
"path" "path"
"strings" "strings"
...@@ -133,6 +134,23 @@ func areCgroupsPresent(available map[string]int, desired []string) (bool, string ...@@ -133,6 +134,23 @@ func areCgroupsPresent(available map[string]int, desired []string) (bool, string
return true, "" return true, ""
} }
func validateCpuCfsBandwidth(available_cgroups map[string]int) string {
ok, _ := areCgroupsPresent(available_cgroups, []string{"cpu"})
if !ok {
return "\tCpu cfs bandwidth status unknown: cpu cgroup not enabled.\n"
}
mnt, err := cgroups.FindCgroupMountpoint("cpu")
if err != nil {
return "\tCpu cfs bandwidth status unknown: cpu cgroup not mounted.\n"
}
_, err = os.Stat(path.Join(mnt, "cpu.cfs_period_us"))
if os.IsNotExist(err) {
return "\tCpu cfs bandwidth is disabled. Recompile kernel with \"CONFIG_CFS_BANDWIDTH\" enabled.\n"
}
return "\tCpu cfs bandwidth is enabled.\n"
}
func validateMemoryAccounting(available_cgroups map[string]int) string { func validateMemoryAccounting(available_cgroups map[string]int) string {
ok, _ := areCgroupsPresent(available_cgroups, []string{"memory"}) ok, _ := areCgroupsPresent(available_cgroups, []string{"memory"})
if !ok { if !ok {
...@@ -181,6 +199,7 @@ func validateCgroups() (string, string) { ...@@ -181,6 +199,7 @@ func validateCgroups() (string, string) {
out = fmt.Sprintf("Available cgroups: %v\n", available_cgroups) out = fmt.Sprintf("Available cgroups: %v\n", available_cgroups)
out += desc out += desc
out += validateMemoryAccounting(available_cgroups) out += validateMemoryAccounting(available_cgroups)
out += validateCpuCfsBandwidth(available_cgroups)
return Recommended, out return Recommended, out
} }
......
language: go
go:
- tip
before_install:
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
script:
- $HOME/gopath/bin/goveralls -repotoken 2FMhp57u8LcstKL9B190fLTcEnBtAAiEL
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"shellwords.go",
"util_go15.go",
] + select({
"@io_bazel_rules_go//go/platform:android": [
"util_posix.go",
],
"@io_bazel_rules_go//go/platform:darwin": [
"util_posix.go",
],
"@io_bazel_rules_go//go/platform:dragonfly": [
"util_posix.go",
],
"@io_bazel_rules_go//go/platform:freebsd": [
"util_posix.go",
],
"@io_bazel_rules_go//go/platform:linux": [
"util_posix.go",
],
"@io_bazel_rules_go//go/platform:nacl": [
"util_posix.go",
],
"@io_bazel_rules_go//go/platform:netbsd": [
"util_posix.go",
],
"@io_bazel_rules_go//go/platform:openbsd": [
"util_posix.go",
],
"@io_bazel_rules_go//go/platform:plan9": [
"util_posix.go",
],
"@io_bazel_rules_go//go/platform:solaris": [
"util_posix.go",
],
"@io_bazel_rules_go//go/platform:windows": [
"util_windows.go",
],
"//conditions:default": [],
}),
importpath = "github.com/mattn/go-shellwords",
visibility = ["//visibility:public"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
The MIT License (MIT)
Copyright (c) 2017 Yasuhiro Matsumoto
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# go-shellwords
[![Coverage Status](https://coveralls.io/repos/mattn/go-shellwords/badge.png?branch=master)](https://coveralls.io/r/mattn/go-shellwords?branch=master)
[![Build Status](https://travis-ci.org/mattn/go-shellwords.svg?branch=master)](https://travis-ci.org/mattn/go-shellwords)
Parse line as shell words.
## Usage
```go
args, err := shellwords.Parse("./foo --bar=baz")
// args should be ["./foo", "--bar=baz"]
```
```go
os.Setenv("FOO", "bar")
p := shellwords.NewParser()
p.ParseEnv = true
args, err := p.Parse("./foo $FOO")
// args should be ["./foo", "bar"]
```
```go
p := shellwords.NewParser()
p.ParseBacktick = true
args, err := p.Parse("./foo `echo $SHELL`")
// args should be ["./foo", "/bin/bash"]
```
```go
shellwords.ParseBacktick = true
p := shellwords.NewParser()
args, err := p.Parse("./foo `echo $SHELL`")
// args should be ["./foo", "/bin/bash"]
```
# Thanks
This is based on cpan module [Parse::CommandLine](https://metacpan.org/pod/Parse::CommandLine).
# License
under the MIT License: http://mattn.mit-license.org/2017
# Author
Yasuhiro Matsumoto (a.k.a mattn)
package shellwords
import (
"errors"
"os"
"regexp"
)
var (
ParseEnv bool = false
ParseBacktick bool = false
)
var envRe = regexp.MustCompile(`\$({[a-zA-Z0-9_]+}|[a-zA-Z0-9_]+)`)
func isSpace(r rune) bool {
switch r {
case ' ', '\t', '\r', '\n':
return true
}
return false
}
func replaceEnv(s string) string {
return envRe.ReplaceAllStringFunc(s, func(s string) string {
s = s[1:]
if s[0] == '{' {
s = s[1 : len(s)-1]
}
return os.Getenv(s)
})
}
type Parser struct {
ParseEnv bool
ParseBacktick bool
Position int
}
func NewParser() *Parser {
return &Parser{ParseEnv, ParseBacktick, 0}
}
func (p *Parser) Parse(line string) ([]string, error) {
args := []string{}
buf := ""
var escaped, doubleQuoted, singleQuoted, backQuote, dollarQuote bool
backtick := ""
pos := -1
got := false
loop:
for i, r := range line {
if escaped {
buf += string(r)
escaped = false
continue
}
if r == '\\' {
if singleQuoted {
buf += string(r)
} else {
escaped = true
}
continue
}
if isSpace(r) {
if singleQuoted || doubleQuoted || backQuote || dollarQuote {
buf += string(r)
backtick += string(r)
} else if got {
if p.ParseEnv {
buf = replaceEnv(buf)
}
args = append(args, buf)
buf = ""
got = false
}
continue
}
switch r {
case '`':
if !singleQuoted && !doubleQuoted && !dollarQuote {
if p.ParseBacktick {
if backQuote {
out, err := shellRun(backtick)
if err != nil {
return nil, err
}
buf = out
}
backtick = ""
backQuote = !backQuote
continue
}
backtick = ""
backQuote = !backQuote
}
case ')':
if !singleQuoted && !doubleQuoted && !backQuote {
if p.ParseBacktick {
if dollarQuote {
out, err := shellRun(backtick)
if err != nil {
return nil, err
}
buf = out
}
backtick = ""
dollarQuote = !dollarQuote
continue
}
backtick = ""
dollarQuote = !dollarQuote
}
case '(':
if !singleQuoted && !doubleQuoted && !backQuote {
if !dollarQuote && len(buf) > 0 && buf == "$" {
dollarQuote = true
buf += "("
continue
} else {
return nil, errors.New("invalid command line string")
}
}
case '"':
if !singleQuoted && !dollarQuote {
doubleQuoted = !doubleQuoted
continue
}
case '\'':
if !doubleQuoted && !dollarQuote {
singleQuoted = !singleQuoted
continue
}
case ';', '&', '|', '<', '>':
if !(escaped || singleQuoted || doubleQuoted || backQuote) {
if r == '>' && len(buf) > 0 {
if c := buf[0]; '0' <= c && c <= '9' {
i -= 1
got = false
}
}
pos = i
break loop
}
}
got = true
buf += string(r)
if backQuote || dollarQuote {
backtick += string(r)
}
}
if got {
if p.ParseEnv {
buf = replaceEnv(buf)
}
args = append(args, buf)
}
if escaped || singleQuoted || doubleQuoted || backQuote || dollarQuote {
return nil, errors.New("invalid command line string")
}
p.Position = pos
return args, nil
}
func Parse(line string) ([]string, error) {
return NewParser().Parse(line)
}
// +build !go1.6
package shellwords
import (
"os"
"os/exec"
"runtime"
"strings"
)
func shellRun(line string) (string, error) {
var b []byte
var err error
if runtime.GOOS == "windows" {
b, err = exec.Command(os.Getenv("COMSPEC"), "/c", line).Output()
} else {
b, err = exec.Command(os.Getenv("SHELL"), "-c", line).Output()
}
if err != nil {
return "", err
}
return strings.TrimSpace(string(b)), nil
}
// +build !windows,go1.6
package shellwords
import (
"errors"
"os"
"os/exec"
"strings"
)
func shellRun(line string) (string, error) {
shell := os.Getenv("SHELL")
b, err := exec.Command(shell, "-c", line).Output()
if err != nil {
if eerr, ok := err.(*exec.ExitError); ok {
b = eerr.Stderr
}
return "", errors.New(err.Error() + ":" + string(b))
}
return strings.TrimSpace(string(b)), nil
}
// +build windows,go1.6
package shellwords
import (
"errors"
"os"
"os/exec"
"strings"
)
func shellRun(line string) (string, error) {
shell := os.Getenv("COMSPEC")
b, err := exec.Command(shell, "/c", line).Output()
if err != nil {
if eerr, ok := err.(*exec.ExitError); ok {
b = eerr.Stderr
}
return "", errors.New(err.Error() + ":" + string(b))
}
return strings.TrimSpace(string(b)), nil
}
...@@ -63,7 +63,7 @@ filegroup( ...@@ -63,7 +63,7 @@ filegroup(
"//vendor/google.golang.org/grpc/codes:all-srcs", "//vendor/google.golang.org/grpc/codes:all-srcs",
"//vendor/google.golang.org/grpc/connectivity:all-srcs", "//vendor/google.golang.org/grpc/connectivity:all-srcs",
"//vendor/google.golang.org/grpc/credentials:all-srcs", "//vendor/google.golang.org/grpc/credentials:all-srcs",
"//vendor/google.golang.org/grpc/grpclb/grpc_lb_v1:all-srcs", "//vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages:all-srcs",
"//vendor/google.golang.org/grpc/grpclog:all-srcs", "//vendor/google.golang.org/grpc/grpclog:all-srcs",
"//vendor/google.golang.org/grpc/health/grpc_health_v1:all-srcs", "//vendor/google.golang.org/grpc/health/grpc_health_v1:all-srcs",
"//vendor/google.golang.org/grpc/internal:all-srcs", "//vendor/google.golang.org/grpc/internal:all-srcs",
......
/*
*
* Copyright 2017 gRPC 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 grpc_lb_v1 is the parent package of all gRPC loadbalancer
// message and service protobuf definitions.
package grpc_lb_v1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment