Documentation
¶
Index ¶
- type Resolver
- func (r *Resolver) AddChangeHandler(h func(namespace, name string))
- func (r *Resolver) HasSynced() bool
- func (r *Resolver) ResolveEndpoint(namespace, service, hostname string) ([]string, bool)
- func (r *Resolver) ResolveService(namespace, name string) ([]string, bool)
- func (r *Resolver) Start(ctx context.Context) error
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 ¶
AddChangeHandler registers a callback invoked whenever the addresses for a Service may have changed. Handlers are registered before Start.
func (*Resolver) ResolveEndpoint ¶
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 ¶
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.