-
Notifications
You must be signed in to change notification settings - Fork 72
[Bugfix] [Platform] Increase memory limit for Inventory #1973
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
Conversation
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.
Pull Request Overview
This pull request implements a bugfix to address memory issues with the Inventory feature by changing how inventory data is served from an in-memory static response to a file-based approach.
- Adds a new
ConfigDestinationTypeFiledestination type for serving files directly - Refactors inventory handling to write data to a file and serve it via file path instead of keeping it in memory
- Updates checksum calculation to include inventory data for proper change detection
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/util/constants/gateway.go | Adds constant for inventory filename |
| pkg/deployment/resources/gateway/gateway_config_destination_type.go | Introduces new file destination type and updates validation logic |
| pkg/deployment/resources/gateway/gateway_config_destination_static.go | Defines file destination interface and implementation |
| pkg/deployment/resources/gateway/gateway_config_destination.go | Implements file destination validation and route action handling |
| pkg/deployment/resources/config_map_gateway.go | Refactors inventory from static response to file-based serving with updated checksum logic |
| CHANGELOG.md | Documents the bugfix for inventory memory limit increase |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
| if c.Type.Get() == ConfigDestinationTypeFile { | ||
| if c.File == nil { | ||
| return errors.Errorf("File response is not defined!") |
Copilot
AI
Oct 14, 2025
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.
The error message uses informal language with an exclamation mark. Consider using a more formal message like 'File response configuration is required' for consistency with other error messages in the codebase.
| return errors.Errorf("File response is not defined!") | |
| return errors.Errorf("File response configuration is required") |
| return errors.WithStack(errors.Wrapf(err, "Failed to render gateway inventory")) | ||
| } | ||
|
|
||
| gatewayChecksum := util.SHA256FromStringArray(gatewayCfgYamlChecksum, util.SHA256(inventoryData)) |
Copilot
AI
Oct 14, 2025
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.
The checksum calculation combines two different hash inputs (string and byte array hash). Consider using a consistent approach by either converting both to strings or both to byte arrays for clarity.
| gatewayChecksum := util.SHA256FromStringArray(gatewayCfgYamlChecksum, util.SHA256(inventoryData)) | |
| gatewayChecksum := util.SHA256FromStringArray(gatewayCfgYamlChecksum, fmt.Sprintf("%x", util.SHA256(inventoryData))) |
e8829aa to
e8ed542
Compare
No description provided.