discovery

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package discovery publishes the service directory to every node (§8.1, §8.6): stable service VIPs with their backends, and internal DNS records.

Index

Constants

View Source
const Zone = "syncloud.internal"

Zone is the internal DNS zone.

Variables

This section is empty.

Functions

func SearchDomains

func SearchDomains(sv store.Service) []string

SearchDomains let tasks use short names within their environment.

func ServiceName

func ServiceName(sv store.Service) string

ServiceName is a service's DNS name: <service>.<env>.<project>.syncloud.internal.

func VIPAddr

func VIPAddr(i int) netip.Addr

VIPAddr maps a VIP index into 10.92.0.0/16.

Types

type Directory

type Directory interface {
	Directory(ctx context.Context, vip func(index int) string, pool store.IndexPool, cooldown time.Duration) ([]*agentv1.VirtualService, []*agentv1.DNSRecord)
}

Directory contributes VIPs and DNS records from outside services.

type Manager

type Manager struct {

	// Security compiles security groups into the directory (§8.3).
	Security bool
	// Databases adds managed databases' VIPs and names (Phase 12); may be nil.
	Databases Directory
	// contains filtered or unexported fields
}

func NewManager

func NewManager(st *store.Store, gw *agentgw.Gateway, wl *workload.Manager, log *slog.Logger) *Manager

func (*Manager) Backends

func (m *Manager) Backends() map[string]int

Backends returns how many running backends each VIP has, by service ID.

func (*Manager) Build

func (m *Manager) Build(ctx context.Context) (*agentv1.Discovery, map[string]string, error)

Build computes the directory from the database.

func (*Manager) Hooks

func (m *Manager) Hooks() agentgw.Hooks

func (*Manager) Kick

func (m *Manager) Kick()

Kick asks for a rebuild (debounced).

func (*Manager) Records

func (m *Manager) Records() []*agentv1.DNSRecord

Records returns the DNS records last published (§8.1).

func (*Manager) Run

func (m *Manager) Run(ctx context.Context)

Run rebuilds on Kick (at most every 300ms) and every 30s.

func (*Manager) VIP

func (m *Manager) VIP(serviceID string) string

VIP returns a service's virtual IP ("" before the first build).

Jump to

Keyboard shortcuts

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