Documentation ¶
Index ¶
- Variables
- type AttachMetadata
- type AuthInfo
- type Bookmark
- type BookmarkMetadata
- type Cluster
- type Config
- type Container
- type ContainerPort
- type ContainerState
- type ContainerStateTerminated
- type ContainerStatus
- type Context
- type DaemonEndpoint
- type Endpoint
- type EndpointAddress
- type EndpointConditions
- type EndpointPort
- type EndpointSlice
- type EndpointSliceList
- type EndpointSubset
- type Endpoints
- type EndpointsList
- type Error
- type ExecConfig
- type ExecEnvVar
- type HTTPIngressPath
- type HTTPIngressRuleValue
- type Ingress
- type IngressList
- type IngressRule
- type IngressSpec
- type IngressTLS
- type ListMeta
- type Namespaces
- type Node
- type NodeAddress
- type NodeDaemonEndpoints
- type NodeList
- type NodeSpec
- type NodeStatus
- type ObjectMeta
- type ObjectReference
- type OwnerReference
- type Pod
- type PodCondition
- type PodList
- type PodSpec
- type PodStatus
- type SDConfig
- type ScrapeWorkConstructorFunc
- type Selector
- type Service
- type ServiceList
- type ServicePort
- type ServiceSpec
- type WatchEvent
Constants ¶
This section is empty.
Variables ¶
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://docs.victoriametrics.com/sd_configs/#kubernetes_sd_configs for details")
SDCheckInterval defines interval for targets refresh.
Functions ¶
This section is empty.
Types ¶
type AttachMetadata ¶ added in v1.77.0
type AttachMetadata struct {
Node bool `yaml:"node"`
}
AttachMetadata represents `attach_metadata` option at `kuberentes_sd_config`.
See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config
type AuthInfo ¶ added in v1.78.0
type AuthInfo struct { ClientCertificate string `yaml:"client-certificate,omitempty"` ClientCertificateData string `yaml:"client-certificate-data,omitempty"` ClientKey string `yaml:"client-key,omitempty"` ClientKeyData string `yaml:"client-key-data,omitempty"` // TODO add support for it Exec *ExecConfig `yaml:"exec,omitempty"` Token string `yaml:"token,omitempty"` TokenFile string `yaml:"tokenFile,omitempty"` Impersonate string `yaml:"act-as,omitempty"` ImpersonateUID string `yaml:"act-as-uid,omitempty"` ImpersonateGroups []string `yaml:"act-as-groups,omitempty"` ImpersonateUserExtra []string `yaml:"act-as-user-extra,omitempty"` Username string `yaml:"username,omitempty"` Password string `yaml:"password,omitempty"` }
AuthInfo contains information that describes identity information. This is use to tell the kubernetes cluster who you are.
type Bookmark ¶ added in v1.56.0
type Bookmark struct {
Metadata BookmarkMetadata
}
Bookmark is a bookmark message from Kubernetes Watch API. See https://kubernetes.io/docs/reference/using-api/api-concepts/#watch-bookmarks
type BookmarkMetadata ¶ added in v1.97.7
type BookmarkMetadata struct {
ResourceVersion string
}
BookmarkMetadata is metadata for Bookmark
type Cluster ¶ added in v1.78.0
type Cluster struct { Server string `yaml:"server"` TLSServerName string `yaml:"tls-server-name,omitempty"` InsecureSkipTLSVerify bool `yaml:"insecure-skip-tls-verify,omitempty"` CertificateAuthority string `yaml:"certificate-authority,omitempty"` CertificateAuthorityData string `yaml:"certificate-authority-data,omitempty"` ProxyURL *proxy.URL `yaml:"proxy-url,omitempty"` }
Cluster contains information about how to communicate with a kubernetes cluster
type Config ¶ added in v1.78.0
type Config struct { Kind string `yaml:"kind,omitempty"` APIVersion string `yaml:"apiVersion,omitempty"` Clusters []configCluster `yaml:"clusters"` AuthInfos []authInfo `yaml:"users"` Contexts []configContext `yaml:"contexts"` CurrentContext string `yaml:"current-context"` }
Config represent configuration file for kubernetes API server connection https://github.com/kubernetes/client-go/blob/master/tools/clientcmd/api/v1/types.go#L28
type Container ¶
type Container struct { Name string Image string Ports []ContainerPort RestartPolicy string }
Container implements k8s container.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#container-v1-core
type ContainerPort ¶
ContainerPort implements k8s container port.
type ContainerState ¶ added in v1.97.0
type ContainerState struct {
Terminated *ContainerStateTerminated
}
ContainerState implements k8s container state.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#containerstatus-v1-core
type ContainerStateTerminated ¶ added in v1.97.0
type ContainerStateTerminated struct {
ExitCode int
}
ContainerStateTerminated implements k8s terminated container state.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#containerstatus-v1-core
type ContainerStatus ¶ added in v1.87.0
type ContainerStatus struct { Name string ContainerID string State ContainerState }
ContainerStatus implements k8s container status.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#containerstatus-v1-core
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://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#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.31/#endpointaddress-v1-core
type EndpointConditions ¶ added in v1.41.0
type EndpointConditions struct {
Ready bool
}
EndpointConditions implements kubernetes endpoint condition.
type EndpointPort ¶
EndpointPort implements k8s endpoint port.
type EndpointSlice ¶ added in v1.41.0
type EndpointSlice struct { Metadata ObjectMeta Endpoints []Endpoint AddressType string Ports []EndpointPort }
EndpointSlice - implements kubernetes endpoint slice.
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.
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.31/#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.31/#endpoints-v1-core
type EndpointsList ¶
EndpointsList implements k8s endpoints list.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#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 ExecConfig ¶ added in v1.78.0
type ExecConfig struct { // Command to execute. Command string `json:"command"` // Arguments to pass to the command when executing it. Args []string `json:"args"` // Env defines additional environment variables to expose to the process. These // are unioned with the host's environment, as well as variables client-go uses // to pass argument to the plugin. Env []ExecEnvVar `json:"env"` // Preferred input version of the ExecInfo. The returned ExecCredentials MUST use // the same encoding version as the input. APIVersion string `json:"apiVersion,omitempty"` // This text is shown to the user when the executable doesn't seem to be // present. For example, `brew install foo-cli` might be a good InstallHint for // foo-cli on Mac OS systems. InstallHint string `json:"installHint,omitempty"` // ProvideClusterInfo determines whether or not to provide cluster information, // which could potentially contain very large CA data, to this exec plugin as a // part of the KUBERNETES_EXEC_INFO environment variable. By default, it is set // to false. Package k8s.io/client-go/tools/auth/exec provides helper methods for // reading this environment variable. ProvideClusterInfo bool `json:"provideClusterInfo"` // InteractiveMode determines this plugin's relationship with standard input. Valid // values are "Never" (this exec plugin never uses standard input), "IfAvailable" (this // exec plugin wants to use standard input if it is available), or "Always" (this exec // plugin requires standard input to function). See ExecInteractiveMode values for more // details. // // If APIVersion is client.authentication.k8s.io/v1alpha1 or // client.authentication.k8s.io/v1beta1, then this field is optional and defaults // to "IfAvailable" when unset. Otherwise, this field is required. //+optional InteractiveMode string `json:"interactiveMode,omitempty"` }
ExecConfig contains information about os.command, that returns auth token for kubernetes cluster connection
type ExecEnvVar ¶ added in v1.78.0
ExecEnvVar is used for setting environment variables when executing an exec-based credential plugin.
type HTTPIngressPath ¶
type HTTPIngressPath struct {
Path string
}
HTTPIngressPath represents HTTP ingress path in k8s.
type HTTPIngressRuleValue ¶
type HTTPIngressRuleValue struct {
Paths []HTTPIngressPath
}
HTTPIngressRuleValue represents HTTP ingress rule value in k8s.
type Ingress ¶
type Ingress struct { Metadata ObjectMeta Spec IngressSpec }
Ingress represents ingress in k8s.
type IngressList ¶
IngressList represents ingress list in k8s.
type IngressRule ¶
type IngressRule struct { Host string HTTP HTTPIngressRuleValue `json:"http"` }
IngressRule represents ingress rule in k8s.
type IngressSpec ¶
type IngressSpec struct { TLS []IngressTLS `json:"tls"` Rules []IngressRule IngressClassName string }
IngressSpec represents ingress spec in k8s.
type IngressTLS ¶
type IngressTLS struct {
Hosts []string
}
IngressTLS represents ingress TLS spec in k8s.
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
Namespaces represents namespaces for SDConfig
type Node ¶
type Node struct { Metadata ObjectMeta Status NodeStatus Spec NodeSpec }
Node represents Node from k8s API.
See https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/node-v1/
type NodeAddress ¶
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 ¶
NodeList represents NodeList from k8s API.
See https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/node-v1/#NodeList
type NodeSpec ¶ added in v1.72.0
type NodeSpec struct {
ProviderID string
}
NodeSpec represents NodeSpec from k8s API.
See https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/node-v1/#NodeSpec
type NodeStatus ¶
type NodeStatus struct { Addresses []NodeAddress DaemonEndpoints NodeDaemonEndpoints }
NodeStatus represents NodeStatus from k8s API.
See https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/node-v1/#NodeStatus
type ObjectMeta ¶
type ObjectMeta struct { Name string Namespace string UID string Labels *promutils.Labels Annotations *promutils.Labels OwnerReferences []OwnerReference }
ObjectMeta represents ObjectMeta from k8s API.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#objectmeta-v1-meta
type ObjectReference ¶
ObjectReference implements k8s object reference.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectreference-v1-core
type OwnerReference ¶
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.31/#pod-v1-core
type PodCondition ¶
PodCondition implements k8s pod condition.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#podcondition-v1-core
type PodList ¶
PodList implements k8s pod list.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#podlist-v1-core
type PodSpec ¶
PodSpec implements k8s pod spec.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#podspec-v1-core
type PodStatus ¶
type PodStatus struct { Phase string PodIP string HostIP string Conditions []PodCondition ContainerStatuses []ContainerStatus InitContainerStatuses []ContainerStatus }
PodStatus implements k8s pod status.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#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"` // The filepath to kube config. // If defined any cluster connection information from HTTPClientConfig is ignored. KubeConfigFile string `yaml:"kubeconfig_file,omitempty"` HTTPClientConfig promauth.HTTPClientConfig `yaml:",inline"` ProxyURL *proxy.URL `yaml:"proxy_url,omitempty"` Namespaces Namespaces `yaml:"namespaces,omitempty"` Selectors []Selector `yaml:"selectors,omitempty"` AttachMetadata *AttachMetadata `yaml:"attach_metadata,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
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 ScrapeWork objects from the given metadata.
type ScrapeWorkConstructorFunc ¶ added in v1.55.0
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 ¶
ServiceList is k8s service list.
See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#servicelist-v1-core
type ServicePort ¶
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