triton

package
v0.300.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 17 Imported by: 280

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSDConfig = SDConfig{
	Role:            "container",
	Port:            9163,
	RefreshInterval: model.Duration(60 * time.Second),
	Version:         1,
}

DefaultSDConfig is the default Triton SD configuration.

Functions

This section is empty.

Types

type ComputeNodeDiscoveryResponse

type ComputeNodeDiscoveryResponse struct {
	ComputeNodes []struct {
		ServerUUID     string `json:"server_uuid"`
		ServerHostname string `json:"server_hostname"`
	} `json:"cns"`
}

ComputeNodeDiscoveryResponse models a JSON response from the Triton discovery /gz/ endpoint.

type Discovery

type Discovery struct {
	*refresh.Discovery
	// contains filtered or unexported fields
}

Discovery periodically performs Triton-SD requests. It implements the Discoverer interface.

func New

func New(logger *slog.Logger, conf *SDConfig, metrics discovery.DiscovererMetrics) (*Discovery, error)

New returns a new Discovery which periodically refreshes its targets.

type DiscoveryResponse

type DiscoveryResponse struct {
	Containers []struct {
		Groups      []string `json:"groups"`
		ServerUUID  string   `json:"server_uuid"`
		VMAlias     string   `json:"vm_alias"`
		VMBrand     string   `json:"vm_brand"`
		VMImageUUID string   `json:"vm_image_uuid"`
		VMUUID      string   `json:"vm_uuid"`
	} `json:"containers"`
}

DiscoveryResponse models a JSON response from the Triton discovery.

type SDConfig

type SDConfig struct {
	Account         string           `yaml:"account"`
	Role            string           `yaml:"role"`
	DNSSuffix       string           `yaml:"dns_suffix"`
	Endpoint        string           `yaml:"endpoint"`
	Groups          []string         `yaml:"groups,omitempty"`
	Port            int              `yaml:"port"`
	RefreshInterval model.Duration   `yaml:"refresh_interval,omitempty"`
	TLSConfig       config.TLSConfig `yaml:"tls_config,omitempty"`
	Version         int              `yaml:"version"`
}

SDConfig is the configuration for Triton based 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) NewDiscovererMetrics added in v0.50.0

NewDiscovererMetrics implements discovery.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.

Jump to

Keyboard shortcuts

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