helm

package
v0.26.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartUpdateHelmRepoInBackground

func StartUpdateHelmRepoInBackground()

func StopUpdateHelmRepoInBackground

func StopUpdateHelmRepoInBackground()

StopUpdateHelmRepoInBackground 停止 Helm 更新定时任务

Types

type ChartVersion

type ChartVersion struct {
	*Metadata
	URLs    []string  `json:"urls"`
	Created time.Time `json:"created,omitempty"`
	Removed bool      `json:"removed,omitempty"`
	Digest  string    `json:"digest,omitempty"`

	// ChecksumDeprecated is deprecated in Helm 3, and therefore ignored. Helm 3 replaced
	// this with Digest. However, with a strict YAML parser enabled, a field must be
	// present on the struct for backwards compatibility.
	ChecksumDeprecated string `json:"checksum,omitempty"`

	// EngineDeprecated is deprecated in Helm 3, and therefore ignored. However, with a strict
	// YAML parser enabled, this field must be present.
	EngineDeprecated string `json:"engine,omitempty"`

	// TillerVersionDeprecated is deprecated in Helm 3, and therefore ignored. However, with a strict
	// YAML parser enabled, this field must be present.
	TillerVersionDeprecated string `json:"tillerVersion,omitempty"`

	// URLDeprecated is deprecated in Helm 3, superseded by URLs. It is ignored. However,
	// with a strict YAML parser enabled, this must be present on the struct.
	URLDeprecated string `json:"url,omitempty"`
}

type ChartVersions

type ChartVersions []*ChartVersion

type Dependency

type Dependency struct {
	// Name is the name of the dependency.
	//
	// This must mach the name in the dependency's Chart.yaml.
	Name string `json:"name" yaml:"name"`
	// Version is the version (range) of this chart.
	//
	// A lock file will always produce a single version, while a dependency
	// may contain a semantic version range.
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
	// The URL to the repository.
	//
	// Appending `index.yaml` to this string should result in a URL that can be
	// used to fetch the repository index.
	Repository string `json:"repository" yaml:"repository"`
	// A yaml path that resolves to a boolean, used for enabling/disabling charts (e.g. subchart1.enabled )
	Condition string `json:"condition,omitempty" yaml:"condition,omitempty"`
	// Tags can be used to group charts for enabling/disabling together
	Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
	// Enabled bool determines if chart should be loaded
	Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
	// ImportValues holds the mapping of source values to parent key to be imported. Each item can be a
	// string or pair of child/parent sublist items.
	ImportValues []any `json:"import-values,omitempty" yaml:"import-values,omitempty"`
	// Alias usable alias to be used for the chart
	Alias string `json:"alias,omitempty" yaml:"alias,omitempty"`
}

Dependency describes a chart upon which another chart depends.

Dependencies can be used to express developer intent, or to capture the state of a chart.

type Helm

type Helm interface {
	AddOrUpdateRepo(repo *models.HelmRepository) error
	GetReleaseHistory(ns, releaseName string) ([]*models.ReleaseHistory, error)
	InstallRelease(ns, releaseName, repoName, chartName, version string, values ...string) error
	UninstallRelease(ns, releaseName string) error
	UpgradeRelease(ns, name string, values ...string) error
	GetChartValue(repoName, chartName, version string) (string, error)
	GetChartVersions(repoName, chartName string) ([]string, error)
	UpdateReposIndex(ids string)
	GetReleaseList() ([]*models.Release, error)
	GetReleaseNote(ns, name string) (string, error)
	GetReleaseNoteWithRevision(ns, name, revision string) (string, error)
	GetReleaseValues(ns, name string) (string, error)
	GetReleaseValuesWithRevision(ns, name, revision string) (string, error)
	RemoveRepo(repoName string) error
	GetRepoList() ([]*RepoVO, error)
}

type HelmCmd

type HelmCmd struct {
	HelmBin string // helm 二进制路径,默认 "helm"
	// contains filtered or unexported fields
}

func NewBackgroundHelmCmd

func NewBackgroundHelmCmd(helmBin string) *HelmCmd

