チャートリポジトリの同期

注記: この例は、チャートリポジトリを提供するGoogle Cloud Storage(GCS)バケットに特化したものです。

前提条件

  • gsutil ツールをインストールします。 gsutil rsync機能に大きく依存しています
  • Helmバイナリにアクセスできることを確認してください
  • オプション: 誤って何かを削除した場合に備えて、GCSバケットでオブジェクトバージョン管理を設定することをお勧めします。

ローカルチャートリポジトリディレクトリを設定する

チャートリポジトリガイドで行ったように、ローカルディレクトリを作成し、パッケージ化されたチャートをそのディレクトリに配置します。

例えば

$ mkdir fantastic-charts
$ mv alpine-0.1.0.tgz fantastic-charts/

更新されたindex.yamlを生成する

次のように、ディレクトリパスとリモートリポジトリのURLをhelm repo indexコマンドに渡すことで、Helmを使用して更新されたindex.yamlファイルを生成します

$ helm repo index fantastic-charts/ --url https://fantastic-charts.storage.googleapis.com

これにより、更新されたindex.yamlファイルが生成され、fantastic-charts/ディレクトリに配置されます。

ローカルとリモートのチャートリポジトリを同期する

scripts/sync-repo.shを実行して、ディレクトリのコンテンツをGCSバケットにアップロードし、ローカルディレクトリ名とGCSバケット名を渡します。

例えば

$ pwd
/Users/me/code/go/src/helm.sh/helm
$ scripts/sync-repo.sh fantastic-charts/ fantastic-charts
Getting ready to sync your local directory (fantastic-charts/) to a remote repository at gs://fantastic-charts
Verifying Prerequisites....
Thumbs up! Looks like you have gsutil. Let's continue.
Building synchronization state...
Starting synchronization
Would copy file://fantastic-charts/alpine-0.1.0.tgz to gs://fantastic-charts/alpine-0.1.0.tgz
Would copy file://fantastic-charts/index.yaml to gs://fantastic-charts/index.yaml
Are you sure you would like to continue with these changes?? [y/N]} y
Building synchronization state...
Starting synchronization
Copying file://fantastic-charts/alpine-0.1.0.tgz [Content-Type=application/x-tar]...
Uploading   gs://fantastic-charts/alpine-0.1.0.tgz:              740 B/740 B
Copying file://fantastic-charts/index.yaml [Content-Type=application/octet-stream]...
Uploading   gs://fantastic-charts/index.yaml:                    347 B/347 B
Congratulations your remote chart repository now matches the contents of fantastic-charts/

チャートリポジトリの更新

チャートリポジトリのコンテンツのローカルコピーを保持するか、gsutil rsyncを使用してリモートチャートリポジトリのコンテンツをローカルディレクトリにコピーすることをお勧めします。

例えば

$ gsutil rsync -d -n gs://bucket-name local-dir/    # the -n flag does a dry run
Building synchronization state...
Starting synchronization
Would copy gs://bucket-name/alpine-0.1.0.tgz to file://local-dir/alpine-0.1.0.tgz
Would copy gs://bucket-name/index.yaml to file://local-dir/index.yaml

$ gsutil rsync -d gs://bucket-name local-dir/       # performs the copy actions
Building synchronization state...
Starting synchronization
Copying gs://bucket-name/alpine-0.1.0.tgz...
Downloading file://local-dir/alpine-0.1.0.tgz:                        740 B/740 B
Copying gs://bucket-name/index.yaml...
Downloading file://local-dir/index.yaml:                              346 B/346 B

役立つリンク