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 Improve log when agent fails to join a new Node #6048

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

roopeshsn
Copy link
Contributor

@roopeshsn roopeshsn commented Mar 3, 2024

Formatted the error logs when the agent tries to establish a cluster with others. It will recover eventually after all agents are up.

Fixes #5966

…luster

Signed-off-by: Roopesh Saravanan <roopeshsaravanan.dev@gmail.com>
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

The title is so long that it's truncated in a way that doesn't look neat.
Ideally the title should be less than 50 characters. Consider "Improve log when agent fails to join a new Node"

Comment on lines 226 to 230
errorMessage := err.Error()
prefixToRemove := "1 error occurred:"
errorMessage = strings.TrimPrefix(errorMessage, prefixToRemove)
errorMessage = strings.Replace(errorMessage, "\n\t* ", "", -1)
errorMessage = strings.TrimSpace(errorMessage)
Copy link
Member

Choose a reason for hiding this comment

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

This is too specific to the error's format and content. It should handle the case more generically.

Given that the type of the error returned by c.mList.Join is github.com/hashicorp/go-multierror.Error, and we know there could be at most 1 wrapped error (we only join 1 member in this case), we can just call errors.Unwrap(err) to get the wrapped error and use it in the log.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, let me check that.

@roopeshsn roopeshsn changed the title Fix error logs when an agent tries to establish a connection with a c… Fix Improve log when agent fails to join a new Node Mar 10, 2024
Signed-off-by: Roopesh Saravanan <roopeshsaravanan.dev@gmail.com>
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@tnqn tnqn added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Mar 11, 2024
@tnqn
Copy link
Member

tnqn commented Mar 11, 2024

/skip-all

@tnqn tnqn merged commit daed98b into antrea-io:main Mar 11, 2024
48 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some antrea-agent Pods always log errors about "join cluster failed"
2 participants