Documentation
¶
Index ¶
Constants ¶
const ( // DefaultDNSDir is the directory where DNS config files are stored DefaultDNSDir = "/var/lib/warren/dns" // DefaultResolvConf is the default resolv.conf template filename DefaultResolvConf = "resolv.conf" )
const (
// SecretsBasePath is the base directory for secret tmpfs mounts
SecretsBasePath = "/run/secrets"
)
Variables ¶
This section is empty.
Functions ¶
func EnsureSecretsBaseDir ¶
func EnsureSecretsBaseDir() error
EnsureSecretsBaseDir ensures the base secrets directory exists This should be called during worker initialization
func ExtractManagerIP ¶
ExtractManagerIP extracts the IP address from manager address Examples:
"192.168.1.100:8080" -> "192.168.1.100" "localhost:8080" -> "127.0.0.1" "manager-1:8080" -> "manager-1" (hostname, DNS will resolve)
Types ¶
type Config ¶
type Config struct {
NodeID string
ManagerAddr string
DataDir string
Resources *types.NodeResources
EncryptionKey []byte // Cluster-wide encryption key for secrets
ContainerdSocket string // Containerd socket path (empty = auto-detect)
JoinToken string // Join token for initial authentication
}
Config holds worker configuration
type DNSHandler ¶
type DNSHandler struct {
// contains filtered or unexported fields
}
DNSHandler manages DNS configuration for containers
func NewDNSHandler ¶
func NewDNSHandler(w *Worker, managerAddr string) (*DNSHandler, error)
NewDNSHandler creates a new DNS handler
func (*DNSHandler) Cleanup ¶
func (h *DNSHandler) Cleanup() error
Cleanup removes the DNS configuration directory
func (*DNSHandler) GenerateResolvConf ¶
func (h *DNSHandler) GenerateResolvConf() (string, error)
GenerateResolvConf generates a resolv.conf file for containers This configures containers to use Warren DNS server on the manager
Format:
nameserver <manager-ip> # Warren DNS server nameserver 8.8.8.8 # Google DNS fallback nameserver 1.1.1.1 # Cloudflare DNS fallback search warren # Allow "nginx" instead of "nginx.warren" options ndots:0 # Try search domains immediately
func (*DNSHandler) GetResolvConfPath ¶
func (h *DNSHandler) GetResolvConfPath() (string, error)
GetResolvConfPath returns the path to the generated resolv.conf file If the file doesn't exist, it generates it first
type HealthMonitor ¶
type HealthMonitor struct {
// contains filtered or unexported fields
}
HealthMonitor manages health checks for tasks
func NewHealthMonitor ¶
func NewHealthMonitor(w *Worker) *HealthMonitor
NewHealthMonitor creates a new health monitor
type SecretsHandler ¶
type SecretsHandler struct {
// contains filtered or unexported fields
}
SecretsHandler manages secret mounting for tasks
func NewSecretsHandler ¶
func NewSecretsHandler(worker *Worker, encryptionKey []byte) (*SecretsHandler, error)
NewSecretsHandler creates a new secrets handler
func (*SecretsHandler) CleanupSecretsForTask ¶
func (sh *SecretsHandler) CleanupSecretsForTask(taskID string) error
CleanupSecretsForTask removes all secrets for a task from tmpfs
func (*SecretsHandler) GetSecretPath ¶
func (sh *SecretsHandler) GetSecretPath(taskID, secretName string) string
GetSecretPath returns the path to a specific secret for a task
func (*SecretsHandler) MountSecretsForTask ¶
func (sh *SecretsHandler) MountSecretsForTask(task *types.Task) (string, error)
MountSecretsForTask fetches secrets from manager and mounts them to tmpfs Returns the tmpfs mount path for the container
type VolumesHandler ¶
type VolumesHandler struct {
// contains filtered or unexported fields
}
VolumesHandler manages volume mounting for tasks
func NewVolumesHandler ¶
func NewVolumesHandler(worker *Worker) (*VolumesHandler, error)
NewVolumesHandler creates a new volumes handler
func (*VolumesHandler) CleanupVolumesForTask ¶
func (vh *VolumesHandler) CleanupVolumesForTask(task *types.Task) error
CleanupVolumesForTask unmounts volumes for a task (no-op for local driver)
func (*VolumesHandler) PrepareVolumesForTask ¶
PrepareVolumesForTask prepares all volumes for a task and returns mount specs
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker represents a Warren worker node