-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Handle Missing Redis Ports by Defaulting to Standard Redis Port in Loki #11414
base: main
Are you sure you want to change the base?
Conversation
… ports, defaulting to standard Redis port"
Trivy scan found the following vulnerabilities:
|
// If the port is missing, use the host as is and set a default port, if desired | ||
host = endpoints[0] | ||
// Example: set a default port, or you can choose to handle this differently | ||
port = "6379" // Default Redis port |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feels like something we should do via a validateConfig
function before passing the config to the client creation
@dannykopping I think you worked on the caching code the most recently, any thoughts here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if you would like me to approach this differently. I would be happy to contribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following up on this @dannykopping and @cstyan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have a new function that's called before deriveEndpoints
in NewRedisClient
that logs a warning for every endpoint that doesn't have a port set clarifying that the default port will be used. Alternatively, this new function could be called before NewRedisClient
in cache.go
New
.
Summary of Changes:
deriveEndpoints
function inpkg/storage/chunk/cache/redis_client.go
to handle cases where the Redis port is not specified in the Loki configuration.Reason for Changes:
Impact on the Project:
Additional Notes for Reviewers:
Related Issue:
Checklist for Review and Merge: