service

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package service provides authoritative service DNS and readiness-selected endpoint control.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildClusterSnapshot

func BuildClusterSnapshot(cluster string, generation, revision uint64, leader string, peers []Peer) (*api.Snapshot, error)

BuildClusterSnapshot merges NodeGroup contracts and matching leased node states.

func ValidateContract

func ValidateContract(cluster, nodeGroup, digest string, services []*api.Service) error

ValidateContract validates a Hello's deterministic NodeGroup-owned Service identities and ports.

func ValidateNodeState

func ValidateNodeState(nodeGroup string, contract []*api.Service, state *api.NodeState) error

ValidateNodeState rejects endpoints that do not exactly match the sending NodeGroup contract.

func ValidateSnapshotOwnership

func ValidateSnapshotOwnership(snapshot *api.Snapshot) error

ValidateSnapshotOwnership rejects duplicate cluster-wide Service identities.

Types

type Controller

type Controller struct {
	Cluster, NodeGroup string
	NodeIPv6           netip.Addr
	DNS                *Server
	Dataplane          Dataplane
	// contains filtered or unexported fields
}

Controller combines desired Services with ready selected local Pods.

func NewController

func NewController(cluster, nodeGroup string, nodeIPv6 netip.Addr, dns *Server, plane Dataplane) *Controller

NewController constructs an initially healthy empty controller.

func (*Controller) Apply

func (c *Controller) Apply(ctx context.Context, snapshot *api.Snapshot) error

Apply converts and applies one complete DNS and dataplane snapshot.

func (*Controller) BuildSnapshot

func (c *Controller) BuildSnapshot(generation, revision uint64, leader string, nodes []*api.NodeState) *api.Snapshot

BuildSnapshot merges only node states matching the current desired digest.

func (*Controller) Contract

func (c *Controller) Contract() []*api.Service

Contract returns the complete local service contract without leased backends.

func (*Controller) Digest

func (c *Controller) Digest() string

Digest returns a deterministic SHA-512 desired configuration digest.

func (*Controller) Healthy

func (c *Controller) Healthy() bool

Healthy reports whether the last required dataplane application succeeded.

func (*Controller) NodeState

func (c *Controller) NodeState(session string, sequence uint64) *api.NodeState

NodeState creates a complete ready-selected local endpoint view.

func (*Controller) SetPods

func (c *Controller) SetPods(value pods.Snapshot)

SetPods replaces the complete local pod view.

func (*Controller) SetServices

func (c *Controller) SetServices(value []manifest.Service)

SetServices replaces desired service configuration.

func (*Controller) Subscribe

func (c *Controller) Subscribe() (<-chan struct{}, func())

Subscribe returns an independent coalescing state-change channel and cleanup callback.

func (*Controller) ValidateNodeState

func (c *Controller) ValidateNodeState(state *api.NodeState) error

ValidateNodeState rejects endpoints that do not exactly match current Service contracts.

type Dataplane

type Dataplane interface {
	Reconcile(context.Context, dataplane.Snapshot) error
}

Dataplane is the complete-snapshot dataplane contract.

type Peer

type Peer struct {
	Hello *api.Hello
	State *api.NodeState
}

Peer is one validated Hello contract and its optional leased endpoint state.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server serves authoritative deployment IPv6 records from a replaceable snapshot.

func NewServer

func NewServer() *Server

NewServer constructs an empty authoritative Kubernetes Service DNS handler.

func (*Server) Replace

func (d *Server) Replace(endpoints map[string][]net.IP)

Replace atomically stores an owned copy of all known full deployment names.

func (*Server) ServeDNS

func (d *Server) ServeDNS(writer dns.ResponseWriter, request *dns.Msg)

ServeDNS answers AAAA queries and expands Service and Service.namespace short forms.

Jump to

Keyboard shortcuts

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