services

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolver

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

func NewResolver

func NewResolver(client kubernetes.Interface, log logr.Logger) *Resolver

func (*Resolver) AddChangeHandler

func (r *Resolver) AddChangeHandler(h func(namespace, name string))

AddChangeHandler registers a callback invoked whenever the addresses for a Service may have changed. Handlers are registered before Start.

func (*Resolver) HasSynced

func (r *Resolver) HasSynced() bool

HasSynced reports whether both caches have synced.

func (*Resolver) ResolveEndpoint

func (r *Resolver) ResolveEndpoint(namespace, service, hostname string) ([]string, bool)

ResolveEndpoint returns the addresses of the single endpoint of a Service whose DNS hostname is hostname.

Only the endpoint's own addresses are returned, never the ClusterIP: a per-endpoint record resolves to one backend, and adding the ClusterIP would widen the grant to every backend behind it.

func (*Resolver) ResolveService

func (r *Resolver) ResolveService(namespace, name string) ([]string, bool)

ResolveService implements compiler.ServiceResolver.

The result unions the ClusterIP with the ready endpoint addresses because which of them the egress hook sees depends on the client: an ordinary pod is DNATed in the host netns, after the hook has already fired in the pod netns, so the hook sees the ClusterIP; a hostNetwork pod is DNATed in nat/OUTPUT of its own netns before the hook, so the hook sees the backend address. Headless Services have no ClusterIP at all.

func (*Resolver) Start

func (r *Resolver) Start(ctx context.Context) error

Start runs the informers and blocks until ctx is done. It returns an error if the caches do not sync.

Jump to

Keyboard shortcuts

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