Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

HelmRepository: use conditional HTTP requests (ETag / If-Modified-Since) when fetching index.yaml

オープン
#2,113 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
go, kubernetes

調査の方向性

internal/helm/repository/chart_repository.go の CacheIndex と DownloadIndex から始め、次に internal/controller/helmrepository_controller.go の 464-468 行付近にある no-op の判断を追ってください。レスポンスバリデーターをオブジェクトごとに保持する方法と、body を読み取らずに 304 が既存の変更なしのパスに到達する仕組みを確認してください。バリデーターが存在する場合は条件付きリクエストが使用され、バリデーターのないリポジトリでは現在の動作が維持されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Problem

For HTTP(S) HelmRepository objects, source-controller downloads the full index.yaml on every reconcile interval, unconditionally: CacheIndex → DownloadIndex issues a plain GET, and only after the download completes is the digest compared against the current artifact to decide the reconcile is a no-op (helmrepository_controller.go#L464-L468). There is no If-None-Match / If-Modified-Since anywhere in the fetch path (the only ETag references in the codebase are the S3/GCS test mocks).

Real-world indexes are large (grafana ~2 MB, prometheus-community ~4 MB, bitnami historically >10 MB), and the cost is linear in the number of objects: N HelmRepository objects pointing at the same or different repos re-download N full indexes per interval, forever, even when nothing changed. In multi-tenant setups where each tenant namespace declares its own HelmRepository (cross-namespace refs disabled), N grows with the tenant count.

Measurements

Bench: k3s + source-controller v1.9.3, defaults; one HTTP helm repo with a 6.0 MB index; N HelmRepository objects with interval: 1m; server-side byte/request counters; idle steady state (index unchanged), 5-minute windows.

N objects index GETs / 5 min bytes / 5 min projected / day
1 5 31.0 MB 1,440 GETs / 8.9 GB
10 50 309.7 MB 14,400 GETs / 89 GB
50 249 1.54 GB ~72,000 GETs / ~444 GB

Every one of those bytes is thrown away: the digest comparison concludes "unchanged" after each download.

Proposal

Remember the ETag / Last-Modified response headers per object (an in-memory map keyed by object UID is sufficient — a controller restart just pays one full fetch), and send If-None-Match / If-Modified-Since on the next reconcile. On 304 Not Modified, short-circuit to the existing no-op path without touching the body. When the server sends no validators, behaviour is unchanged.

GitHub Pages, S3/CloudFront, Cloudflare, nginx/static hosting and Harbor all emit validators for static index files, so the common cases are covered.

This mirrors what the controller already does for the other source kinds — GitRepository checks advertised refs before cloning, OCIRepository resolves the manifest digest via HEAD before pulling — HelmRepository/HTTP is the only kind that must download the full payload to discover nothing changed.

Happy to send the PR.

主要言語
Go
スター
283
フォーク
258
平均マージ
1日 17時間
マージ済み PR(30日)
15

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fluxcd/source-controller のほかの issue

fluxcd/source-controller の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。