Documentation ¶
Overview ¶
Package proxy implements the layer-3 network proxy.
Index ¶
- func GetLocalEndpointIPs(endpointsMap EndpointsMap) map[types.NamespacedName]sets.String
- type BaseEndpointInfo
- type BaseServiceInfo
- type Endpoint
- type EndpointChangeTracker
- type EndpointsMap
- type ProxyProvider
- type ServiceChangeTracker
- type ServiceEndpoint
- type ServiceMap
- type ServicePort
- type ServicePortName
- type UpdateEndpointMapResult
- type UpdateServiceMapResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalEndpointIPs ¶ added in v1.10.0
func GetLocalEndpointIPs(endpointsMap EndpointsMap) map[types.NamespacedName]sets.String
GetLocalEndpointIPs returns endpoints IPs if given endpoint is local - local means the endpoint is running in same host as kube-proxy.
Types ¶
type BaseEndpointInfo ¶ added in v1.10.0
type BaseEndpointInfo struct { Endpoint string // TODO: should be an endpointString type // IsLocal indicates whether the endpoint is running in same host as kube-proxy. IsLocal bool }
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 ¶ added in v1.10.0
func (info *BaseEndpointInfo) Equal(other Endpoint) bool
Equal is part of proxy.Endpoint interface.
func (*BaseEndpointInfo) GetIsLocal ¶ added in v1.10.0
func (info *BaseEndpointInfo) GetIsLocal() bool
GetIsLocal is part of proxy.Endpoint interface.
func (*BaseEndpointInfo) IP ¶ added in v1.10.0
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 ¶ added in v1.10.0
func (info *BaseEndpointInfo) Port() (int, error)
Port returns just the Port part of the endpoint.
func (*BaseEndpointInfo) String ¶ added in v1.10.0
func (info *BaseEndpointInfo) String() string
String is part of proxy.Endpoint interface.
type BaseServiceInfo ¶ added in v1.10.0
type BaseServiceInfo struct { ClusterIP net.IP Port int Protocol v1.Protocol NodePort int LoadBalancerStatus v1.LoadBalancerStatus SessionAffinityType v1.ServiceAffinity StickyMaxAgeSeconds int ExternalIPs []string LoadBalancerSourceRanges []string HealthCheckNodePort int OnlyNodeLocalEndpoints bool }
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) ClusterIPString ¶ added in v1.10.0
func (info *BaseServiceInfo) ClusterIPString() string
ClusterIPString is part of ServicePort interface.
func (*BaseServiceInfo) GetHealthCheckNodePort ¶ added in v1.10.0
func (info *BaseServiceInfo) GetHealthCheckNodePort() int
GetHealthCheckNodePort is part of ServicePort interface.
func (*BaseServiceInfo) GetNodePort ¶ added in v1.14.0
func (info *BaseServiceInfo) GetNodePort() int
GetNodePort is part of the ServicePort interface.
func (*BaseServiceInfo) GetProtocol ¶ added in v1.10.0
func (info *BaseServiceInfo) GetProtocol() v1.Protocol
GetProtocol is part of ServicePort interface.
func (*BaseServiceInfo) String ¶ added in v1.10.0
func (info *BaseServiceInfo) String() string
String is part of ServicePort interface.
type Endpoint ¶ added in v1.10.0
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 // 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.
type EndpointChangeTracker ¶ added in v1.10.0
type EndpointChangeTracker struct {
// contains filtered or unexported fields
}
EndpointChangeTracker carries state about uncommitted changes to an arbitrary number of Endpoints, keyed by their namespace and name.
func NewEndpointChangeTracker ¶ added in v1.10.0
func NewEndpointChangeTracker(hostname string, makeEndpointInfo makeEndpointFunc, isIPv6Mode *bool, recorder record.EventRecorder) *EndpointChangeTracker
NewEndpointChangeTracker initializes an EndpointsChangeMap
func (*EndpointChangeTracker) Update ¶ added in v1.10.0
func (ect *EndpointChangeTracker) Update(previous, current *v1.Endpoints) bool
Update updates given service's endpoints change map based on the <previous, current> endpoints pair. It returns true if items changed, otherwise return false. Update can be used to add/update/delete items of EndpointsChangeMap. For example, Add item
- pass <nil, endpoints> as the <previous, current> pair.
Update item
- pass <oldEndpoints, endpoints> as the <previous, current> pair.
Delete item
- pass <endpoints, nil> as the <previous, current> pair.
type EndpointsMap ¶ added in v1.10.0
type EndpointsMap map[ServicePortName][]Endpoint
EndpointsMap maps a service name to a list of all its Endpoints.
func (EndpointsMap) Merge ¶ added in v1.10.0
func (em EndpointsMap) Merge(other EndpointsMap)
Merge ensures that the current EndpointsMap contains all <service, endpoints> pairs from the EndpointsMap passed in.
func (EndpointsMap) Unmerge ¶ added in v1.10.0
func (em EndpointsMap) Unmerge(other EndpointsMap)
Unmerge removes the <service, endpoints> pairs from the current EndpointsMap which are contained in the EndpointsMap passed in.
type ProxyProvider ¶ added in v1.1.0
type ProxyProvider interface { // Sync immediately synchronizes the ProxyProvider's current state to proxy rules. Sync() // SyncLoop runs periodic work. // This is expected to run as a goroutine or as the main loop of the app. // It does not return. SyncLoop() }
ProxyProvider is the interface provided by proxier implementations.
type ServiceChangeTracker ¶ added in v1.10.0
type ServiceChangeTracker struct {
// contains filtered or unexported fields
}
ServiceChangeTracker carries state about uncommitted changes to an arbitrary number of Services, keyed by their namespace and name.
func NewServiceChangeTracker ¶ added in v1.10.0
func NewServiceChangeTracker(makeServiceInfo makeServicePortFunc, isIPv6Mode *bool, recorder record.EventRecorder) *ServiceChangeTracker
NewServiceChangeTracker initializes a ServiceChangeTracker
func (*ServiceChangeTracker) Update ¶ added in v1.10.0
func (sct *ServiceChangeTracker) Update(previous, current *v1.Service) bool
Update updates given service's change map based on the <previous, current> service pair. It returns true if items changed, otherwise return false. Update can be used to add/update/delete items of ServiceChangeMap. For example, Add item
- pass <nil, service> as the <previous, current> pair.
Update item
- pass <oldService, service> as the <previous, current> pair.
Delete item
- pass <service, nil> as the <previous, current> pair.
type ServiceEndpoint ¶ added in v1.10.0
type ServiceEndpoint struct { Endpoint string ServicePortName ServicePortName }
ServiceEndpoint is used to identify a service and one of its endpoint pair.
type ServiceMap ¶ added in v1.10.0
type ServiceMap map[ServicePortName]ServicePort
ServiceMap maps a service to its ServicePort.
type ServicePort ¶ added in v1.10.0
type ServicePort interface { // String returns service string. An example format can be: `IP:Port/Protocol`. String() string // ClusterIPString returns service cluster IP in string format. ClusterIPString() string // GetProtocol returns service protocol. GetProtocol() v1.Protocol // GetHealthCheckNodePort returns service health check node port if present. If return 0, it means not present. GetHealthCheckNodePort() int // GetNodePort returns a service Node port if present. If return 0, it means not present. GetNodePort() int }
ServicePort is an interface which abstracts information about a service.
type ServicePortName ¶ added in v0.15.0
type ServicePortName struct { types.NamespacedName Port string }
ServicePortName carries a namespace + name + portname. This is the unique identifier for a load-balanced service.
func (ServicePortName) String ¶ added in v0.15.0
func (spn ServicePortName) String() string
type UpdateEndpointMapResult ¶ added in v1.10.0
type UpdateEndpointMapResult struct { // HCEndpointsLocalIPSize maps an endpoints name to the length of its local IPs. HCEndpointsLocalIPSize map[types.NamespacedName]int // StaleEndpoints identifies if an endpoints service pair is stale. StaleEndpoints []ServiceEndpoint // StaleServiceNames identifies if a service is stale. StaleServiceNames []ServicePortName }
UpdateEndpointMapResult is the updated results after applying endpoints changes.
func UpdateEndpointsMap ¶ added in v1.10.0
func UpdateEndpointsMap(endpointsMap EndpointsMap, changes *EndpointChangeTracker) (result UpdateEndpointMapResult)
UpdateEndpointsMap updates endpointsMap base on the given changes.
type UpdateServiceMapResult ¶ added in v1.10.0
type UpdateServiceMapResult struct { // HCServiceNodePorts is a map of Service names to node port numbers which indicate the health of that Service on this Node. // The value(uint16) of HCServices map is the service health check node port. HCServiceNodePorts map[types.NamespacedName]uint16 // UDPStaleClusterIP holds stale (no longer assigned to a Service) Service IPs that had UDP ports. // Callers can use this to abort timeout-waits or clear connection-tracking information. UDPStaleClusterIP sets.String }
UpdateServiceMapResult is the updated results after applying service changes.
func UpdateServiceMap ¶ added in v1.10.0
func UpdateServiceMap(serviceMap ServiceMap, changes *ServiceChangeTracker) (result UpdateServiceMapResult)
UpdateServiceMap updates ServiceMap based on the given changes.
Directories ¶
Path | Synopsis |
---|---|
apis
|
|
Package config provides decoupling between various configuration sources (etcd, files,...) and the pieces that actually care about them (loadbalancer, proxy).
|
Package config provides decoupling between various configuration sources (etcd, files,...) and the pieces that actually care about them (loadbalancer, proxy). |
Package healthcheck provides tools for serving kube-proxy healthchecks.
|
Package healthcheck provides tools for serving kube-proxy healthchecks. |