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(log): add custom error handler for Kubernetes API errors #1024

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ritwikranjan
Copy link
Contributor

@ritwikranjan ritwikranjan commented Nov 18, 2024

Description

This pull request includes changes to improve error handling and logging in the Kubernetes watcher and to simplify error checking in the endpoint reconciler. The most important changes include adding a custom error handler for the Kubernetes watcher, importing necessary packages, and simplifying error handling logic.

Improvements to error handling and logging:

  • pkg/k8s/watcher_linux.go: Added a custom error handler retinaK8sErrorHandler to log specific Kubernetes API server errors and tag them for easier identification.
  • pkg/k8s/watcher_linux.go: Registered the custom error handler in the init function to ensure it is used by the watcher.

Code simplification:

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

@@ -533,7 +533,7 @@ func (r *endpointReconciler) handlePodUpsert(ctx context.Context, newPEP *PodEnd
// May end up getting another endpoint ID below if we try to create the CEP below.
// No downside to this.

if !k8serrors.IsNotFound(err) && err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this change is unrelated but was quick so did it, we have already checked this condition before so it was an always true condition

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.

1 participant