Documentation
¶
Index ¶
- Variables
- func NewDiscovery(conf *SDConfig, logger *slog.Logger, metrics discovery.DiscovererMetrics) (*refresh.Discovery, error)
- type Discovery
- type SDConfig
- func (*SDConfig) Name() string
- func (c *SDConfig) NewDiscoverer(opts discovery.DiscovererOptions) (discovery.Discoverer, error)
- func (*SDConfig) NewDiscovererMetrics(_ prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics
- func (c *SDConfig) SetDirectory(dir string)
- func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Server
- type ServerListResponse
- type ServerNetwork
Constants ¶
This section is empty.
Variables ¶
var DefaultSDConfig = SDConfig{ Region: "eu01", Port: 80, RefreshInterval: model.Duration(60 * time.Second), HTTPClientConfig: config.DefaultHTTPClientConfig, }
DefaultSDConfig is the default STACKIT SD configuration.
Functions ¶
func NewDiscovery ¶
func NewDiscovery(conf *SDConfig, logger *slog.Logger, metrics discovery.DiscovererMetrics) (*refresh.Discovery, error)
NewDiscovery returns a new Discovery which periodically refreshes its targets.
Types ¶
type Discovery ¶
Discovery periodically performs STACKIT API requests. It implements the Discoverer interface.
type SDConfig ¶
type SDConfig struct { HTTPClientConfig config.HTTPClientConfig `yaml:",inline"` Project string `yaml:"project"` RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"` Port int `yaml:"port,omitempty"` Region string `yaml:"region,omitempty"` Endpoint string `yaml:"endpoint,omitempty"` ServiceAccountKey string `yaml:"service_account_key,omitempty"` PrivateKey string `yaml:"private_key,omitempty"` ServiceAccountKeyPath string `yaml:"service_account_key_path,omitempty"` PrivateKeyPath string `yaml:"private_key_path,omitempty"` CredentialsFilePath string `yaml:"credentials_file_path,omitempty"` // contains filtered or unexported fields }
SDConfig is the configuration for STACKIT based service discovery.
func (*SDConfig) NewDiscoverer ¶
func (c *SDConfig) NewDiscoverer(opts discovery.DiscovererOptions) (discovery.Discoverer, error)
NewDiscoverer returns a Discoverer for the Config.
func (*SDConfig) NewDiscovererMetrics ¶
func (*SDConfig) NewDiscovererMetrics(_ prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics
NewDiscovererMetrics implements discovery.Config.
func (*SDConfig) SetDirectory ¶
SetDirectory joins any relative file paths with dir.
func (*SDConfig) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Server ¶
type Server struct { AvailabilityZone string `json:"availabilityZone"` ID string `json:"id"` Labels map[string]interface{} `json:"labels"` MachineType string `json:"machineType"` Name string `json:"name"` Nics []ServerNetwork `json:"nics"` PowerStatus string `json:"powerStatus"` Status string `json:"status"` }
type ServerListResponse ¶
type ServerListResponse struct {
Items *[]Server `json:"items"`
}
ServerListResponse Response object for server list request. https://docs.api.eu01.stackit.cloud/documentation/iaas/version/v1#tag/Servers/operation/v1ListServersInProject
type ServerNetwork ¶
type ServerNetwork struct { NetworkName string `json:"networkName"` IPv4 *string `json:"ipv4,omitempty"` PublicIP *string `json:"publicIp,omitempty"` }
ServerNetwork Describes the object that matches servers to its networks.