kubelet

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContainerMetricGroup = MetricGroup("container")
	PodMetricGroup       = MetricGroup("pod")
	NodeMetricGroup      = MetricGroup("node")
	VolumeMetricGroup    = MetricGroup("volume")
)

Variables

Functions

func GetPersistentVolumeLabels added in v0.9.0

func GetPersistentVolumeLabels(pv v1.PersistentVolumeSource, labels map[string]string)

func MetricsData

func MetricsData(
	logger *zap.Logger, summary *stats.Summary,
	metadata Metadata, typeStr string,
	metricGroupsToCollect map[MetricGroup]bool) []consumerdata.MetricsData

func ValidateMetadataLabelsConfig added in v0.7.0

func ValidateMetadataLabelsConfig(labels []MetadataLabel) error

ValidateMetadataLabelsConfig validates that provided list of metadata labels is supported

Types

type Client

type Client interface {
	Get(path string) ([]byte, error)
}

type ClientConfig

type ClientConfig struct {
	k8sconfig.APIConfig  `mapstructure:",squash"`
	configtls.TLSSetting `mapstructure:",squash"`
	// InsecureSkipVerify controls whether the client verifies the server's
	// certificate chain and host name.
	InsecureSkipVerify bool `mapstructure:"insecure_skip_verify"`
}

Config for a kubelet client for talking to a kubelet HTTP endpoint.

type ClientProvider added in v0.5.0

type ClientProvider interface {
	BuildClient() (Client, error)
}

func NewClientProvider added in v0.5.0

func NewClientProvider(endpoint string, cfg *ClientConfig, logger *zap.Logger) (ClientProvider, error)

type HTTPRestClient

type HTTPRestClient struct {
	// contains filtered or unexported fields
}

RestClient is a thin wrapper around a kubelet client, encapsulating endpoints and their corresponding http methods. The endpoints /stats/container /spec/ are excluded because they require cadvisor. The /metrics endpoint is excluded because it returns Prometheus data.

func NewRestClient

func NewRestClient(client Client) *HTTPRestClient

func (*HTTPRestClient) Pods

func (c *HTTPRestClient) Pods() ([]byte, error)

func (*HTTPRestClient) StatsSummary

func (c *HTTPRestClient) StatsSummary() ([]byte, error)

type Metadata added in v0.7.0

type Metadata struct {
	Labels                  map[MetadataLabel]bool
	PodsMetadata            *v1.PodList
	DetailedPVCLabelsSetter func(volCacheID, volumeClaim, namespace string, labels map[string]string) error
}

func NewMetadata added in v0.7.0

func NewMetadata(
	labels []MetadataLabel, podsMetadata *v1.PodList,
	detailedPVCLabelsSetter func(volCacheID, volumeClaim, namespace string, labels map[string]string) error) Metadata

type MetadataLabel added in v0.7.0

type MetadataLabel string
const (
	MetadataLabelContainerID MetadataLabel = conventions.AttributeContainerID
	MetadataLabelVolumeType  MetadataLabel = labelVolumeType
)

type MetadataProvider added in v0.7.0

type MetadataProvider struct {
	// contains filtered or unexported fields
}

MetadataProvider wraps a RestClient, returning an unmarshaled metadata.

func NewMetadataProvider added in v0.7.0

func NewMetadataProvider(rc RestClient) *MetadataProvider

func (*MetadataProvider) Pods added in v0.7.0

func (p *MetadataProvider) Pods() (*v1.PodList, error)

Pods calls the /pods endpoint and unmarshals the results into a v1.PodList struct.

type MetricGroup added in v0.8.0

type MetricGroup string

type RestClient

type RestClient interface {
	StatsSummary() ([]byte, error)
	Pods() ([]byte, error)
}

RestClient is swappable for testing.

type StatsProvider

type StatsProvider struct {
	// contains filtered or unexported fields
}

StatsProvider wraps a RestClient, returning an unmarshaled stats.Summary struct from the kubelet API.

func NewStatsProvider

func NewStatsProvider(rc RestClient) *StatsProvider

func (*StatsProvider) StatsSummary

func (p *StatsProvider) StatsSummary() (*stats.Summary, error)

StatsSummary calls the /stats/summary kubelet endpoint and unmarshals the results into a stats.Summary struct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL