hypnoglow / helm-s3

⎈ Helm plugin that adds support for AWS S3 as a chart repository.
https://helm-s3.hypnoglow.io
MIT License
567 stars 159 forks source link

`Push` should return an error when metadata exceeds 2KB #461

Open Shion1305 opened 2 months ago

Shion1305 commented 2 months ago

Description: While working with helm-s3, I encountered an issue where large metadata in Chart.yaml caused failures during reindexing. The issue arises because helm-s3 marshals the chart's metadata into JSON and stores it as x-amz-meta-chart-metadata in an S3 object, but S3 limits metadata to 2KB. If the metadata exceeds this limit, it gets truncated, leading to issues when reindexing charts.

S3 docs ![Uploading Screenshot 2024-09-29 at 8.46.22.png…]()

Steps to Reproduce:

  1. Add a long string (e.g., in the description field) in Chart.yaml.
  2. Push the chart using helm-s3.
  3. The chart gets uploaded, but the metadata is marshaled into x-amz-meta-chart-metadata and truncated due to the 2KB limit.
  4. When running helm s3 reindex, the metadata fails to unmarshal, causing the reindex operation to fail.

Proposal:

To avoid this issue and prevent future operations (such as reindexing) from failing, I propose that the Push command should throw an error if the metadata exceeds 2KB. This will inform users at the point of pushing the chart, allowing them to adjust the metadata size before uploading.

Benefit:

By adding this validation to the Push operation, users will be able to resolve the issue earlier, avoiding troubleshooting time and preventing failures in subsequent operations such as reindex.

Shion1305 commented 2 months ago

I'm willing to address and create PR for this issue.