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

fix(config): only call run if informer not already synced #33

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

GeorgeMac
Copy link
Member

@GeorgeMac GeorgeMac commented Jun 20, 2024

Currently, reverst prints out a warning because informers are getting Run() called more than once.

W0619 17:08:31.029300       1 shared_informer.go:463] The sharedIndexInformer has started, run more than once is not allowed

This is because the shared informer factory caches previously instantiated informers based in the object type (note for future thought, it doesn't take into consideration e.g. list options or namespace filter supplied).
The way the secret source works, it can and will request the same informer, so we will invoke Run on the same instance more than once when secrets are updated.

This change just interogates the informer returned by the factory to see if it has been synced at-least once.
We won't build another informer until we have at-least waited for a single sync, so I am leaning on this invariant to avoid calling Run more than once.
The other alternative is to effectively create our own factory and cache it manually, which we could do.

For now though, this appears to avoid the double Run situation.

p.s. I fixed the race on t.Log causing the occassional panic in tests.

@GeorgeMac GeorgeMac enabled auto-merge June 20, 2024 09:47
@GeorgeMac GeorgeMac added this pull request to the merge queue Jun 20, 2024
Merged via the queue into main with commit 218b51f Jun 20, 2024
2 checks passed
@GeorgeMac GeorgeMac deleted the gm/fix-informer-warning branch June 20, 2024 11:47
markphelps added a commit that referenced this pull request Jan 10, 2025
* 'main' of https://github.com/flipt-io/reverst:
  fix(config): only call run if informer not already synced (#33)
  fix(config): correctly set token supplied via explicit token field (#32)
  feat(config): support watching k8s secrets directly as token sources (#31)
  fix(server): call WriteHeader in status interceptor (#30)
  fix: correct typo and add cancel context handling in watchFSNotify function (#29)
  feat: rename reverst to reverstd and add a new tunnel client CLI in its place (#28)
  feat(gh): tag images pushed to main with SHA as latest (#27)
  fix(server/client): fix propagation of client errors from server to client (#26)
  chore(gh): run publish on merge_group event type
  chore(mod): upgrade quic-go to v0.44.0 (#25)
  fix(server): stop accumulating times and calculate correct ellapsed
  fix(roundrobbin): ensure current cannot be out of bounds
  fix(roundrobbin): ensure that evict is only called once
  chore(dagger): run unit tests 5 times repeatedly
  test(roundrobbin): add failing case ensuring one call to evict per unique eviction
  chore(server): add debug logging around metrics endpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants