kubernetes

package
v2.30.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeLegacyHostIP = "LegacyHostIP"
)

Variables

View Source
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 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 EndpointSlice

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

EndpointSlice discovers new endpoint targets.

func NewEndpointSlice

func NewEndpointSlice(l log.Logger, svc, eps, pod cache.SharedInformer) *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, 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 ingress.

func NewIngress

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

NewIngress returns a new ingress discovery.

func (*Ingress) Run

func (i *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"
	RoleEndpointSlice Role = "endpointslice"
	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.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"`
}

SDConfig is the configuration for Kubernetes service discovery.

func (*SDConfig) Name

func (*SDConfig) Name() string

Name returns the name of the Config.

func (*SDConfig) NewDiscoverer

func (c *SDConfig) NewDiscoverer(opts discovery.DiscovererOptions) (discovery.Discoverer, error)

NewDiscoverer returns a Discoverer for the Config.

func (*SDConfig) SetDirectory

func (c *SDConfig) SetDirectory(dir string)

SetDirectory joins any relative file paths with dir.

func (*SDConfig) UnmarshalYAML

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

UnmarshalYAML implements the yaml.Unmarshaler interface.

type SelectorConfig

type SelectorConfig struct {
	Role  Role   `yaml:"role,omitempty"`
	Label string `yaml:"label,omitempty"`
	Field string `yaml:"field,omitempty"`
}

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