rancher、spinnaker对helm chart的相对路径解析问题

目前(2019年5月21日) rancher 和 spinnaker 最新版本对 helm chart 仓库中的包相对路径解析存在一点问题。
rancher 会报:

1
Helm template failed. Error: stat template-dir: no such file or directory : exit status 1

spinnaker 则无法正确解析 artifact:

1
com.netflix.spinnaker.clouddriver.artifacts.helm.HelmArtifactCredentials$FailedDownloadException: Unable to download the contents of artifact

我们来看看怎么解决~

该问题官方 Issues 中已有提出:

除了等待官方的兼容之外,如果我们用的自己的私库,可控的话,可是考虑通过配置使生成的 index.yaml 为绝对路径来解决。

chartmuseum 配置绝对路径

通过 chartmuseum --help 命令我们可以看到 chartmuseum 支持 --chart-url value 这样的一个配置:

1
--chart-url value                     absolute url for .tgzs in index.yaml [$CHART_URL]

即,可以通过这个参数指定 index.yaml 中的 .tgzs 包绝对路径。
所以,如果你通过二进制运行,则:

1
chartmuseum  --port 8080 --storage local --storage-local-rootdir /path/to/charts --chart-url http://host:8080

。如果通过 docker 方式运行则这样指定:

1
2
3
4
5
docker run --rm -it \
-p 8080:8080 \
-e STORAGE=local \
-e STORAGE_LOCAL_ROOTDIR=/charts \
chartmuseum/chartmuseum:latest --chart-url http://host:8080
谢谢鼓励