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

[helm_resources_manager] use cache instead of a plain client #514

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

miklezzzz
Copy link
Contributor

@miklezzzz miklezzzz commented Oct 17, 2024

Overview

Currently, helm resources manager creates a resources monitor for every enabled module that has a helm release. In its turn, a resource monitor periodically checks whether all the resource of the corresponding helm release are presented in the cluster. These checks are performed by retrieving partial metadata for every object of the release via List operation. The main gist of the PR is to get objects' metadata not from the cluster API directly, but rather from the cache, decreasing amount of List operations and speeding up some of the operations related to helm releases (checking if a helm release should be applied, running periodic checks for absent resources).

What this PR does / why we need it

  • Helm resources manager gets a cache and shares it with resource monitors it creates.
  • The cache has labelSelector filter that should help cache only related objects (objects, deployed by the addon-operator).
  • In order to tell the difference between related and not related objects, a post-renderer was introduced.
  • The post-renderer applies an additional label (heritage=addon-operator by default, yet configurable) to every resource the operator deploys (see helm post-renderer functionality).
  • The post-renderer is supported by both helm3 and helm3lib implementations (with quite noticeable discrepancies in realizations, so using helm3 is discouraged due to operational overhead).

Special notes for your reviewer

@miklezzzz miklezzzz added the enhancement New feature or request label Oct 17, 2024
@miklezzzz miklezzzz self-assigned this Oct 17, 2024
Signed-off-by: Mikhail Scherba <[email protected]>
@miklezzzz miklezzzz changed the title Resource informer with cache [helm_resources_manager] use cache instead of a simple client Oct 17, 2024
@miklezzzz miklezzzz changed the title [helm_resources_manager] use cache instead of a simple client [helm_resources_manager] use cache instead of a plain client Oct 17, 2024
@miklezzzz miklezzzz marked this pull request as ready for review October 17, 2024 15:36
}, nil
}

func (hm *helmResourcesManager) WithCache(ctx context.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is not used anywhere. Why do we need it?

Copy link
Contributor Author

@miklezzzz miklezzzz Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, I forgot to delete it after merging WithKubeClient and WithCache into NewHelmResourcesManager

Signed-off-by: Mikhail Scherba <[email protected]>
Signed-off-by: Mikhail Scherba <[email protected]>
Signed-off-by: Mikhail Scherba <[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.

2 participants