kubernetes-helm - 从图表中查找 repo
问题描述
我正在尝试编写一段代码,该代码将“观察”添加到集群中的任何新掌舵图,并找出有关该图表的一些细节。例如,使用的值、图表的回购等。
我能够获取图表的值,但 repo url 未存储在图表中。
有没有办法在给定图表的情况下获得回购?
看起来 helm 将源存储在图表元数据中,但有没有更好的方法来获取这些信息?
type Metadata struct {
// The name of the chart
Name string `json:"name,omitempty"`
// The URL to a relevant project page, git repo, or contact person
Home string `json:"home,omitempty"`
// Source is the URL to the source code of this chart
Sources []string `json:"sources,omitempty"`
// A SemVer 2 conformant version string of the chart
Version string `json:"version,omitempty"`
// A one-sentence description of the chart
Description string `json:"description,omitempty"`
// A list of string keywords
Keywords []string `json:"keywords,omitempty"`
// A list of name and URL/email address combinations for the maintainer(s)
Maintainers []*Maintainer `json:"maintainers,omitempty"`
// The URL to an icon file.
Icon string `json:"icon,omitempty"`
// The API Version of this chart.
APIVersion string `json:"apiVersion,omitempty"`
// The condition to check to enable chart
Condition string `json:"condition,omitempty"`
// The tags to check to enable chart
Tags string `json:"tags,omitempty"`
// The version of the application enclosed inside of this chart.
AppVersion string `json:"appVersion,omitempty"`
// Whether or not this chart is deprecated
Deprecated bool `json:"deprecated,omitempty"`
// Annotations are additional mappings uninterpreted by Helm,
// made available for inspection by other applications.
Annotations map[string]string `json:"annotations,omitempty"`
// KubeVersion is a SemVer constraint specifying the version of Kubernetes required.
KubeVersion string `json:"kubeVersion,omitempty"`
// Dependencies are a list of dependencies for a chart.
Dependencies []*Dependency `json:"dependencies,omitempty"`
// Specifies the chart type: application or library
Type string `json:"type,omitempty"`
}```
解决方案
您列出的结构实际上并不存储存储库 URL。这只是charts.yaml
. 例如,在 Hazelcast Helm Chart 中,它是 "http://hazelcast.org/",它不是图表存储库 URL。
当您执行时helm repo update
,Helm 只是从存储库中下载图表,而不是稍后存储 repo URL。因此,在您的情况下,如果您想提取给定图表的 repo URL,您需要执行以下命令(并匹配正确的 repo 名称):
helm repo list
推荐阅读
- django - 使用 ModelChoiceField 时的 Django 空列表
- javascript - 如何在 JavaScript 中将“keydown”事件处理程序与“IntersectionObserver”一起使用?
- python - vtk.vtkOBJExporter 不导出整个渲染
- python - 神经网络不断预测相同的数字
- regex - Notepad++ 正则表达式:搜索仅包含字母且没有数字字符的单词
- typescript - 如何记录类型 Record 的返回
使用 Nestjs OpenApi? - docker - 在 Docker 中让 SSL 与 NGINX 一起工作时遇到问题
- r - 使用两个数据集查找最近邻居的欧几里得距离
- python - 有没有办法将 matplotlib 的 FuncAnimation 向前或向后移动一帧?
- android - 如何在通知栏中的 setSmallIcon 中设置进度条?