Update containerd to ed16170c4c
1.3.0+2 Includes changes for cgroup metrics type alias Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
470776c903
commit
437123646a
@ -44,7 +44,7 @@ github.com/containerd/ttrpc 92c8520ef9f86600c650dd540266a007bf03670f
|
||||
github.com/containerd/go-runc 9007c2405372fe28918845901a3276c0915689a1
|
||||
github.com/containerd/fifo bda0ff6ed73c67bfb5e62bc9c697f146b7fd7f13
|
||||
github.com/containerd/continuity f2a389ac0a02ce21c09edd7344677a601970f41c
|
||||
github.com/containerd/containerd 59a625defb21c958c25424fa5cc806167e22382e
|
||||
github.com/containerd/containerd ed16170c4c399c57f25d6aa1e97b345ed6ab96cb
|
||||
github.com/containerd/console 0650fd9eeb50bab4fc99dceb9f2e14cf58f36e7f
|
||||
github.com/containerd/cgroups c4b9ac5c7601384c965b9646fc515884e091ebb9
|
||||
github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9
|
||||
|
13
vendor/github.com/containerd/cgroups/go.mod
generated
vendored
Normal file
13
vendor/github.com/containerd/cgroups/go.mod
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
module github.com/containerd/cgroups
|
||||
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e
|
||||
github.com/docker/go-units v0.4.0
|
||||
github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e
|
||||
github.com/gogo/protobuf v1.2.1
|
||||
github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700
|
||||
github.com/pkg/errors v0.8.1
|
||||
golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f
|
||||
)
|
11
vendor/github.com/containerd/containerd/cmd/containerd/command/main.go
generated
vendored
11
vendor/github.com/containerd/containerd/cmd/containerd/command/main.go
generated
vendored
@ -70,6 +70,17 @@ func App() *cli.App {
|
||||
app.Name = "containerd"
|
||||
app.Version = version.Version
|
||||
app.Usage = usage
|
||||
app.Description = `
|
||||
containerd is a high performance container runtime whose daemon can be started
|
||||
by using this command. If none of the *config*, *publish*, or *help* commands
|
||||
are specified, the default action of the **containerd** command is to start the
|
||||
containerd daemon in the foreground.
|
||||
|
||||
|
||||
A default configuration is used if no TOML configuration is specified or located
|
||||
at the default file location. The *containerd config* command can be used to
|
||||
generate the default configuration for containerd. The output of that command
|
||||
can be used and modified as necessary as a custom configuration.`
|
||||
app.Flags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "config,c",
|
||||
|
4
vendor/github.com/containerd/containerd/diff/stream.go
generated
vendored
4
vendor/github.com/containerd/containerd/diff/stream.go
generated
vendored
@ -88,11 +88,11 @@ type StreamProcessor interface {
|
||||
}
|
||||
|
||||
func compressedHandler(ctx context.Context, mediaType string) (StreamProcessorInit, bool) {
|
||||
compressed, err := images.IsCompressedDiff(ctx, mediaType)
|
||||
compressed, err := images.DiffCompression(ctx, mediaType)
|
||||
if err != nil {
|
||||
return nil, false
|
||||
}
|
||||
if compressed {
|
||||
if compressed != "" {
|
||||
return func(ctx context.Context, stream StreamProcessor, payloads map[string]*types.Any) (StreamProcessor, error) {
|
||||
ds, err := compression.DecompressStream(stream)
|
||||
if err != nil {
|
||||
|
81
vendor/github.com/containerd/containerd/images/image.go
generated
vendored
81
vendor/github.com/containerd/containerd/images/image.go
generated
vendored
@ -20,7 +20,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
@ -358,16 +357,11 @@ func Children(ctx context.Context, provider content.Provider, desc ocispec.Descr
|
||||
}
|
||||
|
||||
descs = append(descs, index.Manifests...)
|
||||
case MediaTypeDockerSchema2Layer, MediaTypeDockerSchema2LayerGzip,
|
||||
MediaTypeDockerSchema2LayerEnc, MediaTypeDockerSchema2LayerGzipEnc,
|
||||
MediaTypeDockerSchema2LayerForeign, MediaTypeDockerSchema2LayerForeignGzip,
|
||||
MediaTypeDockerSchema2Config, ocispec.MediaTypeImageConfig,
|
||||
ocispec.MediaTypeImageLayer, ocispec.MediaTypeImageLayerGzip,
|
||||
ocispec.MediaTypeImageLayerNonDistributable, ocispec.MediaTypeImageLayerNonDistributableGzip,
|
||||
MediaTypeContainerd1Checkpoint, MediaTypeContainerd1CheckpointConfig:
|
||||
default:
|
||||
if IsLayerType(desc.MediaType) || IsKnownConfig(desc.MediaType) {
|
||||
// childless data types.
|
||||
return nil, nil
|
||||
default:
|
||||
}
|
||||
log.G(ctx).Warnf("encountered unknown type %v; children may not be fetched", desc.MediaType)
|
||||
}
|
||||
|
||||
@ -390,72 +384,3 @@ func RootFS(ctx context.Context, provider content.Provider, configDesc ocispec.D
|
||||
}
|
||||
return config.RootFS.DiffIDs, nil
|
||||
}
|
||||
|
||||
// IsCompressedDiff returns true if mediaType is a known compressed diff media type.
|
||||
// It returns false if the media type is a diff, but not compressed. If the media type
|
||||
// is not a known diff type, it returns errdefs.ErrNotImplemented
|
||||
func IsCompressedDiff(ctx context.Context, mediaType string) (bool, error) {
|
||||
switch mediaType {
|
||||
case ocispec.MediaTypeImageLayer, MediaTypeDockerSchema2Layer:
|
||||
case ocispec.MediaTypeImageLayerGzip, MediaTypeDockerSchema2LayerGzip:
|
||||
return true, nil
|
||||
default:
|
||||
// Still apply all generic media types *.tar[.+]gzip and *.tar
|
||||
if strings.HasSuffix(mediaType, ".tar.gzip") || strings.HasSuffix(mediaType, ".tar+gzip") {
|
||||
return true, nil
|
||||
} else if !strings.HasSuffix(mediaType, ".tar") {
|
||||
return false, errdefs.ErrNotImplemented
|
||||
}
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// GetImageLayerDescriptors gets the image layer Descriptors of an image; the array contains
|
||||
// a list of Descriptors belonging to one platform followed by lists of other platforms
|
||||
func GetImageLayerDescriptors(ctx context.Context, cs content.Store, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
|
||||
var lis []ocispec.Descriptor
|
||||
|
||||
ds := platforms.DefaultSpec()
|
||||
platform := &ds
|
||||
|
||||
switch desc.MediaType {
|
||||
case MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex,
|
||||
MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest:
|
||||
children, err := Children(ctx, cs, desc)
|
||||
if err != nil {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return []ocispec.Descriptor{}, nil
|
||||
}
|
||||
return []ocispec.Descriptor{}, err
|
||||
}
|
||||
|
||||
if desc.Platform != nil {
|
||||
platform = desc.Platform
|
||||
}
|
||||
|
||||
for _, child := range children {
|
||||
var tmp []ocispec.Descriptor
|
||||
|
||||
switch child.MediaType {
|
||||
case MediaTypeDockerSchema2LayerGzip, MediaTypeDockerSchema2Layer,
|
||||
ocispec.MediaTypeImageLayerGzip, ocispec.MediaTypeImageLayer,
|
||||
MediaTypeDockerSchema2LayerGzipEnc, MediaTypeDockerSchema2LayerEnc:
|
||||
tdesc := child
|
||||
tdesc.Platform = platform
|
||||
tmp = append(tmp, tdesc)
|
||||
default:
|
||||
tmp, err = GetImageLayerDescriptors(ctx, cs, child)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return []ocispec.Descriptor{}, err
|
||||
}
|
||||
|
||||
lis = append(lis, tmp...)
|
||||
}
|
||||
case MediaTypeDockerSchema2Config, ocispec.MediaTypeImageConfig:
|
||||
default:
|
||||
return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "GetImageLayerInfo: unhandled media type %s", desc.MediaType)
|
||||
}
|
||||
return lis, nil
|
||||
}
|
||||
|
86
vendor/github.com/containerd/containerd/images/mediatypes.go
generated
vendored
86
vendor/github.com/containerd/containerd/images/mediatypes.go
generated
vendored
@ -16,16 +16,23 @@
|
||||
|
||||
package images
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
// mediatype definitions for image components handled in containerd.
|
||||
//
|
||||
// oci components are generally referenced directly, although we may centralize
|
||||
// here for clarity.
|
||||
const (
|
||||
MediaTypeDockerSchema2Layer = "application/vnd.docker.image.rootfs.diff.tar"
|
||||
MediaTypeDockerSchema2LayerEnc = "application/vnd.docker.image.rootfs.diff.tar+enc"
|
||||
MediaTypeDockerSchema2LayerForeign = "application/vnd.docker.image.rootfs.foreign.diff.tar"
|
||||
MediaTypeDockerSchema2LayerGzip = "application/vnd.docker.image.rootfs.diff.tar.gzip"
|
||||
MediaTypeDockerSchema2LayerGzipEnc = "application/vnd.docker.image.rootfs.diff.tar.gzip+enc"
|
||||
MediaTypeDockerSchema2LayerForeignGzip = "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip"
|
||||
MediaTypeDockerSchema2Config = "application/vnd.docker.container.image.v1+json"
|
||||
MediaTypeDockerSchema2Manifest = "application/vnd.docker.distribution.manifest.v2+json"
|
||||
@ -42,3 +49,78 @@ const (
|
||||
// Legacy Docker schema1 manifest
|
||||
MediaTypeDockerSchema1Manifest = "application/vnd.docker.distribution.manifest.v1+prettyjws"
|
||||
)
|
||||
|
||||
// DiffCompression returns the compression as defined by the layer diff media
|
||||
// type. For Docker media types without compression, "unknown" is returned to
|
||||
// indicate that the media type may be compressed. If the media type is not
|
||||
// recognized as a layer diff, then it returns errdefs.ErrNotImplemented
|
||||
func DiffCompression(ctx context.Context, mediaType string) (string, error) {
|
||||
base, ext := parseMediaTypes(mediaType)
|
||||
switch base {
|
||||
case MediaTypeDockerSchema2Layer, MediaTypeDockerSchema2LayerForeign:
|
||||
if len(ext) > 0 {
|
||||
// Type is wrapped
|
||||
return "", nil
|
||||
}
|
||||
// These media types may have been compressed but failed to
|
||||
// use the correct media type. The decompression function
|
||||
// should detect and handle this case.
|
||||
return "unknown", nil
|
||||
case MediaTypeDockerSchema2LayerGzip, MediaTypeDockerSchema2LayerForeignGzip:
|
||||
if len(ext) > 0 {
|
||||
// Type is wrapped
|
||||
return "", nil
|
||||
}
|
||||
return "gzip", nil
|
||||
case ocispec.MediaTypeImageLayer, ocispec.MediaTypeImageLayerNonDistributable:
|
||||
if len(ext) > 0 {
|
||||
switch ext[len(ext)-1] {
|
||||
case "gzip":
|
||||
return "gzip", nil
|
||||
}
|
||||
}
|
||||
return "", nil
|
||||
default:
|
||||
return "", errdefs.ErrNotImplemented
|
||||
}
|
||||
}
|
||||
|
||||
// parseMediaTypes splits the media type into the base type and
|
||||
// an array of sorted extensions
|
||||
func parseMediaTypes(mt string) (string, []string) {
|
||||
if mt == "" {
|
||||
return "", []string{}
|
||||
}
|
||||
|
||||
s := strings.Split(mt, "+")
|
||||
ext := s[1:]
|
||||
sort.Strings(ext)
|
||||
|
||||
return s[0], ext
|
||||
}
|
||||
|
||||
// IsLayerTypes returns true if the media type is a layer
|
||||
func IsLayerType(mt string) bool {
|
||||
if strings.HasPrefix(mt, "application/vnd.oci.image.layer.") {
|
||||
return true
|
||||
}
|
||||
|
||||
// Parse Docker media types, strip off any + suffixes first
|
||||
base, _ := parseMediaTypes(mt)
|
||||
switch base {
|
||||
case MediaTypeDockerSchema2Layer, MediaTypeDockerSchema2LayerGzip,
|
||||
MediaTypeDockerSchema2LayerForeign, MediaTypeDockerSchema2LayerForeignGzip:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsKnownConfig returns true if the media type is a known config type
|
||||
func IsKnownConfig(mt string) bool {
|
||||
switch mt {
|
||||
case MediaTypeDockerSchema2Config, ocispec.MediaTypeImageConfig,
|
||||
MediaTypeContainerd1Checkpoint, MediaTypeContainerd1CheckpointConfig:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
18
vendor/github.com/containerd/containerd/metrics/cgroups/blkio.go
generated
vendored
18
vendor/github.com/containerd/containerd/metrics/cgroups/blkio.go
generated
vendored
@ -21,7 +21,7 @@ package cgroups
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/containerd/cgroups"
|
||||
v1 "github.com/containerd/containerd/metrics/types/v1"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
@ -33,7 +33,7 @@ var blkioMetrics = []*metric{
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
}
|
||||
@ -46,7 +46,7 @@ var blkioMetrics = []*metric{
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
}
|
||||
@ -59,7 +59,7 @@ var blkioMetrics = []*metric{
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
}
|
||||
@ -72,7 +72,7 @@ var blkioMetrics = []*metric{
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
}
|
||||
@ -85,7 +85,7 @@ var blkioMetrics = []*metric{
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
}
|
||||
@ -98,7 +98,7 @@ var blkioMetrics = []*metric{
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
}
|
||||
@ -111,7 +111,7 @@ var blkioMetrics = []*metric{
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
}
|
||||
@ -120,7 +120,7 @@ var blkioMetrics = []*metric{
|
||||
},
|
||||
}
|
||||
|
||||
func blkioValues(l []*cgroups.BlkIOEntry) []value {
|
||||
func blkioValues(l []*v1.BlkIOEntry) []value {
|
||||
var out []value
|
||||
for _, e := range l {
|
||||
out = append(out, value{
|
||||
|
16
vendor/github.com/containerd/containerd/metrics/cgroups/cpu.go
generated
vendored
16
vendor/github.com/containerd/containerd/metrics/cgroups/cpu.go
generated
vendored
@ -21,7 +21,7 @@ package cgroups
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/containerd/cgroups"
|
||||
v1 "github.com/containerd/containerd/metrics/types/v1"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
@ -32,7 +32,7 @@ var cpuMetrics = []*metric{
|
||||
help: "The total cpu time",
|
||||
unit: metrics.Nanoseconds,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.CPU == nil {
|
||||
return nil
|
||||
}
|
||||
@ -48,7 +48,7 @@ var cpuMetrics = []*metric{
|
||||
help: "The total kernel cpu time",
|
||||
unit: metrics.Nanoseconds,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.CPU == nil {
|
||||
return nil
|
||||
}
|
||||
@ -64,7 +64,7 @@ var cpuMetrics = []*metric{
|
||||
help: "The total user cpu time",
|
||||
unit: metrics.Nanoseconds,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.CPU == nil {
|
||||
return nil
|
||||
}
|
||||
@ -81,7 +81,7 @@ var cpuMetrics = []*metric{
|
||||
unit: metrics.Nanoseconds,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"cpu"},
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.CPU == nil {
|
||||
return nil
|
||||
}
|
||||
@ -100,7 +100,7 @@ var cpuMetrics = []*metric{
|
||||
help: "The total cpu throttle periods",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.CPU == nil {
|
||||
return nil
|
||||
}
|
||||
@ -116,7 +116,7 @@ var cpuMetrics = []*metric{
|
||||
help: "The total cpu throttled periods",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.CPU == nil {
|
||||
return nil
|
||||
}
|
||||
@ -132,7 +132,7 @@ var cpuMetrics = []*metric{
|
||||
help: "The total cpu throttled time",
|
||||
unit: metrics.Nanoseconds,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.CPU == nil {
|
||||
return nil
|
||||
}
|
||||
|
8
vendor/github.com/containerd/containerd/metrics/cgroups/hugetlb.go
generated
vendored
8
vendor/github.com/containerd/containerd/metrics/cgroups/hugetlb.go
generated
vendored
@ -19,7 +19,7 @@
|
||||
package cgroups
|
||||
|
||||
import (
|
||||
"github.com/containerd/cgroups"
|
||||
v1 "github.com/containerd/containerd/metrics/types/v1"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
@ -31,7 +31,7 @@ var hugetlbMetrics = []*metric{
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"page"},
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Hugetlb == nil {
|
||||
return nil
|
||||
}
|
||||
@ -51,7 +51,7 @@ var hugetlbMetrics = []*metric{
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"page"},
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Hugetlb == nil {
|
||||
return nil
|
||||
}
|
||||
@ -71,7 +71,7 @@ var hugetlbMetrics = []*metric{
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"page"},
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Hugetlb == nil {
|
||||
return nil
|
||||
}
|
||||
|
98
vendor/github.com/containerd/containerd/metrics/cgroups/memory.go
generated
vendored
98
vendor/github.com/containerd/containerd/metrics/cgroups/memory.go
generated
vendored
@ -19,7 +19,7 @@
|
||||
package cgroups
|
||||
|
||||
import (
|
||||
"github.com/containerd/cgroups"
|
||||
v1 "github.com/containerd/containerd/metrics/types/v1"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
@ -30,7 +30,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The cache amount used",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -46,7 +46,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The rss amount used",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -62,7 +62,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The rss_huge amount used",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -78,7 +78,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The mapped_file amount used",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -94,7 +94,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The dirty amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -110,7 +110,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The writeback amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -126,7 +126,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The pgpgin amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -142,7 +142,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The pgpgout amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -158,7 +158,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The pgfault amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -174,7 +174,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The pgmajfault amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -190,7 +190,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The inactive_anon amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -206,7 +206,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The active_anon amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -222,7 +222,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The inactive_file amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -238,7 +238,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The active_file amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -254,7 +254,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The unevictable amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -270,7 +270,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The hierarchical_memory_limit amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -286,7 +286,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The hierarchical_memsw_limit amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -302,7 +302,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_cache amount used",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -318,7 +318,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_rss amount used",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -334,7 +334,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_rss_huge amount used",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -350,7 +350,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_mapped_file amount used",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -366,7 +366,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_dirty amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -382,7 +382,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_writeback amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -398,7 +398,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_pgpgin amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -414,7 +414,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_pgpgout amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -430,7 +430,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_pgfault amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -446,7 +446,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_pgmajfault amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -462,7 +462,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_inactive_anon amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -478,7 +478,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_active_anon amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -494,7 +494,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_inactive_file amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -510,7 +510,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_active_file amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -526,7 +526,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The total_unevictable amount",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -542,7 +542,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The usage failcnt",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -558,7 +558,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The memory limit",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -574,7 +574,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The memory maximum usage",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -590,7 +590,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The memory usage",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -606,7 +606,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The swap failcnt",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -622,7 +622,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The swap limit",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -638,7 +638,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The swap maximum usage",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -654,7 +654,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The swap usage",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -670,7 +670,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The kernel failcnt",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -686,7 +686,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The kernel limit",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -702,7 +702,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The kernel maximum usage",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -718,7 +718,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The kernel usage",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -734,7 +734,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The kerneltcp failcnt",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -750,7 +750,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The kerneltcp limit",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -766,7 +766,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The kerneltcp maximum usage",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
@ -782,7 +782,7 @@ var memoryMetrics = []*metric{
|
||||
help: "The kerneltcp usage",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Memory == nil {
|
||||
return nil
|
||||
}
|
||||
|
6
vendor/github.com/containerd/containerd/metrics/cgroups/metric.go
generated
vendored
6
vendor/github.com/containerd/containerd/metrics/cgroups/metric.go
generated
vendored
@ -19,7 +19,7 @@
|
||||
package cgroups
|
||||
|
||||
import (
|
||||
"github.com/containerd/cgroups"
|
||||
v1 "github.com/containerd/containerd/metrics/types/v1"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
@ -36,7 +36,7 @@ type metric struct {
|
||||
vt prometheus.ValueType
|
||||
labels []string
|
||||
// getValues returns the value and labels for the data
|
||||
getValues func(stats *cgroups.Metrics) []value
|
||||
getValues func(stats *v1.Metrics) []value
|
||||
}
|
||||
|
||||
func (m *metric) desc(ns *metrics.Namespace) *prometheus.Desc {
|
||||
@ -44,7 +44,7 @@ func (m *metric) desc(ns *metrics.Namespace) *prometheus.Desc {
|
||||
return ns.NewDesc(m.name, m.help, m.unit, append([]string{"container_id", "namespace"}, m.labels...)...)
|
||||
}
|
||||
|
||||
func (m *metric) collect(id, namespace string, stats *cgroups.Metrics, ns *metrics.Namespace, ch chan<- prometheus.Metric, block bool) {
|
||||
func (m *metric) collect(id, namespace string, stats *v1.Metrics, ns *metrics.Namespace, ch chan<- prometheus.Metric, block bool) {
|
||||
values := m.getValues(stats)
|
||||
for _, v := range values {
|
||||
// block signals to block on the sending the metrics so none are missed
|
||||
|
3
vendor/github.com/containerd/containerd/metrics/cgroups/metrics.go
generated
vendored
3
vendor/github.com/containerd/containerd/metrics/cgroups/metrics.go
generated
vendored
@ -25,6 +25,7 @@ import (
|
||||
|
||||
"github.com/containerd/cgroups"
|
||||
"github.com/containerd/containerd/log"
|
||||
v1 "github.com/containerd/containerd/metrics/types/v1"
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
"github.com/containerd/containerd/runtime"
|
||||
"github.com/containerd/typeurl"
|
||||
@ -114,7 +115,7 @@ func (c *collector) collect(t runtime.Task, ch chan<- prometheus.Metric, block b
|
||||
log.L.WithError(err).Errorf("unmarshal stats for %s", t.ID())
|
||||
return
|
||||
}
|
||||
s, ok := data.(*cgroups.Metrics)
|
||||
s, ok := data.(*v1.Metrics)
|
||||
if !ok {
|
||||
log.L.WithError(err).Errorf("invalid metric type for %s", t.ID())
|
||||
return
|
||||
|
6
vendor/github.com/containerd/containerd/metrics/cgroups/pids.go
generated
vendored
6
vendor/github.com/containerd/containerd/metrics/cgroups/pids.go
generated
vendored
@ -19,7 +19,7 @@
|
||||
package cgroups
|
||||
|
||||
import (
|
||||
"github.com/containerd/cgroups"
|
||||
v1 "github.com/containerd/containerd/metrics/types/v1"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
@ -30,7 +30,7 @@ var pidMetrics = []*metric{
|
||||
help: "The limit to the number of pids allowed",
|
||||
unit: metrics.Unit("limit"),
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Pids == nil {
|
||||
return nil
|
||||
}
|
||||
@ -46,7 +46,7 @@ var pidMetrics = []*metric{
|
||||
help: "The current number of pids",
|
||||
unit: metrics.Unit("current"),
|
||||
vt: prometheus.GaugeValue,
|
||||
getValues: func(stats *cgroups.Metrics) []value {
|
||||
getValues: func(stats *v1.Metrics) []value {
|
||||
if stats.Pids == nil {
|
||||
return nil
|
||||
}
|
||||
|
44
vendor/github.com/containerd/containerd/metrics/types/v1/types.go
generated
vendored
Normal file
44
vendor/github.com/containerd/containerd/metrics/types/v1/types.go
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
// +build linux
|
||||
|
||||
/*
|
||||
Copyright The containerd 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 v1
|
||||
|
||||
import "github.com/containerd/cgroups"
|
||||
|
||||
type (
|
||||
// Metrics alias
|
||||
Metrics = cgroups.Metrics
|
||||
// BlkIOEntry alias
|
||||
BlkIOEntry = cgroups.BlkIOEntry
|
||||
// MemoryStat alias
|
||||
MemoryStat = cgroups.MemoryStat
|
||||
// CPUStat alias
|
||||
CPUStat = cgroups.CPUStat
|
||||
// CPUUsage alias
|
||||
CPUUsage = cgroups.CPUUsage
|
||||
// BlkIOStat alias
|
||||
BlkIOStat = cgroups.BlkIOStat
|
||||
// PidsStat alias
|
||||
PidsStat = cgroups.PidsStat
|
||||
// RdmaStat alias
|
||||
RdmaStat = cgroups.RdmaStat
|
||||
// RdmaEntry alias
|
||||
RdmaEntry = cgroups.RdmaEntry
|
||||
// HugetlbStat alias
|
||||
HugetlbStat = cgroups.HugetlbStat
|
||||
)
|
47
vendor/github.com/containerd/containerd/oci/spec_opts.go
generated
vendored
47
vendor/github.com/containerd/containerd/oci/spec_opts.go
generated
vendored
@ -17,6 +17,7 @@
|
||||
package oci
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
@ -1200,3 +1201,49 @@ func WithLinuxDevice(path, permissions string) SpecOpts {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithEnvFile adds environment variables from a file to the container's spec
|
||||
func WithEnvFile(path string) SpecOpts {
|
||||
return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
|
||||
var vars []string
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
sc := bufio.NewScanner(f)
|
||||
for sc.Scan() {
|
||||
if sc.Err() != nil {
|
||||
return sc.Err()
|
||||
}
|
||||
vars = append(vars, sc.Text())
|
||||
}
|
||||
return WithEnv(vars)(nil, nil, nil, s)
|
||||
}
|
||||
}
|
||||
|
||||
// ErrNoShmMount is returned when there is no /dev/shm mount specified in the config
|
||||
// and an Opts was trying to set a configuration value on the mount.
|
||||
var ErrNoShmMount = errors.New("no /dev/shm mount specified")
|
||||
|
||||
// WithDevShmSize sets the size of the /dev/shm mount for the container.
|
||||
//
|
||||
// The size value is specified in kb, kilobytes.
|
||||
func WithDevShmSize(kb int64) SpecOpts {
|
||||
return func(ctx context.Context, _ Client, c *containers.Container, s *Spec) error {
|
||||
for _, m := range s.Mounts {
|
||||
if m.Source == "shm" && m.Type == "tmpfs" {
|
||||
for i, o := range m.Options {
|
||||
if strings.HasPrefix(o, "size=") {
|
||||
m.Options[i] = fmt.Sprintf("size=%dk", kb)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
m.Options = append(m.Options, fmt.Sprintf("size=%dk", kb))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return ErrNoShmMount
|
||||
}
|
||||
}
|
||||
|
6
vendor/github.com/containerd/containerd/platforms/database.go
generated
vendored
6
vendor/github.com/containerd/containerd/platforms/database.go
generated
vendored
@ -28,7 +28,7 @@ func isLinuxOS(os string) bool {
|
||||
return os == "linux"
|
||||
}
|
||||
|
||||
// These function are generated from from https://golang.org/src/go/build/syslist.go.
|
||||
// These function are generated from https://golang.org/src/go/build/syslist.go.
|
||||
//
|
||||
// We use switch statements because they are slightly faster than map lookups
|
||||
// and use a little less memory.
|
||||
@ -38,7 +38,7 @@ func isLinuxOS(os string) bool {
|
||||
// The OS value should be normalized before calling this function.
|
||||
func isKnownOS(os string) bool {
|
||||
switch os {
|
||||
case "android", "darwin", "dragonfly", "freebsd", "linux", "nacl", "netbsd", "openbsd", "plan9", "solaris", "windows", "zos":
|
||||
case "aix", "android", "darwin", "dragonfly", "freebsd", "hurd", "illumos", "js", "linux", "nacl", "netbsd", "openbsd", "plan9", "solaris", "windows", "zos":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -60,7 +60,7 @@ func isArmArch(arch string) bool {
|
||||
// The arch value should be normalized before being passed to this function.
|
||||
func isKnownArch(arch string) bool {
|
||||
switch arch {
|
||||
case "386", "amd64", "amd64p32", "arm", "armbe", "arm64", "arm64be", "ppc64", "ppc64le", "mips", "mipsle", "mips64", "mips64le", "mips64p32", "mips64p32le", "ppc", "s390", "s390x", "sparc", "sparc64":
|
||||
case "386", "amd64", "amd64p32", "arm", "armbe", "arm64", "arm64be", "ppc64", "ppc64le", "mips", "mipsle", "mips64", "mips64le", "mips64p32", "mips64p32le", "ppc", "riscv", "riscv64", "s390", "s390x", "sparc", "sparc64", "wasm":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
22
vendor/github.com/containerd/containerd/remotes/docker/scope.go
generated
vendored
22
vendor/github.com/containerd/containerd/remotes/docker/scope.go
generated
vendored
@ -51,19 +51,25 @@ func contextWithRepositoryScope(ctx context.Context, refspec reference.Spec, pus
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return context.WithValue(ctx, tokenScopesKey{}, []string{s}), nil
|
||||
return WithScope(ctx, s), nil
|
||||
}
|
||||
|
||||
// WithScope appends a custom registry auth scope to the context.
|
||||
func WithScope(ctx context.Context, scope string) context.Context {
|
||||
var scopes []string
|
||||
if v := ctx.Value(tokenScopesKey{}); v != nil {
|
||||
scopes = v.([]string)
|
||||
scopes = append(scopes, scope)
|
||||
} else {
|
||||
scopes = []string{scope}
|
||||
}
|
||||
return context.WithValue(ctx, tokenScopesKey{}, scopes)
|
||||
}
|
||||
|
||||
// contextWithAppendPullRepositoryScope is used to append repository pull
|
||||
// scope into existing scopes indexed by the tokenScopesKey{}.
|
||||
func contextWithAppendPullRepositoryScope(ctx context.Context, repo string) context.Context {
|
||||
var scopes []string
|
||||
|
||||
if v := ctx.Value(tokenScopesKey{}); v != nil {
|
||||
scopes = append(scopes, v.([]string)...)
|
||||
}
|
||||
scopes = append(scopes, fmt.Sprintf("repository:%s:pull", repo))
|
||||
return context.WithValue(ctx, tokenScopesKey{}, scopes)
|
||||
return WithScope(ctx, fmt.Sprintf("repository:%s:pull", repo))
|
||||
}
|
||||
|
||||
// getTokenScopes returns deduplicated and sorted scopes from ctx.Value(tokenScopesKey{}) and common scopes.
|
||||
|
44
vendor/github.com/containerd/containerd/remotes/handlers.go
generated
vendored
44
vendor/github.com/containerd/containerd/remotes/handlers.go
generated
vendored
@ -33,28 +33,46 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type refKeyPrefix struct{}
|
||||
|
||||
// WithMediaTypeKeyPrefix adds a custom key prefix for a media type which is used when storing
|
||||
// data in the content store from the FetchHandler.
|
||||
//
|
||||
// Used in `MakeRefKey` to determine what the key prefix should be.
|
||||
func WithMediaTypeKeyPrefix(ctx context.Context, mediaType, prefix string) context.Context {
|
||||
var values map[string]string
|
||||
if v := ctx.Value(refKeyPrefix{}); v != nil {
|
||||
values = v.(map[string]string)
|
||||
} else {
|
||||
values = make(map[string]string)
|
||||
}
|
||||
|
||||
values[mediaType] = prefix
|
||||
return context.WithValue(ctx, refKeyPrefix{}, values)
|
||||
}
|
||||
|
||||
// MakeRefKey returns a unique reference for the descriptor. This reference can be
|
||||
// used to lookup ongoing processes related to the descriptor. This function
|
||||
// may look to the context to namespace the reference appropriately.
|
||||
func MakeRefKey(ctx context.Context, desc ocispec.Descriptor) string {
|
||||
// TODO(stevvooe): Need better remote key selection here. Should be a
|
||||
// product of the context, which may include information about the ongoing
|
||||
// fetch process.
|
||||
switch desc.MediaType {
|
||||
case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest:
|
||||
if v := ctx.Value(refKeyPrefix{}); v != nil {
|
||||
values := v.(map[string]string)
|
||||
if prefix := values[desc.MediaType]; prefix != "" {
|
||||
return prefix + "-" + desc.Digest.String()
|
||||
}
|
||||
}
|
||||
|
||||
switch mt := desc.MediaType; {
|
||||
case mt == images.MediaTypeDockerSchema2Manifest || mt == ocispec.MediaTypeImageManifest:
|
||||
return "manifest-" + desc.Digest.String()
|
||||
case images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex:
|
||||
case mt == images.MediaTypeDockerSchema2ManifestList || mt == ocispec.MediaTypeImageIndex:
|
||||
return "index-" + desc.Digest.String()
|
||||
case images.MediaTypeDockerSchema2Layer, images.MediaTypeDockerSchema2LayerGzip,
|
||||
images.MediaTypeDockerSchema2LayerForeign, images.MediaTypeDockerSchema2LayerForeignGzip,
|
||||
ocispec.MediaTypeImageLayer, ocispec.MediaTypeImageLayerGzip,
|
||||
ocispec.MediaTypeImageLayerNonDistributable, ocispec.MediaTypeImageLayerNonDistributableGzip,
|
||||
images.MediaTypeDockerSchema2LayerEnc, images.MediaTypeDockerSchema2LayerGzipEnc:
|
||||
case images.IsLayerType(mt):
|
||||
return "layer-" + desc.Digest.String()
|
||||
case images.MediaTypeDockerSchema2Config, ocispec.MediaTypeImageConfig:
|
||||
case images.IsKnownConfig(mt):
|
||||
return "config-" + desc.Digest.String()
|
||||
default:
|
||||
log.G(ctx).Warnf("reference for unknown type: %s", desc.MediaType)
|
||||
log.G(ctx).Warnf("reference for unknown type: %s", mt)
|
||||
return "unknown-" + desc.Digest.String()
|
||||
}
|
||||
}
|
||||
|
2
vendor/github.com/containerd/containerd/runtime/v2/binary.go
generated
vendored
2
vendor/github.com/containerd/containerd/runtime/v2/binary.go
generated
vendored
@ -74,7 +74,7 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
f, err := openShimLog(ctx, b.bundle)
|
||||
f, err := openShimLog(ctx, b.bundle, client.AnonDialer)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "open shim log pipe")
|
||||
}
|
||||
|
4
vendor/github.com/containerd/containerd/runtime/v2/shim.go
generated
vendored
4
vendor/github.com/containerd/containerd/runtime/v2/shim.go
generated
vendored
@ -67,7 +67,7 @@ func loadShim(ctx context.Context, bundle *Bundle, events *exchange.Exchange, rt
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
conn, err := client.Connect(address, client.AnonDialer)
|
||||
conn, err := client.Connect(address, client.AnonReconnectDialer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -76,7 +76,7 @@ func loadShim(ctx context.Context, bundle *Bundle, events *exchange.Exchange, rt
|
||||
conn.Close()
|
||||
}
|
||||
}()
|
||||
f, err := openShimLog(ctx, bundle)
|
||||
f, err := openShimLog(ctx, bundle, client.AnonReconnectDialer)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "open shim log pipe")
|
||||
}
|
||||
|
4
vendor/github.com/containerd/containerd/runtime/v2/shim/util_unix.go
generated
vendored
4
vendor/github.com/containerd/containerd/runtime/v2/shim/util_unix.go
generated
vendored
@ -78,6 +78,10 @@ func AnonDialer(address string, timeout time.Duration) (net.Conn, error) {
|
||||
return net.DialTimeout("unix", "\x00"+address, timeout)
|
||||
}
|
||||
|
||||
func AnonReconnectDialer(address string, timeout time.Duration) (net.Conn, error) {
|
||||
return AnonDialer(address, timeout)
|
||||
}
|
||||
|
||||
// NewSocket returns a new socket
|
||||
func NewSocket(address string) (*net.UnixListener, error) {
|
||||
if len(address) > 106 {
|
||||
|
16
vendor/github.com/containerd/containerd/runtime/v2/shim/util_windows.go
generated
vendored
16
vendor/github.com/containerd/containerd/runtime/v2/shim/util_windows.go
generated
vendored
@ -33,6 +33,22 @@ func getSysProcAttr() *syscall.SysProcAttr {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AnonReconnectDialer returns a dialer for an existing npipe on containerd reconnection
|
||||
func AnonReconnectDialer(address string, timeout time.Duration) (net.Conn, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||
defer cancel()
|
||||
|
||||
c, err := winio.DialPipeContext(ctx, address)
|
||||
if os.IsNotExist(err) {
|
||||
return nil, errors.Wrap(os.ErrNotExist, "npipe not found on reconnect")
|
||||
} else if err == context.DeadlineExceeded {
|
||||
return nil, errors.Wrapf(err, "timed out waiting for npipe %s", address)
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// AnonDialer returns a dialer for a npipe
|
||||
func AnonDialer(address string, timeout time.Duration) (net.Conn, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||
|
4
vendor/github.com/containerd/containerd/runtime/v2/shim_unix.go
generated
vendored
4
vendor/github.com/containerd/containerd/runtime/v2/shim_unix.go
generated
vendored
@ -21,13 +21,15 @@ package v2
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/fifo"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func openShimLog(ctx context.Context, bundle *Bundle) (io.ReadCloser, error) {
|
||||
func openShimLog(ctx context.Context, bundle *Bundle, _ func(string, time.Duration) (net.Conn, error)) (io.ReadCloser, error) {
|
||||
return fifo.OpenFifo(ctx, filepath.Join(bundle.Path, "log"), unix.O_RDONLY|unix.O_CREAT|unix.O_NONBLOCK, 0700)
|
||||
}
|
||||
|
||||
|
5
vendor/github.com/containerd/containerd/runtime/v2/shim_windows.go
generated
vendored
5
vendor/github.com/containerd/containerd/runtime/v2/shim_windows.go
generated
vendored
@ -26,7 +26,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
client "github.com/containerd/containerd/runtime/v2/shim"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@ -64,7 +63,7 @@ func (dpc *deferredPipeConnection) Close() error {
|
||||
|
||||
// openShimLog on Windows acts as the client of the log pipe. In this way the
|
||||
// containerd daemon can reconnect to the shim log stream if it is restarted.
|
||||
func openShimLog(ctx context.Context, bundle *Bundle) (io.ReadCloser, error) {
|
||||
func openShimLog(ctx context.Context, bundle *Bundle, dialer func(string, time.Duration) (net.Conn, error)) (io.ReadCloser, error) {
|
||||
ns, err := namespaces.NamespaceRequired(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -74,7 +73,7 @@ func openShimLog(ctx context.Context, bundle *Bundle) (io.ReadCloser, error) {
|
||||
}
|
||||
dpc.wg.Add(1)
|
||||
go func() {
|
||||
c, conerr := client.AnonDialer(
|
||||
c, conerr := dialer(
|
||||
fmt.Sprintf("\\\\.\\pipe\\containerd-shim-%s-%s-log", ns, bundle.ID),
|
||||
time.Second*10,
|
||||
)
|
||||
|
14
vendor/github.com/containerd/containerd/unpacker.go
generated
vendored
14
vendor/github.com/containerd/containerd/unpacker.go
generated
vendored
@ -204,12 +204,12 @@ func (u *unpacker) handlerWrapper(uctx context.Context, unpacks *int32) (func(im
|
||||
// one manifest to handle, and manifest list can be
|
||||
// safely skipped.
|
||||
// TODO: support multi-platform unpack.
|
||||
switch desc.MediaType {
|
||||
case images.MediaTypeDockerSchema1Manifest:
|
||||
switch mt := desc.MediaType; {
|
||||
case mt == images.MediaTypeDockerSchema1Manifest:
|
||||
lock.Lock()
|
||||
schema1 = true
|
||||
lock.Unlock()
|
||||
case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest:
|
||||
case mt == images.MediaTypeDockerSchema2Manifest || mt == ocispec.MediaTypeImageManifest:
|
||||
lock.Lock()
|
||||
for _, child := range children {
|
||||
if child.MediaType == images.MediaTypeDockerSchema2Config ||
|
||||
@ -219,7 +219,7 @@ func (u *unpacker) handlerWrapper(uctx context.Context, unpacks *int32) (func(im
|
||||
layers = append(layers, child)
|
||||
}
|
||||
lock.Unlock()
|
||||
case images.MediaTypeDockerSchema2Config, ocispec.MediaTypeImageConfig:
|
||||
case mt == images.MediaTypeDockerSchema2Config || mt == ocispec.MediaTypeImageConfig:
|
||||
lock.Lock()
|
||||
l := append([]ocispec.Descriptor{}, layers...)
|
||||
lock.Unlock()
|
||||
@ -229,11 +229,7 @@ func (u *unpacker) handlerWrapper(uctx context.Context, unpacks *int32) (func(im
|
||||
return u.unpack(uctx, desc, l)
|
||||
})
|
||||
}
|
||||
case images.MediaTypeDockerSchema2Layer, images.MediaTypeDockerSchema2LayerGzip,
|
||||
images.MediaTypeDockerSchema2LayerForeign, images.MediaTypeDockerSchema2LayerForeignGzip,
|
||||
ocispec.MediaTypeImageLayer, ocispec.MediaTypeImageLayerGzip,
|
||||
ocispec.MediaTypeImageLayerNonDistributable, ocispec.MediaTypeImageLayerNonDistributableGzip,
|
||||
images.MediaTypeDockerSchema2LayerEnc, images.MediaTypeDockerSchema2LayerGzipEnc:
|
||||
case images.IsLayerType(mt):
|
||||
lock.Lock()
|
||||
update := !schema1
|
||||
lock.Unlock()
|
||||
|
8
vendor/github.com/containerd/containerd/vendor.conf
generated
vendored
8
vendor/github.com/containerd/containerd/vendor.conf
generated
vendored
@ -1,4 +1,4 @@
|
||||
github.com/containerd/go-runc 9007c2405372fe28918845901a3276c0915689a1
|
||||
github.com/containerd/go-runc e029b79d8cda8374981c64eba71f28ec38e5526f
|
||||
github.com/containerd/console 0650fd9eeb50bab4fc99dceb9f2e14cf58f36e7f
|
||||
github.com/containerd/cgroups c4b9ac5c7601384c965b9646fc515884e091ebb9
|
||||
github.com/containerd/typeurl a93fcdb778cd272c6e9b3028b2f42d813e785d40
|
||||
@ -23,7 +23,7 @@ github.com/opencontainers/runtime-spec 29686dbc5559d93fb1ef402eeda3e35c38d75af4
|
||||
github.com/opencontainers/runc f4982d86f7fde0b6f953cc62ccc4022c519a10a9 # v1.0.0-rc8-32-gf4982d86
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1
|
||||
github.com/sirupsen/logrus v1.4.1
|
||||
github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c
|
||||
github.com/urfave/cli v1.22.0
|
||||
golang.org/x/net f3200d17e092c607f615320ecaad13d87ad9a2b3
|
||||
google.golang.org/grpc 6eaf6f47437a6b4e2153a190160ef39a92c7eceb # v1.23.0
|
||||
github.com/pkg/errors v0.8.1
|
||||
@ -47,9 +47,11 @@ github.com/hashicorp/go-multierror v1.0.0
|
||||
github.com/hashicorp/golang-lru v0.5.3
|
||||
go.opencensus.io v0.22.0
|
||||
github.com/imdario/mergo v0.3.7
|
||||
github.com/cpuguy83/go-md2man v1.0.10
|
||||
github.com/russross/blackfriday v1.5.2
|
||||
|
||||
# cri dependencies
|
||||
github.com/containerd/cri 0165d516161e25e52b4ab52a404a00823f8f0ef6 # master
|
||||
github.com/containerd/cri f4d75d321c89b8d89bae570a7d2da1b3846c096f # release/1.3
|
||||
github.com/containerd/go-cni 49fbd9b210f3c8ee3b7fd3cd797aabaf364627c1
|
||||
github.com/containernetworking/cni v0.7.1
|
||||
github.com/containernetworking/plugins v0.7.6
|
||||
|
Loading…
Reference in New Issue
Block a user