Skip to content

Conversation

@ajanikow
Copy link
Collaborator

No description provided.

@cla-bot cla-bot bot added the cla-signed label Oct 14, 2025
@ajanikow ajanikow requested a review from Copilot October 14, 2025 14:14
Copy link

Copilot AI left a 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 ConfigDestinationTypeFile destination 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!")
Copy link

Copilot AI Oct 14, 2025

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.

Suggested change
return errors.Errorf("File response is not defined!")
return errors.Errorf("File response configuration is required")

Copilot uses AI. Check for mistakes.
return errors.WithStack(errors.Wrapf(err, "Failed to render gateway inventory"))
}

gatewayChecksum := util.SHA256FromStringArray(gatewayCfgYamlChecksum, util.SHA256(inventoryData))
Copy link

Copilot AI Oct 14, 2025

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.

Suggested change
gatewayChecksum := util.SHA256FromStringArray(gatewayCfgYamlChecksum, util.SHA256(inventoryData))
gatewayChecksum := util.SHA256FromStringArray(gatewayCfgYamlChecksum, fmt.Sprintf("%x", util.SHA256(inventoryData)))

Copilot uses AI. Check for mistakes.
@ajanikow ajanikow force-pushed the bugfix/increase_memory_limit_for_inv branch from e8829aa to e8ed542 Compare October 15, 2025 10:28
@ajanikow ajanikow merged commit f6e20dd into master Oct 17, 2025
4 checks passed
@ajanikow ajanikow deleted the bugfix/increase_memory_limit_for_inv branch October 17, 2025 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants