Get the App
SLTechnology News&Howtos  ›  Servers  › 

Source code parsing of Kubernetes Endpoints Controller

Shulou Source: shulou.com Published: 2022-06-01 12:52:41 10月25日 Update

This article introduces the "Kubernetes Endpoints Controller source code analysis" related knowledge, in the actual case operation process, many people will encounter such a dilemma, and then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!

Configuration items related to Endpoints Controller

Concurrent-endpoint-syncs int32 Default: 5 The number of endpoint syncing operations that will be done concurrently. Larger number = faster endpoint updating, but more CPU (and network) load.

Leader-elect-resource-lock endpoints Default: "endpoints" The type of resource object that is used for locking during leader election. Supported options are endpoints (default) and configmaps.

GVK of Endpoints Controller Watch

Core/V1/Pods

Core/V1/Services

Core/V1/Endpoints

Endpoints Controller Event Handler

Add Service Event-- > enqueueService

Update Service Event-- > enqueueService (new)

Delete Service Event-- > enqueueService

Add Pod Event-- > addPod

Update Pod Event-- > updatePod

Delete Pod Event-- > deletePod

Add/Update/Delete Endpoints Event-- > nil

Run Endpoints Controller

Start two types of go protocols:

The number of cooperators is-- concurrent-endpoint-syncs configuration value (default 5). Each worker is responsible for syncService synchronization from pop service in service queue. After completing a sync, wait 1 s and then pop a service from service queue for sync, and so on.

The other type of co-program has only one co-program, which is responsible for checkLeftoverEndpoints and is executed only once when it is started.

/ / Run will not return until stopCh is closed. Workers determines how many// endpoints will be handled in parallel.func (e * EndpointController) Run (workers int, stopCh)

Tags: Processing situation content method source code that is logic check fiction and then only difference more core process knowledge components queues synchronization work Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MySQL Xiaomi Microsoft Docker