Helm Rep Add - 不是有效的图表存储库或无法访问:将 YAML 转换为 JSON 时出错:在此上下文中不允许使用 yaml 映射值

问题描述 投票:0回答:1

我正在尝试使用 Github 页面设置 Helm 图表回购。通过 Github Actions 生成 index.yaml 等一切似乎都很好,太棒了。

索引.yaml

apiVersion: v1
entries:
  test:
  - apiVersion: v1
    created: "2021-08-27T09:54:44.830905882Z"
    description: Testing the chart releaser
    digest: b41b263d236ef9eee0a75e877982a10ea73face093b4999c6004263b041f0fad
    keywords:
    - test
    name: test
    urls:
    - https://github.com/xxx/xxx/releases/download/test-0.0.9/test-0.0.9.tgz
    version: 0.0.9
generated: "2021-08-27T09:54:44.587113879Z"

还有测试图

name: test
description: Testing the chart releaser
version: 0.0.9
apiVersion: v1
keywords:
  - test
sources:
home:

但是,当我尝试使用添加回购时

helm repo add test https://didactic-quibble-e0daddd0.pages.github.io/

我得到错误

错误:看起来“http://didactic-quibble-e0daddd0.pages.github.io/”不是有效的图表存储库或无法访问:将 YAML 转换为 JSON 时出错:yaml:第 188 行:不允许映射值在这种情况下

URL http://didactic-quibble-e0daddd0.pages.github.io/index.yaml 返回上述 index.yaml 文件。

任何帮助将不胜感激。

干杯

kubernetes-helm helm3
1个回答
0
投票

我会建议一个不同的程序,希望能帮助您将 GitHub 存储库托管为 Helm 存储库。

我这里有 2 个 Helm 图表:

  • Library:这将被其他 helm 图表用作 依赖。我将在下面的示例中作为 GitHub 上的 helm 存储库托管
  • App:这将消耗Library图表等 功能。

图书馆图表:在您的图书馆目录中

helm package libchart
helm repo index .

验证索引文件已创建且条目正确

more index.yaml 
apiVersion: v1
entries:
  libchart:
  - apiVersion: v2
    appVersion: 1.16.0
    created: "2022-11-30T08:57:01.109116+09:00"
    description: A Helm chart for Kubernetes
    digest: 8aa38d70d61f81cf31627a7d7d9cc5c293f340bf01918c9a16ac1fac9fcc96e9
    name: libchart
    type: library
    urls:
    - libchart-0.1.0.tgz
    version: 0.1.0
generated: "2022-11-30T08:57:01.108194+09:00"

将“index.yaml”和“.tgz”文件提交到 git 仓库。

添加头盔回购:

helm repo add mylib --username parjun8840 --password TOPSECRET-TOKEN-FROM-GIT
https://raw.githubusercontent.com/YOURGITUSER/helm-library/master
 
"mylib" has been added to your repositories

helm repo update

应用图表:在您的应用目录中

more Chart.yaml
apiVersion: v2
name: appchart
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"
dependencies:
  - name: libchart
    version: 0.1.0
    repository: https://raw.githubusercontent.com/YOURGITUSER/helm-library/master


helm dependency update 
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "mylib" chart repository
...Successfully got an update from the "newrelic" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 1 charts
Downloading libchart from repo https://raw.githubusercontent.com/YOURGITUSER/helm-library/master
Deleting outdated charts
© www.soinside.com 2019 - 2024. All rights reserved.