Documentation ¶
Index ¶
- func BootstrapRules(p Proxy, inHost, inPort string, extEndpoint *url.URL, endpointSlice bool) error
- type BaseEndpointInfo
- func (info *BaseEndpointInfo) Equal(other Endpoint) bool
- func (info *BaseEndpointInfo) GetIsLocal() bool
- func (info *BaseEndpointInfo) GetTopology() map[string]string
- func (info *BaseEndpointInfo) IP() string
- func (info *BaseEndpointInfo) Port() (int, error)
- func (info *BaseEndpointInfo) String() string
- type BaseServiceInfo
- func (info *BaseServiceInfo) ClusterIP() net.IP
- func (info *BaseServiceInfo) ExternalIPStrings() []string
- func (info *BaseServiceInfo) HealthCheckNodePort() int
- func (info *BaseServiceInfo) LoadBalancerIPStrings() []string
- func (info *BaseServiceInfo) LoadBalancerSourceRanges() []string
- func (info *BaseServiceInfo) NodePort() int
- func (info *BaseServiceInfo) OnlyNodeLocalEndpoints() bool
- func (info *BaseServiceInfo) Port() int
- func (info *BaseServiceInfo) Protocol() v1.Protocol
- func (info *BaseServiceInfo) SessionAffinityType() v1.ServiceAffinity
- func (info *BaseServiceInfo) StickyMaxAgeSeconds() int
- func (info *BaseServiceInfo) String() string
- func (info *BaseServiceInfo) TopologyKeys() []string
- type Endpoint
- type EndpointsMap
- type Proxy
- type ServiceEndpoint
- type ServiceMap
- type ServicePort
- type ServicePortName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseEndpointInfo ¶
type BaseEndpointInfo struct { IPFamily v1.IPFamily Endpoint string // TODO: should be an endpointString type // IsLocal indicates whether the endpoint is running in same host as kube-proxy. IsLocal bool Topology map[string]string // contains filtered or unexported fields }
BaseEndpointInfo contains base information that defines an endpoint. This could be used directly by proxier while processing endpoints, or can be used for constructing a more specific EndpointInfo struct defined by the proxier if needed.
func (*BaseEndpointInfo) Equal ¶
func (info *BaseEndpointInfo) Equal(other Endpoint) bool
Equal is part of proxy.Endpoint interface.
func (*BaseEndpointInfo) GetIsLocal ¶
func (info *BaseEndpointInfo) GetIsLocal() bool
GetIsLocal is part of proxy.Endpoint interface.
func (*BaseEndpointInfo) GetTopology ¶
func (info *BaseEndpointInfo) GetTopology() map[string]string
GetTopology returns the topology information of the endpoint.
func (*BaseEndpointInfo) IP ¶
func (info *BaseEndpointInfo) IP() string
IP returns just the IP part of the endpoint, it's a part of proxy.Endpoint interface.
func (*BaseEndpointInfo) Port ¶
func (info *BaseEndpointInfo) Port() (int, error)
Port returns just the Port part of the endpoint.
func (*BaseEndpointInfo) String ¶
func (info *BaseEndpointInfo) String() string
String is part of proxy.Endpoint interface.
type BaseServiceInfo ¶
type BaseServiceInfo struct {
// contains filtered or unexported fields
}
BaseServiceInfo contains base information that defines a service. This could be used directly by proxier while processing services, or can be used for constructing a more specific ServiceInfo struct defined by the proxier if needed.
func (*BaseServiceInfo) ClusterIP ¶
func (info *BaseServiceInfo) ClusterIP() net.IP
ClusterIP is part of ServicePort interface.
func (*BaseServiceInfo) ExternalIPStrings ¶
func (info *BaseServiceInfo) ExternalIPStrings() []string
ExternalIPStrings is part of ServicePort interface.
func (*BaseServiceInfo) HealthCheckNodePort ¶
func (info *BaseServiceInfo) HealthCheckNodePort() int
HealthCheckNodePort is part of ServicePort interface.
func (*BaseServiceInfo) LoadBalancerIPStrings ¶
func (info *BaseServiceInfo) LoadBalancerIPStrings() []string
LoadBalancerIPStrings is part of ServicePort interface.
func (*BaseServiceInfo) LoadBalancerSourceRanges ¶
func (info *BaseServiceInfo) LoadBalancerSourceRanges() []string
LoadBalancerSourceRanges is part of ServicePort interface
func (*BaseServiceInfo) NodePort ¶
func (info *BaseServiceInfo) NodePort() int
NodePort is part of the ServicePort interface.
func (*BaseServiceInfo) OnlyNodeLocalEndpoints ¶
func (info *BaseServiceInfo) OnlyNodeLocalEndpoints() bool
OnlyNodeLocalEndpoints is part of ServicePort interface.
func (*BaseServiceInfo) Port ¶
func (info *BaseServiceInfo) Port() int
Port is part of ServicePort interface.
func (*BaseServiceInfo) Protocol ¶
func (info *BaseServiceInfo) Protocol() v1.Protocol
Protocol is part of ServicePort interface.
func (*BaseServiceInfo) SessionAffinityType ¶
func (info *BaseServiceInfo) SessionAffinityType() v1.ServiceAffinity
SessionAffinityType is part of the ServicePort interface.
func (*BaseServiceInfo) StickyMaxAgeSeconds ¶
func (info *BaseServiceInfo) StickyMaxAgeSeconds() int
StickyMaxAgeSeconds is part of the ServicePort interface
func (*BaseServiceInfo) String ¶
func (info *BaseServiceInfo) String() string
String is part of ServicePort interface.
func (*BaseServiceInfo) TopologyKeys ¶
func (info *BaseServiceInfo) TopologyKeys() []string
TopologyKeys is part of ServicePort interface.
type Endpoint ¶
type Endpoint interface { // String returns endpoint string. An example format can be: `IP:Port`. // We take the returned value as ServiceEndpoint.Endpoint. String() string // GetIsLocal returns true if the endpoint is running in same host as kube-proxy, otherwise returns false. GetIsLocal() bool // GetTopology returns the topology information of the endpoint. GetTopology() map[string]string // IP returns IP part of the endpoint. IP() string // Port returns the Port part of the endpoint. Port() (int, error) // Equal checks if two endpoints are equal. Equal(Endpoint) bool }
Endpoint in an interface which abstracts information about an endpoint. TODO: Rename functions to be consistent with ServicePort.
func FilterTopologyEndpoint ¶
func FilterTopologyEndpoint(nodeLabels map[string]string, topologyKeys []string, endpoints []Endpoint) []Endpoint
FilterTopologyEndpoint returns the appropriate endpoints based on the cluster topology. This uses the current node's labels, which contain topology information, and the required topologyKeys to find appropriate endpoints. If both the endpoint's topology and the current node have matching values for topologyKeys[0], the endpoint will be chosen. If no endpoints are chosen, toplogyKeys[1] will be considered, and so on. If either the node or the endpoint do not have values for a key, it is considered to not match.
If topologyKeys is specified, but no endpoints are chosen for any key, the the service has no viable endpoints for clients on this node, and connections should fail.
The special key "*" may be used as the last entry in topologyKeys to indicate "any endpoint" is acceptable.
If topologyKeys is not specified or empty, no topology constraints will be applied and this will return all endpoints.
type EndpointsMap ¶
type EndpointsMap map[ServicePortName][]Endpoint
EndpointsMap maps a service name to a list of all its Endpoints.
type Proxy ¶
type Proxy interface { AddService(svc *v1.Service) DeleteService(svc *v1.Service) UpdateService(svcOld, svcNew *v1.Service) AddEndpoints(ep *v1.Endpoints) DeleteEndpoints(ep *v1.Endpoints) UpdateEndpoints(epOld, epNew *v1.Endpoints) AddEndpointSlice(epsl *discovery.EndpointSlice) DeleteEndpointSlice(epsl *discovery.EndpointSlice) UpdateEndpointSlice(epslOld, epslNew *discovery.EndpointSlice) }
Proxy defines interface
func NewProxy ¶
func NewProxy(nfti *nftables.NFTInterface, hostname string, recorder record.EventRecorder, endpointSlice bool) Proxy
NewProxy return a new instance of nfproxy
type ServiceEndpoint ¶
type ServiceEndpoint struct { Endpoint string ServicePortName ServicePortName }
ServiceEndpoint is used to identify a service and one of its endpoint pair.
type ServiceMap ¶
type ServiceMap map[ServicePortName]ServicePort
ServiceMap maps a service to its ServicePort.
type ServicePort ¶
type ServicePort interface { // String returns service string. An example format can be: `IP:Port/Protocol`. String() string // GetClusterIP returns service cluster IP in net.IP format. ClusterIP() net.IP // GetPort returns service port if present. If return 0 means not present. Port() int // GetSessionAffinityType returns service session affinity type SessionAffinityType() v1.ServiceAffinity // GetStickyMaxAgeSeconds returns service max connection age StickyMaxAgeSeconds() int // ExternalIPStrings returns service ExternalIPs as a string array. ExternalIPStrings() []string // LoadBalancerIPStrings returns service LoadBalancerIPs as a string array. LoadBalancerIPStrings() []string // GetProtocol returns service protocol. Protocol() v1.Protocol // LoadBalancerSourceRanges returns service LoadBalancerSourceRanges if present empty array if not LoadBalancerSourceRanges() []string // GetHealthCheckNodePort returns service health check node port if present. If return 0, it means not present. HealthCheckNodePort() int // GetNodePort returns a service Node port if present. If return 0, it means not present. NodePort() int // GetOnlyNodeLocalEndpoints returns if a service has only node local endpoints OnlyNodeLocalEndpoints() bool // TopologyKeys returns service TopologyKeys as a string array. TopologyKeys() []string }
ServicePort is an interface which abstracts information about a service.
type ServicePortName ¶
type ServicePortName struct { types.NamespacedName Port string Protocol v1.Protocol }
ServicePortName carries a namespace + name + portname. This is the unique identifier for a load-balanced service.
func (ServicePortName) String ¶
func (spn ServicePortName) String() string