Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch number of pods backing a service #38

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

asimpleidea
Copy link
Member

@asimpleidea asimpleidea commented Feb 24, 2021

This PR introduces the feature to watch for the number of pods backing a service by counting the number of Endpoints contained inside a service's EndpointSlices.

Whenever a change is detected, the operator registers the number of pods as a value in the service's metadata to the service registry. The key is configurable.

This depends from #37 and will be rebased once that is merged.

NOTE: This is a work in progress.

Utils contains options to define the behavior of the controllers and
functions used by the controllers.

Signed-off-by: Elis Lulja <[email protected]>
@asimpleidea asimpleidea added the enhancement New feature or request label Feb 24, 2021
@asimpleidea asimpleidea self-assigned this Feb 24, 2021
The namespace controller is now defined with a series of predicates that
will dicatate whether the event should be passed to the namespace
controller or be ignored.

Signed-off-by: Elis Lulja <[email protected]>
The namespace controller reconcile function is updated to reflect
changes in the predicates. As a result, it becomes much slimmer
and simpler.

Signed-off-by: Elis Lulja <[email protected]>
This commit adds predicates to the service controller in the same
fashion as what was done for the namespace controller.
Unit tests included.

Signed-off-by: Elis Lulja <[email protected]>
The service controller's reconcile function has been updated to reflect
the addition of predicates. As a consequence, the reconcile function is
shorter, readable and intuitive, as it now is invoked *only* when there
is actually a need for reconciliation, i.e. no additional parsing is
needed.

Signed-off-by: Elis Lulja <[email protected]>
This commit updates main.go to reflect the changes in the controller.
More precisely, main starts controller utils and sets it up in the
namespace and service controllers.

Signed-off-by: Elis Lulja <[email protected]>
This commit adds the ability to enable the pods counting feature and
choose the annotation key that will be registered in the service's
metadata.

Signed-off-by: Elis Lulja <[email protected]>
baseReconciler is meant to replace controller utils as it includes
common functions and structures and serves as the basis for all
other controllers.

Signed-off-by: Elis Lulja <[email protected]>
The existing reconcilers, Namespace and Service, now inherit methods
and variables from BaseReconcilers.
Main has been updated to reflect such change.

Signed-off-by: Elis Lulja <[email protected]>
This commit adds the EndpointSliceReconciler and makes it inherit
the BaseReconciler.

Signed-off-by: Elis Lulja <[email protected]>
This commit updates the roles with proper permissions to perform
operations on endpointslices on Kubernetes.

Signed-off-by: Elis Lulja <[email protected]>
In this commit the Reconcile function of the endpointslice controller
is implemented and calculates the total number of endpoints for
a service.

Signed-off-by: Elis Lulja <[email protected]>
This commit prevents the endpointsliceReconciler from being started
(actually, inited) if the user didn't enable the feature on settings.
Also, it adds the annotation key in the base reconciler.

Signed-off-by: Elis Lulja <[email protected]>
This commit updates all reconciler' Reconcile function to get and update
the number of pods backing the service on the service registry.

Signed-off-by: Elis Lulja <[email protected]>
A window is implemented, where values are inserted and kept in memory
for a short time before updating service directory values.

Signed-off-by: Elis Lulja <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant