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

Disable logger development mode to avoid panicking #3658

Closed
4 tasks done
AndiDog opened this issue Aug 28, 2024 · 0 comments
Closed
4 tasks done

Disable logger development mode to avoid panicking #3658

AndiDog opened this issue Aug 28, 2024 · 0 comments
Assignees
Labels
team/tenet Team Tenet

Comments

@AndiDog
Copy link

AndiDog commented Aug 28, 2024

zap is used as default logger for kubebuilder-generated operators. By default, its main.go uses Development: true logging mode, meaning it will panic on logic errors such as odd number of arguments in structured logging calls (example: logger.Info("the message", "key without value argument")).

To rectify:

  • Set Development: false in zap options struct of main.go
  • If applicable: use dev mode in tests (e.g. logger := zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
  • If applicable: ensure zap is even used as controller-runtime logger (ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))) – we found a few spots where klogr was still used

Example PR that does all this

From a GitHub code search in the original issue of Phoenix, we found that these repos of your team are affected:

  • azure-private-endpoint-operator
  • cluster-api-events
  • cluster-cleaner
  • upgrade-schedule-operator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team/tenet Team Tenet
Projects
Archived in project
Development

No branches or pull requests

3 participants