k8s

package
v0.1.8-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathSet

type PathSet struct {
	Label   string
	Regexps []*regexp.Regexp
}

PathSet is shorthand structure that maps group of regular expressions with label

type ProviderFile

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

ProviderFile provides static map of services from file

func NewProviderFile

func NewProviderFile(config configuration.SLIExporterConfig) (*ProviderFile, error)

NewProviderFile returns new from-file provider instance

func (*ProviderFile) GetServiceByHost

func (provider *ProviderFile) GetServiceByHost(host string) *Service

GetServiceByHost returns service from inner map by host, if any

func (*ProviderFile) Retrieve

func (provider *ProviderFile) Retrieve() error

Retrieve does nothing in file provider

type ProviderK8SServices

type ProviderK8SServices struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ProviderK8SServices serves to retrieve and provide data about K8S services leveraging K8S Api server through go-client

func NewProviderK8SServices

func NewProviderK8SServices(
	client kubernetes.Interface, config configuration.SLIExporterConfig, logger logging.Logger) *ProviderK8SServices

NewProviderK8SServices is a constructor for ProviderK8SServices

func (*ProviderK8SServices) GetServiceByHost

func (p *ProviderK8SServices) GetServiceByHost(host string) *Service

GetServiceByHost returns service from inner map by host, if any

func (*ProviderK8SServices) Retrieve

func (p *ProviderK8SServices) Retrieve() error

Retrieve retrieves objects from k8s and refreshes inner mapping

type ProviderStub

type ProviderStub struct{}

ProviderStub returns empty provider for test purposes and dry-run launches

func NewProviderStub

func NewProviderStub() *ProviderStub

NewProviderStub is a constructor of ProviderStub

func (*ProviderStub) GetServiceByHost

func (provider *ProviderStub) GetServiceByHost(host string) *Service

GetServiceByHost does nothing in stub

func (*ProviderStub) Retrieve

func (provider *ProviderStub) Retrieve() error

Retrieve does nothing in stub

type Service

type Service struct {
	Name    string
	Enabled bool
	Paths   []PathSet
	Domains []string
}

Service is a structured "service" representation, containing service paths and domains for SLA metrics gathering

func CreateService

func CreateService(config configuration.SLIExporterConfig, annotations map[string]string) (*Service, error)

CreateService tries to construct Service object from annotations dictionary

func (*Service) GetLabelByPath

func (s *Service) GetLabelByPath(path string) string

GetLabelByPath matches path to paths defined by regex group and returns regex group label

type ServicesProvider

type ServicesProvider interface {
	Retrieve() error
	GetServiceByHost(host string) *Service
}

ServicesProvider is an interface that allows to get services for SLA metering

Jump to

Keyboard shortcuts

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