在 Helm 图表中使用 Requirements.lock 文件

Use of Requirements.lock file in Helm charts

我正在尝试了解 Requirements.lock 文件的用法。要使用从属图表,我们可以使用 Requirements.yaml。基于文档

Requirements.lock : rebuild the charts/ directory based on the requirements.lock file

Requirements.yaml : update charts/ based on the contents of requirements.yaml

谁能解释一下锁文件的区别和用法,我们是否也需要检查存储库中的 requirements.lock 文件?

This article说得好:

Much like a runtime language dependency file (such as Python’s requirements.txt), the requirements.yaml file allows you to manage your chart’s dependencies and their versions. When updating dependencies, a lockfile is generated so that subsequent fetching of dependencies use a known, working version.

requirements.yaml 文件仅列出图表所需的直接依赖项。这使您更容易专注于您的图表。

requirements.lock 文件列出了直接依赖项 and 它们的依赖项的确切版本 and 他们的依赖项 等等 。这允许 helm 精确跟踪整个依赖关系树并完全按照上次工作的方式重新创建它——即使某些依赖关系(或它们的依赖关系)稍后更新。

大致的工作原理如下:

  1. 您创建初始 requirements.yaml 文件。您 运行 helm installhelm 在构建依赖树时创建 requirements.lock 文件。
  2. 在下一个 helm install 上,helm 将确保它使用 requirements.lock[=42= 中标识的相同版本] 文件。
  3. 稍后,您更新 requirements.yaml 文件。您 运行 helm install(或 helm upgrade)和 helm 会注意到您的更改并更新 requirements.lock 文件来反映它们。