mesh

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: GPL-3.0, LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package mesh manages the global infrastructure shared across all sind clusters.

Index

Constants

View Source
const (
	NetworkName      docker.NetworkName   = "sind-mesh"
	DNSContainerName docker.ContainerName = "sind-dns"
	SSHContainerName docker.ContainerName = "sind-ssh"
	SSHVolumeName    docker.VolumeName    = "sind-ssh-config"
)

Default-realm resource names. Production code uses Manager methods; these constants are used in tests as expected values for DefaultRealm.

View Source
const DNSImage = "coredns/coredns:latest"

DNSImage is the container image used for the mesh DNS server.

View Source
const DefaultRealm = "sind"

DefaultRealm is the realm name that produces the standard resource names.

View Source
const SSHImage = "ghcr.io/gsi-hpc/sind-node:latest"

SSHImage is the container image used for the SSH relay container. Uses the sind-node image which includes an ssh client and bash.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSRecord

type DNSRecord struct {
	Hostname string
	IP       string
}

DNSRecord represents a single A record in the mesh DNS.

type Manager

type Manager struct {
	Docker  *docker.Client
	Exec    cmdexec.Executor // executor for non-docker system commands (systemctl, resolvectl, etc.)
	Realm   string
	Pull    bool // force fresh image pull (--pull always)
	HostDNS bool // configure host DNS resolution via systemd-resolved
}

Manager handles global infrastructure resources shared across all clusters.

func NewManager

func NewManager(docker *docker.Client, realm string) *Manager

NewManager returns a Manager that operates on global resources through the given docker client. The realm determines resource naming: realm "sind" produces names like "sind-mesh", "sind-dns", etc.

func (*Manager) AddDNSRecord

func (m *Manager) AddDNSRecord(ctx context.Context, hostname, ip string) error

AddDNSRecord adds an A record to the mesh DNS Corefile and reloads CoreDNS. The hostname should be a fully qualified sind DNS name (e.g. "controller.dev.sind.sind").

func (*Manager) AddKnownHost

func (m *Manager) AddKnownHost(ctx context.Context, hostname, hostKey string) error

AddKnownHost appends a host key entry to the known_hosts file in the SSH container. The hostKey should be the full key type and data (e.g. "ssh-ed25519 AAAA...").

func (*Manager) CleanupMesh

func (m *Manager) CleanupMesh(ctx context.Context) error

CleanupMesh removes all global infrastructure resources. This should only be called when the last cluster is deleted.

func (*Manager) ComposeProject

func (m *Manager) ComposeProject() string

ComposeProject returns the Docker Compose project name for this realm's mesh.

func (*Manager) DNSContainerName

func (m *Manager) DNSContainerName() docker.ContainerName

DNSContainerName returns the DNS container name for this realm.

func (*Manager) DNSPolkitAuthorized added in v0.5.0

func (m *Manager) DNSPolkitAuthorized(ctx context.Context) bool

DNSPolkitAuthorized checks if the current process can configure per-link DNS without interactive authentication.

func (*Manager) EnsureDNS

func (m *Manager) EnsureDNS(ctx context.Context) error

EnsureDNS creates the mesh DNS container if it does not already exist. The container runs CoreDNS on the mesh network, serving <realm>.sind records from inline hosts entries in the Corefile.

func (*Manager) EnsureMesh

func (m *Manager) EnsureMesh(ctx context.Context) error

EnsureMesh creates all global infrastructure resources (mesh network, DNS, SSH volume, SSH container) if they do not already exist.

func (*Manager) EnsureMeshNetwork

func (m *Manager) EnsureMeshNetwork(ctx context.Context) error

EnsureMeshNetwork creates the shared mesh network if it does not already exist.

func (*Manager) EnsureSSH

func (m *Manager) EnsureSSH(ctx context.Context) error

EnsureSSH creates the SSH relay container if it does not already exist. The container runs on the mesh network with the SSH volume mounted at /root/.ssh so that ssh automatically discovers the keypair and known_hosts.

func (*Manager) EnsureSSHVolume

func (m *Manager) EnsureSSHVolume(ctx context.Context) error

EnsureSSHVolume creates the SSH config volume and generates an ed25519 keypair if the volume does not already exist. The volume contains id_ed25519 (private key), id_ed25519.pub (public key), and an empty known_hosts file.

func (*Manager) GetDNSRecords

func (m *Manager) GetDNSRecords(ctx context.Context) ([]DNSRecord, error)

GetDNSRecords returns all A records currently served by the mesh DNS.

func (*Manager) NetworkName

func (m *Manager) NetworkName() docker.NetworkName

NetworkName returns the mesh network name for this realm.

func (*Manager) RemoveDNSRecord

func (m *Manager) RemoveDNSRecord(ctx context.Context, hostname string) error

RemoveDNSRecord removes all A records for the given hostname from the mesh DNS Corefile and reloads CoreDNS.

func (*Manager) RemoveKnownHost

func (m *Manager) RemoveKnownHost(ctx context.Context, hostname string) error

RemoveKnownHost removes all entries for the given hostname from the known_hosts file in the SSH container.

func (*Manager) ResolvedActive added in v0.5.0

func (m *Manager) ResolvedActive(ctx context.Context) bool

ResolvedActive checks if systemd-resolved is running.

func (*Manager) SSHContainerName

func (m *Manager) SSHContainerName() docker.ContainerName

SSHContainerName returns the SSH container name for this realm.

func (*Manager) SSHKeygenName

func (m *Manager) SSHKeygenName() docker.ContainerName

SSHKeygenName returns the temporary keygen container name for this realm.

func (*Manager) SSHVolumeName

func (m *Manager) SSHVolumeName() docker.VolumeName

SSHVolumeName returns the SSH volume name for this realm.

Jump to

Keyboard shortcuts

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