kubernetes

package
v1.71.0-cluster Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SDCheckInterval = flag.Duration("promscrape.kubernetesSDCheckInterval", 30*time.Second, "Interval for checking for changes in Kubernetes API server. "+
	"This works only if kubernetes_sd_configs is configured in '-promscrape.config' file. "+
	"See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config for details")

SDCheckInterval defines interval for targets refresh.

Functions

This section is empty.

Types

type Bookmark added in v1.56.0

type Bookmark struct {
	Metadata struct {
		ResourceVersion string
	}
}

Bookmark is a bookmark message from Kubernetes Watch API. See https://kubernetes.io/docs/reference/using-api/api-concepts/#watch-bookmarks

type Container

type Container struct {
	Name  string
	Ports []ContainerPort
}

Container implements k8s container.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#container-v1-core

type ContainerPort

type ContainerPort struct {
	Name          string
	ContainerPort int
	Protocol      string
}

ContainerPort implements k8s container port.

type DaemonEndpoint

type DaemonEndpoint struct {
	Port int
}

DaemonEndpoint represents DaemonEndpoint from k8s API.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#daemonendpoint-v1-core

type Endpoint added in v1.41.0

type Endpoint struct {
	Addresses  []string
	Conditions EndpointConditions
	Hostname   string
	TargetRef  ObjectReference
	Topology   map[string]string
}

Endpoint implements kubernetes object endpoint for endpoint slice.

See https://v1-21.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#endpoint-v1-discovery-k8s-io

type EndpointAddress

type EndpointAddress struct {
	Hostname  string
	IP        string
	NodeName  string
	TargetRef ObjectReference
}

EndpointAddress implements k8s endpoint address.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#endpointaddress-v1-core

type EndpointConditions added in v1.41.0

type EndpointConditions struct {
	Ready bool
}

EndpointConditions implements kubernetes endpoint condition.

See https://v1-21.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#endpointconditions-v1-discovery-k8s-io

type EndpointPort

type EndpointPort struct {
	AppProtocol string
	Name        string
	Port        int
	Protocol    string
}

EndpointPort implements k8s endpoint port.

See https://v1-21.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#endpointport-v1-discovery-k8s-io

type EndpointSlice added in v1.41.0

type EndpointSlice struct {
	Metadata    ObjectMeta
	Endpoints   []Endpoint
	AddressType string
	Ports       []EndpointPort
}

EndpointSlice - implements kubernetes endpoint slice.

See https://v1-21.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#endpointslice-v1-discovery-k8s-io

type EndpointSliceList added in v1.41.0

type EndpointSliceList struct {
	Metadata ListMeta
	Items    []*EndpointSlice
}

EndpointSliceList - implements kubernetes endpoint slice list object, that groups service endpoints slices.

See https://v1-21.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#endpointslicelist-v1-discovery-k8s-io

type EndpointSubset

type EndpointSubset struct {
	Addresses         []EndpointAddress
	NotReadyAddresses []EndpointAddress
	Ports             []EndpointPort
}

EndpointSubset implements k8s endpoint subset.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#endpointsubset-v1-core

type Endpoints

type Endpoints struct {
	Metadata ObjectMeta
	Subsets  []EndpointSubset
}

Endpoints implements k8s endpoints.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#endpoints-v1-core

type EndpointsList

type EndpointsList struct {
	Metadata ListMeta
	Items    []*Endpoints
}

EndpointsList implements k8s endpoints list.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#endpointslist-v1-core

type Error added in v1.57.0

type Error struct {
	Code int
}

Error is an error message from Kubernetes Watch API.

type HTTPIngressPath

type HTTPIngressPath struct {
	Path string
}

HTTPIngressPath represents HTTP ingress path in k8s.

See https://v1-21.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#httpingresspath-v1-networking-k8s-io

type HTTPIngressRuleValue

type HTTPIngressRuleValue struct {
	Paths []HTTPIngressPath
}

HTTPIngressRuleValue represents HTTP ingress rule value in k8s.

See https://v1-21.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#httpingressrulevalue-v1-networking-k8s-io

type IngressList

type IngressList struct {
	Metadata ListMeta
	Items    []*Ingress
}

IngressList represents ingress list in k8s.

See https://v1-21.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#ingresslist-v1-networking-k8s-io

type IngressRule

type IngressRule struct {
	Host string
	HTTP HTTPIngressRuleValue `json:"http"`
}

IngressRule represents ingress rule in k8s.

See https://v1-21.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#ingressrule-v1-networking-k8s-io

type IngressSpec

type IngressSpec struct {
	TLS   []IngressTLS `json:"tls"`
	Rules []IngressRule
}

IngressSpec represents ingress spec in k8s.

See https://v1-21.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#ingressspec-v1-networking-k8s-io

type IngressTLS

type IngressTLS struct {
	Hosts []string
}

IngressTLS represents ingress TLS spec in k8s.

See https://v1-21.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#ingresstls-v1-networking-k8s-io

type ListMeta added in v1.55.0

type ListMeta struct {
	ResourceVersion string
}

ListMeta is a Kubernetes list metadata https://v1-17.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#listmeta-v1-meta

type Namespaces added in v1.35.0

type Namespaces struct {
	Names []string `yaml:"names"`
}

Namespaces represents namespaces for SDConfig

