问题描述
我有一个现有的github项目.我想在项目中创建一个helm
文件夹/将其添加到项目中以存储头盔yaml文件.我想引用此github项目/文件夹,以在我的本地/dev环境中充当头盔存储库.我知道我可以将图表添加到本地/默认头盔仓库中.用例是,如果另一个开发人员在github中签出代码并且他需要在图表上工作,那么他可以直接从工作文件夹中运行helm install
. helm.sh
网站上有添加gh-pages
分支的说明,但是我想知道是否可以避免.
I have an existing github project. I want to create/add a helm
folder to the project to store the helm yaml files. I want to reference this github project/folder to act like a helm repo in my local/dev environment. I know I can add the charts to my local/default helm repo. The use case is if another developer checks out the code in github and he needs to work on the charts then he can run helm install
directly from the working folder. The helm.sh
website has instructions of adding a gh-pages
branch but I am wondering if I can avoid it.
我可以通过helm repo add
命令使用现有的github项目吗?
Can I use an existing github project and it via the helm repo add
command?
推荐答案
不幸的是,我找不到使用私有存储库通过GitHub发布Helm图表的方法.从理论上讲,它可以使用GitHub令牌和第二个(原始URL方法)工作,但我还没有尝试过.由于仍然使用docker注册表,因此值得尝试使用OCI(docker)注册表来存储图表.
Unfortunately, I wasn't able to find a way to publish helm charts via GitHub using private repositories. On a theoretical level, it might work using GitHub token and 2nd (raw URLs method), but I haven't tried it. Since you're using docker registry anyway, it might be worth trying using OCI (docker) registry to store the charts.
如果这不起作用,或者您有公共存储库,则可以使用GitHub Pages,也可以使用GitHub原始URL.两种解决方案都需要公共存储库.
If that doesn't work, or you have public repos, it is possible to either use GitHub Pages, or use GitHub raw URLs. Both of the solutions require public repository.
要使用 GitHub页面:
- 设置github页面以将
docs
文件夹发布为github页面(您可以使用其他名称,请稍后替换) - 将头盔仓库打包为.tgz(使用
helm package
):helm package charts/mychart -d docs/
.将charts/mychart
替换为图表根文件夹的路径 - 包括index.yaml-存储库
helm repo index ./docs --url https://<YOUR_ORG_OR_USERNAME>.github.io/<REPO_NAME>
的索引文件
- Setup github pages to publish
docs
folder as github pages (you can use a different name, just substitue later) - Package the helm repo as .tgz (using
helm package
):helm package charts/mychart -d docs/
. Substitutecharts/mychart
with a path to a chart root folder - Include an index.yaml -- an index file for the repository
helm repo index ./docs --url https://<YOUR_ORG_OR_USERNAME>.github.io/<REPO_NAME>
现在您可以添加存储库:helm repo add <INTERNAL_NAME> https://<YOUR_ORG_OR_USERNAME>.github.io/<REPO_NAME>
Now you can add the repo: helm repo add <INTERNAL_NAME> https://<YOUR_ORG_OR_USERNAME>.github.io/<REPO_NAME>
要使用原始URL :
- 像上面一样,将index.yaml并将TGZ绘制到名为
docs
的文件夹中
- Place index.yaml and chart TGZs into a folder called
docs
, just like above
现在您可以添加一个仓库:helm repo add <INTERNAL_NAME> https://raw.githubusercontent.com/<YOUR_ORG_OR_USERNAME>/<REPO_NAME>/<BRANCH_USUALLY_MASTER>/docs
Now you can add a repo: helm repo add <INTERNAL_NAME> https://raw.githubusercontent.com/<YOUR_ORG_OR_USERNAME>/<REPO_NAME>/<BRANCH_USUALLY_MASTER>/docs
这篇关于如何从现有的github项目中添加头盔仓库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!