kubernetes

package
v0.0.0-...-398e186 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: BSD-3-Clause, Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultSDConfig is the default Kubernetes SD configuration
	DefaultSDConfig = SDConfig{}
)

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 Discovery

type Discovery struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Discovery implements the discoverer interface for discovering targets from Kubernetes.

func New

func New(l log.Logger, conf *SDConfig) (*Discovery, error)

New creates a new Kubernetes discovery for the given role.

func (*Discovery) Run

func (d *Discovery) 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, svc, eps, pod cache.SharedInformer) *Endpoints

NewEndpoints returns a new endpoints discovery.

func (*Endpoints) Run

func (e *Endpoints) Run(ctx context.Context, ch chan<- []*targetgroup.Group)

Run implements the Discoverer interface.

type Ingress

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

Ingress implements discovery of Kubernetes ingresss.

func NewIngress

func NewIngress(l log.Logger, inf cache.SharedInformer) *Ingress

NewIngress returns a new ingress discovery.

func (*Ingress) Run

func (s *Ingress) Run(ctx context.Context, ch chan<- []*targetgroup.Group)

Run implements the Discoverer interface.

type NamespaceDiscovery

type NamespaceDiscovery struct {
	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) *Node

NewNode returns a new node discovery.

func (*Node) Run

func (n *Node) Run(ctx context.Context, ch chan<- []*targetgroup.Group)

Run implements the Discoverer interface.

type Pod

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

Pod discovers new pod targets.

func NewPod

func NewPod(l log.Logger, pods cache.SharedInformer) *Pod

NewPod creates a new pod discovery.

func (*Pod) Run

func (p *Pod) Run(ctx context.Context, ch chan<- []*targetgroup.Group)

Run implements the Discoverer interface.

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"
	RoleIngress  Role = "ingress"
)

The valid options for Role.

func (*Role) UnmarshalYAML

func (c *Role) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type SDConfig

type SDConfig struct {
	APIServer          config_util.URL        `yaml:"api_server"`
	Role               Role                   `yaml:"role"`
	BasicAuth          *config_util.BasicAuth `yaml:"basic_auth,omitempty"`
	BearerToken        config_util.Secret     `yaml:"bearer_token,omitempty"`
	BearerTokenFile    string                 `yaml:"bearer_token_file,omitempty"`
	TLSConfig          config_util.TLSConfig  `yaml:"tls_config,omitempty"`
	NamespaceDiscovery NamespaceDiscovery     `yaml:"namespaces"`
}

SDConfig is the configuration for Kubernetes service discovery.

func (*SDConfig) UnmarshalYAML

func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

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) *Service

NewService returns a new service discovery.

func (*Service) Run

func (s *Service) Run(ctx context.Context, ch chan<- []*targetgroup.Group)

Run implements the Discoverer interface.

Jump to

Keyboard shortcuts

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