discovery

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportConfig

func ExportConfig(services []models.ServiceConfiguration, path string, maskSecrets bool) error

ExportConfig exports service configurations to a file

func GetLabelKey

func GetLabelKey(suffix string) string

GetLabelKey returns the full label key for a given suffix

func ImportConfig

func ImportConfig(path string) ([]models.ServiceConfiguration, error)

ImportConfig imports service configurations from a file

func ValidateService

func ValidateService(service models.ServiceConfiguration) error

ValidateService checks if a discovered service configuration is valid

Types

type ConfigFile

type ConfigFile struct {
	Services map[string][]ServiceConfig `json:"services" yaml:"services"`
}

ConfigFile represents the structure of the external configuration file

type DockerDiscovery

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

DockerDiscovery handles service discovery from Docker labels

func NewDockerDiscovery

func NewDockerDiscovery() (*DockerDiscovery, error)

NewDockerDiscovery creates a new Docker discovery instance

func (*DockerDiscovery) Close

func (d *DockerDiscovery) Close() error

Close closes the Docker client connection

func (*DockerDiscovery) DiscoverServices

func (d *DockerDiscovery) DiscoverServices(ctx context.Context) ([]models.ServiceConfiguration, error)

DiscoverServices finds services configured via Docker labels

type KubernetesDiscovery

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

KubernetesDiscovery handles service discovery from Kubernetes labels

func NewKubernetesDiscovery

func NewKubernetesDiscovery() (*KubernetesDiscovery, error)

NewKubernetesDiscovery creates a new Kubernetes discovery instance

func (*KubernetesDiscovery) Close

func (k *KubernetesDiscovery) Close() error

Close is a no-op for Kubernetes client

func (*KubernetesDiscovery) DiscoverServices

func (k *KubernetesDiscovery) DiscoverServices(ctx context.Context) ([]models.ServiceConfiguration, error)

DiscoverServices finds services configured via Kubernetes labels

type Manager

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

Manager handles multiple service discovery methods

func NewManager

func NewManager() (*Manager, error)

NewManager creates a new discovery manager

func (*Manager) Close

func (m *Manager) Close() error

Close cleans up all discoverers

func (*Manager) DiscoverAll

func (m *Manager) DiscoverAll(ctx context.Context) ([]models.ServiceConfiguration, error)

DiscoverAll finds services using all available discovery methods

type ServiceConfig

type ServiceConfig struct {
	URL         string            `json:"url" yaml:"url"`
	APIKey      string            `json:"apikey" yaml:"apikey"`
	DisplayName string            `json:"name,omitempty" yaml:"name,omitempty"`
	Labels      map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
}

ServiceConfig represents a service configuration in the external file

type ServiceDiscoverer

type ServiceDiscoverer interface {
	// DiscoverServices finds and returns service configurations
	DiscoverServices(ctx context.Context) ([]models.ServiceConfiguration, error)
	// Close cleans up any resources used by the discoverer
	Close() error
}

ServiceDiscoverer defines the interface for service discovery implementations

Jump to

Keyboard shortcuts

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