kubernetes: k8s.io/kubernetes/pkg/controller/endpoint Index | Files | Directories

package endpoint

import "k8s.io/kubernetes/pkg/controller/endpoint"

Package endpoint provides EndpointController implementation to manage and sync service endpoints.

Index

Package Files

doc.go endpoints_controller.go trigger_time_tracker.go

Constants

const (

    // An annotation on the Service denoting if the endpoints controller should
    // go ahead and create endpoints for unready pods. This annotation is
    // currently only used by StatefulSets, where we need the pod to be DNS
    // resolvable during initialization and termination. In this situation we
    // create a headless Service just for the StatefulSet, and clients shouldn't
    // be using this Service for anything so unready endpoints don't matter.
    // Endpoints of these Services retain their DNS records and continue
    // receiving traffic for the Service from the moment the kubelet starts all
    // containers in the pod and marks it "Running", till the kubelet stops all
    // containers and deletes the pod from the apiserver.
    // This field is deprecated. v1.Service.PublishNotReadyAddresses will replace it
    // subsequent releases.  It will be removed no sooner than 1.13.
    TolerateUnreadyEndpointsAnnotation = "service.alpha.kubernetes.io/tolerate-unready-endpoints"
)

type EndpointController Uses

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

EndpointController manages selector-based service endpoints.

func NewEndpointController Uses

func NewEndpointController(podInformer coreinformers.PodInformer, serviceInformer coreinformers.ServiceInformer,
    endpointsInformer coreinformers.EndpointsInformer, client clientset.Interface) *EndpointController

NewEndpointController returns a new *EndpointController.

func (*EndpointController) Run Uses

func (e *EndpointController) Run(workers int, stopCh <-chan struct{})

Run will not return until stopCh is closed. workers determines how many endpoints will be handled in parallel.

type TriggerTimeTracker Uses

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

TriggerTimeTracker is a util used to compute the EndpointsLastChangeTriggerTime annotation which is exported in the endpoints controller's sync function. See the documentation of the EndpointsLastChangeTriggerTime annotation for more details.

Please note that this util may compute a wrong EndpointsLastChangeTriggerTime if a same object changes multiple times between two consecutive syncs. We're aware of this limitation but we decided to accept it, as fixing it would require a major rewrite of the endpoints controller and Informer framework. Such situations, i.e. frequent updates of the same object in a single sync period, should be relatively rare and therefore this util should provide a good approximation of the EndpointsLastChangeTriggerTime. TODO(mm4tt): Implement a more robust mechanism that is not subject to the above limitations.

func NewTriggerTimeTracker Uses

func NewTriggerTimeTracker() *TriggerTimeTracker

NewTriggerTimeTracker creates a new instance of the TriggerTimeTracker.

func (*TriggerTimeTracker) ComputeEndpointsLastChangeTriggerTime Uses

func (t *TriggerTimeTracker) ComputeEndpointsLastChangeTriggerTime(
    namespace, name string, service *v1.Service, pods []*v1.Pod) time.Time

ComputeEndpointsLastChangeTriggerTime updates the state of the Endpoints object being synced and returns the time that should be exported as the EndpointsLastChangeTriggerTime annotation.

If the method returns a 'zero' time the EndpointsLastChangeTriggerTime annotation shouldn't be exported.

Please note that this function may compute a wrong EndpointsLastChangeTriggerTime value if the same object (pod/service) changes multiple times between two consecutive syncs.

Important: This method is go-routing safe but only when called for different keys. The method shouldn't be called concurrently for the same key! This contract is fulfilled in the current implementation of the endpoints controller.

func (*TriggerTimeTracker) DeleteEndpoints Uses

func (t *TriggerTimeTracker) DeleteEndpoints(namespace, name string)

DeleteEndpoints deletes endpoints state stored in this util.

Directories

PathSynopsis
config
config/v1alpha1

Package endpoint imports 28 packages (graph) and is imported by 294 packages. Updated 2019-03-23. Refresh now. Tools for package owners.