type Node

type Node struct {
	Metadata ObjectMeta
	Status   NodeStatus
}

Node represents Node from k8s API.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#node-v1-core

type NodeAddress

type NodeAddress struct {
	Type    string
	Address string
}

NodeAddress represents NodeAddress from k8s API.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#nodeaddress-v1-core

type NodeDaemonEndpoints

type NodeDaemonEndpoints struct {
	KubeletEndpoint DaemonEndpoint
}

NodeDaemonEndpoints represents NodeDaemonEndpoints from k8s API.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#nodedaemonendpoints-v1-core

type NodeList

type NodeList struct {
	Metadata ListMeta
	Items    []*Node
}

NodeList represents NodeList from k8s API.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#nodelist-v1-core

type NodeStatus

type NodeStatus struct {
	Addresses       []NodeAddress
	DaemonEndpoints NodeDaemonEndpoints
}

NodeStatus represents NodeStatus from k8s API.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#nodestatus-v1-core

type ObjectMeta

type ObjectMeta struct {
	Name            string
	Namespace       string
	UID             string
	Labels          discoveryutils.SortedLabels
	Annotations     discoveryutils.SortedLabels
	OwnerReferences []OwnerReference
}

ObjectMeta represents ObjectMeta from k8s API.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#objectmeta-v1-meta

type ObjectReference

type ObjectReference struct {
	Kind      string
	Name      string
	Namespace string
}

ObjectReference implements k8s object reference.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#objectreference-v1-core

type OwnerReference

type OwnerReference struct {
	Name       string
	Controller bool
	Kind       string
}

OwnerReference represents OwnerReferense from k8s API.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#ownerreference-v1-meta

type Pod

type Pod struct {
	Metadata ObjectMeta
	Spec     PodSpec
	Status   PodStatus
}

Pod implements k8s pod.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#pod-v1-core

type PodCondition

type PodCondition struct {
	Type   string
	Status string
}

PodCondition implements k8s pod condition.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#podcondition-v1-core

type PodList

type PodList struct {
	Metadata ListMeta
	Items    []*Pod
}

PodList implements k8s pod list.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#podlist-v1-core

type PodSpec

type PodSpec struct {
	NodeName       string
	Containers     []Container
	InitContainers []Container
}

PodSpec implements k8s pod spec.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#podspec-v1-core

type PodStatus

type PodStatus struct {
	Phase      string
	PodIP      string
	HostIP     string
	Conditions []PodCondition
}

PodStatus implements k8s pod status.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#podstatus-v1-core

type SDConfig added in v1.35.0

type SDConfig struct {
	APIServer string `yaml:"api_server,omitempty"`

	// Use role() function for accessing the Role field
	Role string `yaml:"role"`

	HTTPClientConfig promauth.HTTPClientConfig `yaml:",inline"`
	ProxyURL         *proxy.URL                `yaml:"proxy_url,omitempty"`
	Namespaces       Namespaces                `yaml:"namespaces,omitempty"`
	Selectors        []Selector                `yaml:"selectors,omitempty"`
	// contains filtered or unexported fields
}

SDConfig represents kubernetes-based service discovery config.

See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config

func (*SDConfig) GetScrapeWorkObjects added in v1.55.0

func (sdc *SDConfig) GetScrapeWorkObjects() ([]interface{}, error)

GetScrapeWorkObjects returns ScrapeWork objects for the given sdc.

This function must be called after MustStart call.

func (*SDConfig) MustStart added in v1.58.0

func (sdc *SDConfig) MustStart(baseDir string, swcFunc ScrapeWorkConstructorFunc)

MustStart initializes sdc before its usage.

swcFunc is used for constructing such objects.

func (*SDConfig) MustStop added in v1.55.0

func (sdc *SDConfig) MustStop()

MustStop stops further usage for sdc.

type ScrapeWorkConstructorFunc added in v1.55.0

type ScrapeWorkConstructorFunc func(metaLabels map[string]string) interface{}

ScrapeWorkConstructorFunc must construct ScrapeWork object for the given metaLabels.

type Selector

type Selector struct {
	Role  string `yaml:"role"`
	Label string `yaml:"label"`
	Field string `yaml:"field"`
}

Selector represents kubernetes selector.

See https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/ and https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/

type Service

type Service struct {
	Metadata ObjectMeta
	Spec     ServiceSpec
}

Service is k8s service.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#service-v1-core

type ServiceList

type ServiceList struct {
	Metadata ListMeta
	Items    []*Service
}

ServiceList is k8s service list.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#servicelist-v1-core

type ServicePort

type ServicePort struct {
	Name     string
	Protocol string
	Port     int
}

ServicePort is k8s service port.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#serviceport-v1-core

type ServiceSpec

type ServiceSpec struct {
	ClusterIP    string
	ExternalName string
	Type         string
	Ports        []ServicePort
}

ServiceSpec is k8s service spec.

See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#servicespec-v1-core

type WatchEvent added in v1.55.0

type WatchEvent struct {
	Type   string
	Object json.RawMessage
}

WatchEvent is a watch event returned from API server endpoints if `watch=1` query arg is set.

See https://kubernetes.io/docs/reference/using-api/api-concepts/#efficient-detection-of-changes

Jump to

Keyboard shortcuts

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