Skip to content

[chore][k8sattributesprocessor] Start informers in the provider function #39301

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

swiatekm
Copy link
Contributor

Description

We'd like instances of the k8sattributes processor to share local K8s resource caches (represented by the informer concept from client-go). See #36234 for the justification and a broad overview. This change is the first in a series of refactors necessary to make this possible.

In order to share informers, the processor cannot be responsible for starting them. This PR moves that logic to informer provider functions. Informers are still stopped by closing a channel provided at construction.

The processor also makes no assumptions about whether the informers will keep running after Stop is called. As a result, it needs to explicitly track its own event handler registration, and unregister in an orderly matter when stopping.

See #36604 for all the refactoring changes put together. I've split this PR out to make review easier.

Link to tracking issue

Part of #36234
Split out from #36604

Testing

Modified existing tests.

@github-actions github-actions bot added the processor/k8sattributes k8s Attributes processor label Apr 10, 2025
@swiatekm swiatekm force-pushed the chore/k8sattributes/refactor-informer-start branch 2 times, most recently from 0bbecfc to 278adbc Compare April 10, 2025 15:28
@swiatekm swiatekm changed the title [k8sattributesprocessor] Start informers in the provider function [chore][k8sattributesprocessor] Start informers in the provider function Apr 11, 2025
@swiatekm swiatekm force-pushed the chore/k8sattributes/refactor-informer-start branch from 278adbc to 722c85f Compare April 11, 2025 14:30
@atoulme
Copy link
Contributor

atoulme commented Apr 14, 2025

Please address conflict

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Apr 30, 2025
@swiatekm swiatekm force-pushed the chore/k8sattributes/refactor-informer-start branch 2 times, most recently from 8cea4e9 to 5519c24 Compare May 9, 2025 12:32
@swiatekm swiatekm requested a review from ChrsMark May 9, 2025 12:34
@github-actions github-actions bot removed the Stale label May 10, 2025
@swiatekm swiatekm force-pushed the chore/k8sattributes/refactor-informer-start branch from 5519c24 to ee9242c Compare May 18, 2025 18:01
@swiatekm swiatekm force-pushed the chore/k8sattributes/refactor-informer-start branch from ee9242c to 8daf5d5 Compare May 30, 2025 12:45
@swiatekm swiatekm force-pushed the chore/k8sattributes/refactor-informer-start branch from 8daf5d5 to a9d7c90 Compare June 11, 2025 10:39
@swiatekm swiatekm force-pushed the chore/k8sattributes/refactor-informer-start branch from a9d7c90 to 4564ab8 Compare June 11, 2025 11:19
Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

The change LGTM. I think we can proceed with this one to unblock the follow-ups coming.

@dmitryax @TylerHelmuth @fatsheep9146 please take a look

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
processor/k8sattributes k8s Attributes processor Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants