hostsfile

package
v0.0.0-...-5fb8a3f Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package hostsfile implements a service which owns and writes all node-local files/interfaces used by the system to resolve the local node's name and the names of other nodes in the cluster:

  1. All cluster node names are written into /etc/hosts for DNS resolution.
  2. The local node's name is written into /etc/machine-id.
  3. The local node's name is set as the UNIX hostname of the machine (via the sethostname call).
  4. The local node's ClusterDirectory is updated with the same set of addresses as the one used in /etc/hosts.

The hostsfile Service can start up in two modes: with cluster connectivity and without cluster connectivity. Without cluster connectivity, only information about the current node (as retrieved from the network service) will be used to populate local data. In cluster mode, information about other nodes is also used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterDialer

type ClusterDialer func(ctx context.Context) (*grpc.ClientConn, error)

type Config

type Config struct {
	// Network will be read to retrieve the current status of the Network service.
	Network *network.Service
	// Ephemeral is the root of the ephemeral storage of the node, into which the
	// service will write its managed files.
	Ephemeral *localstorage.EphemeralDirectory
	// ESP is the root of the node's EFI System Partition.
	ESP *localstorage.ESPDirectory
	// NodeID of the node the service is running on.
	NodeID string
	// Curator gRPC client authenticated as local node.
	Curator ipb.CuratorClient
	// ClusterDirectorySaved will be written with a boolean indicating whether the
	// ClusterDirectory has been successfully persisted to the ESP.
	ClusterDirectorySaved event.Value[bool]
}

type Service

type Service struct {
	Config
	// contains filtered or unexported fields
}

Service is the hostsfile service instance. See package-level documentation for more information.

func (*Service) HandleDNS

func (s *Service) HandleDNS(r *netDNS.Request)

HandleDNS serves DNS queries for node IDs.

func (*Service) Run

func (s *Service) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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