我可以在 OpenShift 中存储 helm chart 并使用它吗?

Can I store a helm chart in OpenShift and make use of it?

我已将 helm chart 作为 OCI 兼容容器上传到 Openshift。但是,我无法将 openshift 注册表添加为 helm 存储库,也无法找到另一种方法来说服 helm 使用“imagestream”作为安装源。

export HELM_EXPERIMENTAL_OCI=1
oc whoami --show-token | helm registry login my-cluster.com -u $(oc whoami) --password-stdin
helm create mychart
cd mychart/
helm chart save . my-cluster.com/$(oc project -q)/mychart:latest
helm chart push my-cluster.com/$(oc project -q)/mychart:latest

这会创建一个带有 dockerImageManifestMediaType: application/vnd.oci.image.manifest.v1+json 的“mychart”图像流 但是每当我尝试将 my-cluster.com 添加为 repo 或以任何其他方式安装时,它只会给我一个 404 错误:

helm install --username $(oc whoami) --password $(oc whoami --show-token) --repo https://my-cluster.com/$(oc project -q) mychart chart
Error: looks like "https://my-cluster.com/project" is not a valid chart repository or cannot be reached: failed to fetch https://my-cluster.com/project/index.yaml : 404 Not Found

是否需要注册表做一些“聪明”的事情来创建 Openshift 注册表中缺少的 index.yaml?

helm chart 与 OCI 兼容容器不同! helm chart 基本上是一个指定布局的压缩目录。

但是,可以在 openshift 上托管图表博物馆,将图表推送到所述图表博物馆,然后将其添加为 helm 存储库。

查看 chartmuseum github repository for more information on how to host your own chartmuseum and this tutorial 了解图表的确切外观以及如何将其推送到您托管的图表博物馆。

我发现你需要做 :

helm chart pull registry/mychart:tag
helm chart export registry/mychart:tag .

这样您的图表就在当前目录中。然后你可以:

helm install release mychart

未来版本的 helm 有一个 PR 可以安装类似 oci://registry/mychart:tag 的东西,节省了几个步骤。我想这是导致我出现问题的注册表和存储库之间的区别。

完全不需要 chartmuseum 或其他第三方应用程序。