同步你的存储库

此示例专门用于提供chart存储库的Google Cloud Storage(GCS)存储。

先决条件

  • 安装gsutil工具。我们严重依赖于gsutil rsync功能
  • 请务必访问helm二进制文件
  • 可选:我们建议您在GCS存储上设置对象版本控制,以防意外删除某些内容.

设置本地chart存储库目录

像我们在chart存储库指南中一样创建一个本地目录,并将打包的chart放入该目录中。

例如:

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

生成更新的INDEX.YAML

使用helm通过将远程存储库的目录路径和URL传递到helm repo index命令来生成更新的index.yaml文件,如下所示:

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

这将生成一个更新的index.yaml文件并放置在fantastic-charts/目录中。

同步您的本地和远程chart存储库

通过运行将目录的内容上传到您的GCS存储,scripts/sync-repo.sh并传入本地目录名称和GCS存储名称。

  1. $ pwd
  2. /Users/funuser/go/src/github.com/kubernetes/helm
  3. $ scripts/sync-repo.sh fantastic-charts/ fantastic-charts
  4. Getting ready to sync your local directory (fantastic-charts/) to a remote repository at gs://fantastic-charts
  5. Verifying Prerequisites....
  6. Thumbs up! Looks like you have gsutil. Let's continue.
  7. Building synchronization state...
  8. Starting synchronization
  9. Would copy file://fantastic-charts/alpine-0.1.0.tgz to gs://fantastic-charts/alpine-0.1.0.tgz
  10. Would copy file://fantastic-charts/index.yaml to gs://fantastic-charts/index.yaml
  11. Are you sure you would like to continue with these changes?? [y/N]} y
  12. Building synchronization state...
  13. Starting synchronization
  14. Copying file://fantastic-charts/alpine-0.1.0.tgz [Content-Type=application/x-tar]...
  15. Uploading gs://fantastic-charts/alpine-0.1.0.tgz: 740 B/740 B
  16. Copying file://fantastic-charts/index.yaml [Content-Type=application/octet-stream]...
  17. Uploading gs://fantastic-charts/index.yaml: 347 B/347 B
  18. Congratulations your remote chart repository now matches the contents of fantastic-charts/

更新您的chart存储库

您需要保留chart存储库内容的本地副本,或者gsutil rsync将远程chart存储库的内容复制到本地目录。

  1. $ gsutil rsync -d -n gs://bucket-name local-dir/ # the -n flag does a dry run
  2. Building synchronization state...
  3. Starting synchronization
  4. Would copy gs://bucket-name/alpine-0.1.0.tgz to file://local-dir/alpine-0.1.0.tgz
  5. Would copy gs://bucket-name/index.yaml to file://local-dir/index.yaml
  6. $ gsutil rsync -d gs://bucket-name local-dir/ # performs the copy actions
  7. Building synchronization state...
  8. Starting synchronization
  9. Copying gs://bucket-name/alpine-0.1.0.tgz...
  10. Downloading file://local-dir/alpine-0.1.0.tgz: 740 B/740 B
  11. Copying gs://bucket-name/index.yaml...
  12. Downloading file://local-dir/index.yaml: 346 B/346 B

有用的链接:有关gsutil rsync的文档 Chart Repository指南 *有关Google云存储中对象版本控制和并发控制的文档