NewBackgroundHelmCmd 独立后台执行Helm命令

func NewHelmCmd

func NewHelmCmd(helmBin string, clusterID string, cluster *service.ClusterConfig) *HelmCmd

func NewHelmCmdWithNoCluster

func NewHelmCmdWithNoCluster(helmBin string) *HelmCmd

NewHelmCmdWithNoCluster 仅Helm命令

func (*HelmCmd) AddOrUpdateRepo

func (h *HelmCmd) AddOrUpdateRepo(helmRepo *models.HelmRepository) error

AddOrUpdateRepo 添加或更新 Helm 仓库

func (*HelmCmd) GetChartValue

func (h *HelmCmd) GetChartValue(repoName, chartName, version string) (string, error)

func (*HelmCmd) GetChartVersions

func (h *HelmCmd) GetChartVersions(repoName string, chartName string) ([]string, error)

func (*HelmCmd) GetReleaseHistory

func (h *HelmCmd) GetReleaseHistory(namespace string, releaseName string) ([]*models.ReleaseHistory, error)

func (*HelmCmd) GetReleaseList

func (h *HelmCmd) GetReleaseList() ([]*models.Release, error)

func (*HelmCmd) GetReleaseNote

func (h *HelmCmd) GetReleaseNote(ns string, name string) (string, error)

func (*HelmCmd) GetReleaseNoteWithRevision

func (h *HelmCmd) GetReleaseNoteWithRevision(ns string, name string, revision string) (string, error)

func (*HelmCmd) GetReleaseValues

func (h *HelmCmd) GetReleaseValues(ns string, name string) (string, error)

func (*HelmCmd) GetReleaseValuesWithRevision

func (h *HelmCmd) GetReleaseValuesWithRevision(ns string, name string, revision string) (string, error)

func (*HelmCmd) GetRepoList

func (h *HelmCmd) GetRepoList() ([]*RepoVO, error)

func (*HelmCmd) InstallRelease

func (h *HelmCmd) InstallRelease(namespace, releaseName, repoName, chartName, version string, values ...string) error

func (*HelmCmd) ReAddMissingRepo

func (h *HelmCmd) ReAddMissingRepo()

ReAddMissingRepo 重新添加丢失的Repo,比如在容器环境中重启了。

func (*HelmCmd) RemoveRepo

func (h *HelmCmd) RemoveRepo(repoName string) error

func (*HelmCmd) UninstallRelease

func (h *HelmCmd) UninstallRelease(namespace string, releaseName string) error

func (*HelmCmd) UpdateAllReposIndex

func (h *HelmCmd) UpdateAllReposIndex()

func (*HelmCmd) UpdateReposIndex

func (h *HelmCmd) UpdateReposIndex(ids string)

func (*HelmCmd) UpgradeRelease

func (h *HelmCmd) UpgradeRelease(ns, name string, values ...string) error

type IndexFile

type IndexFile struct {
	// This is used ONLY for validation against chartmuseum's index files and is discarded after validation.
	ServerInfo map[string]any           `json:"serverInfo,omitempty"`
	APIVersion string                   `json:"apiVersion"`
	Generated  time.Time                `json:"generated"`
	Entries    map[string]ChartVersions `json:"entries"`
	PublicKeys []string                 `json:"publicKeys,omitempty"`

	// Annotations are additional mappings uninterpreted by Helm. They are made available for
	// other applications to add information to the index file.
	Annotations map[string]string `json:"annotations,omitempty"`
}

type Maintainer

type Maintainer struct {
	// Name is a user name or organization name
	Name string `json:"name,omitempty"`
	// Email is an optional email address to contact the named maintainer
	Email string `json:"email,omitempty"`
	// URL is an optional URL to an address for the named maintainer
	URL string `json:"url,omitempty"`
}

type Metadata

type Metadata struct {
	// The name of the chart. Required.
	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. Required.
	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. Required.
	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"`
}

Metadata for a Chart file. This models the structure of a Chart.yaml file.

type RepoVO

type RepoVO struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL