Documentation ¶
Index ¶
- Constants
- Variables
- func GetControllerOf(controllee metav1.Object) *metav1.OwnerReference
- type AttachMetadataConfig
- type Discovery
- type EndpointSlice
- type Endpoints
- type Ingress
- type NamespaceDiscovery
- type Node
- type Pod
- type Role
- type SDConfig
- func (*SDConfig) Name() string
- func (c *SDConfig) NewDiscoverer(opts discovery.DiscovererOptions) (discovery.Discoverer, error)
- func (*SDConfig) NewDiscovererMetrics(reg prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics
- func (c *SDConfig) SetDirectory(dir string)
- func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
- type SelectorConfig
- type Service
Constants ¶
const ( MetricLabelRoleAdd = "add" MetricLabelRoleDelete = "delete" MetricLabelRoleUpdate = "update" )
const (
NodeLegacyHostIP = "LegacyHostIP"
)
Variables ¶
var ( // DefaultSDConfig is the default Kubernetes SD configuration. DefaultSDConfig = SDConfig{ HTTPClientConfig: config.DefaultHTTPClientConfig, } )
Functions ¶
func GetControllerOf ¶
func GetControllerOf(controllee metav1.Object) *metav1.OwnerReference
GetControllerOf returns a pointer to a copy of the controllerRef if controllee has a controller https://github.com/kubernetes/apimachinery/blob/cd2cae2b39fa57e8063fa1f5f13cfe9862db3d41/pkg/apis/meta/v1/controller_ref.go
Types ¶
type AttachMetadataConfig ¶
type AttachMetadataConfig struct {
Node bool `yaml:"node"`
}
AttachMetadataConfig is the configuration for attaching additional metadata coming from nodes on which the targets are scheduled.
type Discovery ¶
Discovery implements the discoverer interface for discovering targets from Kubernetes.
type EndpointSlice ¶
type EndpointSlice struct {
// contains filtered or unexported fields
}
EndpointSlice discovers new endpoint targets.
func NewEndpointSlice ¶
func NewEndpointSlice(l log.Logger, eps cache.SharedIndexInformer, svc, pod, node cache.SharedInformer, eventCount *prometheus.CounterVec) *EndpointSlice
NewEndpointSlice returns a new endpointslice discovery.
func (*EndpointSlice) Run ¶
func (e *EndpointSlice) Run(ctx context.Context, ch chan<- []*targetgroup.Group)
Run implements the Discoverer interface.
type Endpoints ¶
type Endpoints struct {
// contains filtered or unexported fields
}
Endpoints discovers new endpoint targets.
func NewEndpoints ¶
func NewEndpoints(l log.Logger, eps cache.SharedIndexInformer, svc, pod, node cache.SharedInformer, eventCount *prometheus.CounterVec) *Endpoints
NewEndpoints returns a new endpoints discovery.
type Ingress ¶
type Ingress struct {
// contains filtered or unexported fields
}
Ingress implements discovery of Kubernetes ingress.
func NewIngress ¶
func NewIngress(l log.Logger, inf cache.SharedInformer, eventCount *prometheus.CounterVec) *Ingress
NewIngress returns a new ingress discovery.
type NamespaceDiscovery ¶
type NamespaceDiscovery struct { IncludeOwnNamespace bool `yaml:"own_namespace"` Names []string `yaml:"names"` }
NamespaceDiscovery is the configuration for discovering Kubernetes namespaces.
func (*NamespaceDiscovery) UnmarshalYAML ¶
func (c *NamespaceDiscovery) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node discovers Kubernetes nodes.
func NewNode ¶
func NewNode(l log.Logger, inf cache.SharedInformer, eventCount *prometheus.CounterVec) *Node
NewNode returns a new node discovery.
type Pod ¶
type Pod struct {
// contains filtered or unexported fields
}
Pod discovers new pod targets.
func NewPod ¶
func NewPod(l log.Logger, pods cache.SharedIndexInformer, nodes cache.SharedInformer, eventCount *prometheus.CounterVec) *Pod
NewPod creates a new pod discovery.
type Role ¶
type Role string
Role is role of the service in Kubernetes.
const ( RoleNode Role = "node" RolePod Role = "pod" RoleService Role = "service" RoleEndpoint Role = "endpoints" RoleEndpointSlice Role = "endpointslice" RoleIngress Role = "ingress" )
The valid options for Role.
func (*Role) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type SDConfig ¶
type SDConfig struct { APIServer config.URL `yaml:"api_server,omitempty"` Role Role `yaml:"role"` KubeConfig string `yaml:"kubeconfig_file"` HTTPClientConfig config.HTTPClientConfig `yaml:",inline"` NamespaceDiscovery NamespaceDiscovery `yaml:"namespaces,omitempty"` Selectors []SelectorConfig `yaml:"selectors,omitempty"` AttachMetadata AttachMetadataConfig `yaml:"attach_metadata,omitempty"` }
SDConfig is the configuration for Kubernetes service discovery.
func (*SDConfig) NewDiscoverer ¶
func (c *SDConfig) NewDiscoverer(opts discovery.DiscovererOptions) (discovery.Discoverer, error)
NewDiscoverer returns a Discoverer for the Config.
func (*SDConfig) NewDiscovererMetrics ¶ added in v0.50.0
func (*SDConfig) NewDiscovererMetrics(reg prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics
NewDiscovererMetrics implements discovery.Config.
func (*SDConfig) SetDirectory ¶
SetDirectory joins any relative file paths with dir.
func (*SDConfig) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type SelectorConfig ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements discovery of Kubernetes services.
func NewService ¶
func NewService(l log.Logger, inf cache.SharedInformer, eventCount *prometheus.CounterVec) *Service
NewService returns a new service discovery.