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

Retry running a CRD Manager if it fails #2202

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

Conversation

ptodev
Copy link
Contributor

@ptodev ptodev commented Dec 2, 2024

PR Description

Setting up a k8s informer may time out (see #2161). In that case, we'd only retry setting up an informer the next time Alloy's config changes. We should retry sooner than that, since the config may never change.

Notes to the Reviewer

A few reasons why the PR is in draft stage:

  • No unit tests have been added yet.
  • I'm not sure what is a good retry value. I suppose it should be something between 30 seconds and 60 seconds.

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated
  • Config converters updated

level.Error(c.opts.Logger).Log("msg", "error running crd manager", "err", err)
errChan <- err
//TODO: What is a good default value for this?
retryInterval = 30 * time.Second
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use backoff to avoid thundering herd problems. You can use a similar approach to this: https://github.com/grafana/alloy/blob/main/internal/runtime/internal/controller/loader.go#L732

for {
select {
case <-innerCtx.Done():
//TODO: Log that the manager is exiting?
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say let's add a debug level just in case.

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