.helmignore 文件

.helmignore 文件用于指定您不想包含在 Helm 图表中的文件。

如果该文件存在,则 helm package 命令将在打包应用程序时忽略 .helmignore 文件中指定模式的所有文件。

这有助于避免在 Helm 图表中添加不必要的或敏感文件或目录。

.helmignore 文件支持 Unix shell glob 匹配、相对路径匹配和否定(以 ! 为前缀)。每行只考虑一个模式。

这是一个示例 .helmignore 文件

# comment

# Match any file or path named .helmignore
.helmignore

# Match any file or path named .git
.git

# Match any text file
*.txt

# Match only directories named mydir
mydir/

# Match only text files in the top-level directory
/*.txt

# Match only the file foo.txt in the top-level directory
/foo.txt

# Match any file named ab.txt, ac.txt, or ad.txt
a[b-d].txt

# Match any file under subdir matching temp*
*/temp*

*/*/temp*
temp?

与 .gitignore 的一些显著区别

  • 不支持 '**' 语法。
  • glob 库是 Go 的 'filepath.Match',而不是 fnmatch(3)
  • 尾随空格始终被忽略(没有支持的转义序列)
  • 不支持 '!' 作为特殊的引导序列。
  • 它默认不排除自身,您必须为 .helmignore 添加一个显式条目

我们很乐意您能帮助使这份文档更完善。要添加、更正或删除信息,请提交问题或向我们发送拉取请求。