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

[chore] Use informer to track collector Pods in target allocator #2528

Merged

Conversation

swiatekm
Copy link
Contributor

@swiatekm swiatekm commented Jan 17, 2024

Use an informer for tracking collector Pods in the target allocator, instead of the custom active watcher we've had till now. This is just to make things more standardized and maintainable. I've also implemented a rate limiter on collector updates while at it.

This will make it easier to fix #2201 in a follow-up.

Most likely fixes #2916.

@swiatekm swiatekm force-pushed the chore/ta-collector-informer branch from 80c7dc9 to 4fd8431 Compare April 30, 2024 16:02
@swiatekm swiatekm marked this pull request as ready for review April 30, 2024 16:23
@swiatekm swiatekm requested a review from a team April 30, 2024 16:23
// runOnCollectors runs the provided function on the set of collectors from the Store.
func (k *CollectorWatcher) runOnCollectors(store cache.Store, fn func(collectors map[string]*allocation.Collector)) {
collectorMap := map[string]*allocation.Collector{}
objects := store.List()
Copy link
Contributor

Choose a reason for hiding this comment

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

to confirm my understanding: calling this store.List will only return all active collector pods right? Anything deleted will not be present?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will return all existing Collector Pods, not just active ones. Below, we also filter it down to scheduled ones by requiring that NodeName be present. We do not check for readiness here - I'd like to do that in a follow up. This behaviour is exactly what we currently have.

objects := store.List()
for _, obj := range objects {
pod := obj.(*v1.Pod)
if pod.Spec.NodeName == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

this technically is a functionality change as we will no longer fully restart the watch if this happens, but that's a good thing in my book

@jaronoff97 jaronoff97 merged commit fbbca3d into open-telemetry:main May 1, 2024
31 checks passed
@swiatekm swiatekm deleted the chore/ta-collector-informer branch May 1, 2024 14:48
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
…n-telemetry#2528)

* Use informer to track collector Pods in target allocator

* Rename CollectorWatcher to Watcher
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
…n-telemetry#2528)

* Use informer to track collector Pods in target allocator

* Rename CollectorWatcher to Watcher
@diranged
Copy link

diranged commented May 6, 2024

When do we think a release can be made with this patch?

@jaronoff97
Copy link
Contributor

@diranged we're waiting on the release from the collector to go through, and then we'll begin our release process. We do have some blocking work in the helm chart, however, that is preventing our 0.99.0 release from going out. You will still be able to use the images though :)

rubenvp8510 pushed a commit to rubenvp8510/opentelemetry-operator that referenced this pull request May 7, 2024
…n-telemetry#2528)

* Use informer to track collector Pods in target allocator

* Rename CollectorWatcher to Watcher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants